connectivityinstance.java
来自「270的linux说明」· Java 代码 · 共 189 行
JAVA
189 行
/*
Copyright (c) 2008, Intel Corporation.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/package com.intel.mobile.context;import com.intel.mobile.base.*;/** * The instance object for connectivity. */public class ConnectivityInstance extends ContextInstance{ public final BoolProperty IsConnected = null; public static final int TIMEOUT = 0xFFFFFFFF; public EventProperty Connected; public EventProperty Disconnected; public EventProperty IpAddressChanged; public EventProperty RouteTableChanged; // Constructor private ConnectivityInstance(long objRef) throws IntelMobileException { super(objRef); init(objRef); } /** * Test whether the URI is reachable. * @param sUriDestination protocol + "://" + host + [":" + port] + ["/" + virtual_dir] * @return true if the the sUriDestination is reachable. * @throws IntelMobileException */ public boolean IsReachable(String sUriDestination) throws IntelMobileException { return IsReachableNative(sUriDestination); } /*
Copyright (c) 2008, Intel Corporation.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/ public boolean IsReachable(String sUriDestination,int sTimeOut, int sRetryCount) throws IntelMobileException { return IsReachableExNative(sUriDestination,"N","123","123",sTimeOut,sRetryCount); } public boolean IsReachable(String sUriDestination, String sProxyURL, String sProxyUsername, String sProxyPassword) throws IntelMobileException { return IsReachableExNative(sUriDestination,sProxyURL,sProxyUsername,sProxyPassword, 0 ,1); } public boolean IsReachable(String sUriDestination, String sProxyURL, String sProxyUsername, String sProxyPassword,int sTimeOut, int sRetryCount) throws IntelMobileException { return IsReachableExNative(sUriDestination,sProxyURL,sProxyUsername,sProxyPassword,sTimeOut,sRetryCount); } /** * Get the key of the NetworkAdapter that is currently used to communicate with the host. * @param sUriDestination protocol + "://" + host + [":" + port] + ["/" + virtual_dir] * @return * @throws IntelMobileException */ public String GetNetworkAdapterKey(String sUriDestination) throws IntelMobileException { return GetNetworkAdapterKeyNative(sUriDestination); } /** * Get the key of the LinkProtocol that is currently used to communicate with the host. * @param sUriDestination protocol + "://" + host + [":" + port] + ["/" + virtual_dir] * @return * @throws IntelMobileException */ public String GetNetworkLinkProtocolKey(String sUriDestination) throws IntelMobileException { return GetNetworkLinkProtocolKeyNative(sUriDestination); } /** * Get the latency to the host. * @param sUriDestination protocol + "://" + host + [":" + port] + ["/" + virtual_dir] * @return The latency value in milliseconds * @throws IntelMobileException */ public int GetLatency(String sUriDestination) throws IntelMobileException { return GetLatencyNative(sUriDestination); } public int GetLatency(String sUriDestination,int sTimeOut, int sRetryCount) throws IntelMobileException { return GetLatencyExNative(sUriDestination,"N","123","123",sTimeOut,sRetryCount); } public int GetLatency(String sUriDestination, String sProxyURL, String sProxyUsername, String sProxyPassword) throws IntelMobileException { return GetLatencyExNative(sUriDestination,sProxyURL,sProxyUsername,sProxyPassword,0,1); } public int GetLatency(String sUriDestination, String sProxyURL, String sProxyUsername, String sProxyPassword,int sTimeOut, int sRetryCount) throws IntelMobileException { return GetLatencyExNative(sUriDestination,sProxyURL,sProxyUsername,sProxyPassword,sTimeOut,sRetryCount); } private native void init(long objRef) throws IntelMobileException; private native boolean IsReachableNative( String sUriDestination ) throws IntelMobileException; private native boolean IsReachableExNative( String sUriDestination, String sProxyURL, String sProxyUsername, String sProxyPassword,int sTimeOut, int sRetryCount ) throws IntelMobileException; private native String GetNetworkAdapterKeyNative( String sUriDestination ) throws IntelMobileException; private native String GetNetworkLinkProtocolKeyNative( String sUriDestination ) throws IntelMobileException; private native int GetLatencyNative( String sUriDestination ) throws IntelMobileException; private native int GetLatencyExNative( String sUriDestination, String sProxyURL, String sProxyUsername, String sProxyPassword,int sTimeOut, int sRetryCount ) throws IntelMobileException;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?