public final class ConnectivityStateManager extends java.lang.Object implements DefaultCallbacksInterface
FiniteStateMachine to handle events.| Modifier and Type | Class and Description |
|---|---|
static class |
ConnectivityStateManager.CacheState
Class responsible to cache the list of connected networks.
|
static interface |
ConnectivityStateManager.ConnectivityStateChangeListener
Listener which is triggered by callbacks.
|
static class |
ConnectivityStateManager.State
An enum denoting possible values of state for network object.
|
| Modifier and Type | Method and Description |
|---|---|
ConnectivityStateManager.CacheState |
cacheStates()
This function is responsible for caching of networks that are in connected state.
|
static boolean |
connect(Network network)
A function to connect to a given network.
|
void |
connectStatusCallback(Network network)
A function that needs to be implemented by subscribers to
get info regrading connection status of the
Network. |
static boolean |
disconnect(Network network)
A function to disconnect from given network.
|
static ConnectivityStateManager |
getInstance()
This function calls overloaded getInstance to retrieve the instance of
ConnectivityStateManager with a null listener. |
static ConnectivityStateManager |
getInstance(ConnectivityStateManager.ConnectivityStateChangeListener listener)
This overloaded function fetches instance of this class with assigned listener param.
|
java.lang.Exception |
getRecentException()
A function to get last exception occurred while
connectInternal(Network)
or disconnect(Network). |
static ConnectivityStateManager.State |
getState(Network network)
This method fetches
State of Network param sent. |
void |
networkDataCallback(Network network)
A function that needs to be implemented by subscriber to listen to
updates of network.
|
void |
nodeConnectionStatusCallback(Network network,
long nodeId,
NodeType nodeType,
boolean isOnline)
A function that needs to be implemented by the subscriber to listen updates
regarding node connection status.
|
void |
restoreToCachedState()
This function is responsible to restore the connection with the cached networks
by reconnecting if needed.
|
void |
restoreToCachedState(ConnectivityStateManager.CacheState cacheState)
This function is responsible to restore the connection with the cached networks
by reconnecting if needed.
|
void |
setConnectingTimeout(long connectingDelay)
A setter to overwrite the
connectingDelay. |
void |
setLocal2Timeout(long localDelay2)
A setter to overwrite the delay set for
InternalState#LOCAL_2. |
void |
setLocal3Timeout(long localDelay3)
A setter to overwrite the delay set for
InternalState#LOCAL_3. |
void |
setLocalTimeout(long localDelay)
A setter to overwrite the delay set for
InternalState#LOCAL_1. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitadvertiseResourceCallback, commandStatusCallback, contentInfoCallback, deviceInfoCallback, deviceManagementStatusCallback, errorCallback, infoRequestCallback, infoRequestStatusCallback, infoResponseCallback, infoResponseStatusCallback, leaveNetworkStatusCallback, messageCallback, networkListCallback, networkManagementCommandCallback, networkMetadataCallback, receiveDataCallback, resourceAttributeCallback, resourceCallback, resourceCapabilityCallback, resourceExcludedCallback, resourceIncludedCallback, ruleDeletedCallback, ruleInfoCallback, sceneDeletedCallback, sceneInfoCallback, tunnelStatusCallback, zoneDeletedCallback, zoneInfoCallbackpublic static ConnectivityStateManager getInstance()
ConnectivityStateManager with a null listener.getInstance(ConnectivityStateChangeListener)public static ConnectivityStateManager getInstance(ConnectivityStateManager.ConnectivityStateChangeListener listener)
listener - listens for network state change ConnectivityStateManager.ConnectivityStateChangeListenerpublic ConnectivityStateManager.CacheState cacheStates()
public void setConnectingTimeout(long connectingDelay)
connectingDelay.connectingDelay - timeout in millis.public void setLocalTimeout(long localDelay)
InternalState#LOCAL_1.localDelay - timeout in millis,public void setLocal2Timeout(long localDelay2)
InternalState#LOCAL_2.localDelay2 - timeout in millis,public void setLocal3Timeout(long localDelay3)
InternalState#LOCAL_3.localDelay3 - timeout in millis,public java.lang.Exception getRecentException()
connectInternal(Network)
or disconnect(Network).public void restoreToCachedState()
public void restoreToCachedState(ConnectivityStateManager.CacheState cacheState)
cacheState - used for caching networks in cacheStates()public static boolean disconnect(Network network)
network - Network from which needs to be disconnected.public static boolean connect(Network network)
network - Network to which user needs to be connected.public void connectStatusCallback(Network network)
CallbacksInterfaceNetwork.connectStatusCallback in interface CallbacksInterfaceconnectStatusCallback in interface DefaultCallbacksInterfacenetwork - Network whose connect status is updated.public void nodeConnectionStatusCallback(Network network, long nodeId, NodeType nodeType, boolean isOnline)
CallbacksInterfacenodeConnectionStatusCallback in interface CallbacksInterfacenodeConnectionStatusCallback in interface DefaultCallbacksInterfacenetwork - Network Whose node status is changed.nodeId - ID of the node.nodeType - Type of the node.isOnline - Flag representing if node is online.public void networkDataCallback(Network network)
CallbacksInterfacenetworkDataCallback in interface CallbacksInterfacenetworkDataCallback in interface DefaultCallbacksInterfacenetwork - Network whose data is updated.public static ConnectivityStateManager.State getState(Network network)
State of Network param sent.network - Network object in interest.ConnectivityStateManager.State enum.