com.vodafone360.people.service.agent
Class NetworkAgentState

java.lang.Object
  extended by com.vodafone360.people.service.agent.NetworkAgentState

public class NetworkAgentState
extends java.lang.Object

Stores information about the current status of the NetworkAgent, i.e. whether we are connected to the Internet, whether the network is available, if Wifi is active, whether roaming or data roaming are enabled etc.


Field Summary
private  boolean[] changes
           
private  NetworkAgent.AgentState mAgentState
           
private  boolean mBackgroundDataAllowed
           
private  boolean mDataRoamingAllowed
           
private  NetworkAgent.AgentDisconnectReason mDisconnectReason
           
private  boolean mInternetConnected
           
private  boolean mIsInBackground
           
private  boolean mIsRoaming
           
private  boolean mNetworkWorking
           
private  boolean mWifiActive
           
 
Constructor Summary
NetworkAgentState()
           
 
Method Summary
 NetworkAgent.AgentState getAgentState()
          Get current NetworkAgent state.
 boolean[] getChanges()
          Get which values should be overridden on the Network Agent.
 NetworkAgent.AgentDisconnectReason getDisconnectReason()
          Return reason for NetworkAgent entering disconnected state.
 boolean isBackDataAllowed()
          Return if background data connections are allowed.
 boolean isInBackGround()
          Return whether application is in the background.
 boolean isInternetConnected()
          Return whether we are connected to the Internet.
 boolean isNetworkWorking()
          Return whether the network is currently available.
 boolean isRoaming()
          Return whether roaming is currently enabled.
 boolean isRoamingAllowed()
          Return data roaming state.
 boolean isWifiActive()
          Return whether Wifi is active.
 void setAgentState(NetworkAgent.AgentState mAgentState)
          Sets a new NetworkAgent state.
 void setBackgroundDataAllowed(boolean backgroundDataAllowed)
          Set if background data connections are allowed.
 void setChanges(boolean[] changes)
          Set which values should be overridden on the Network Agent.
 void setDisconnectReason(NetworkAgent.AgentDisconnectReason disconnectReason)
          Set reason for setting NetworkAgent to disconnected state.
 void setInBackGround(boolean isBackGround)
          Set application background state.
 void setInternetConnected(boolean internetConnected)
          Sets a new Internet connection state.
 void setNetworkWorking(boolean networkWorking)
          Set whether network is currently available.
 void setRoaming(boolean dataRoaming)
          Set roaming state.
 void setRoamingAllowed(boolean dataRoamingAllowed)
          Set whether roaming is allowed.
 void setWifiActive(boolean wifiActive)
          Set Wifi active state.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mAgentState

private NetworkAgent.AgentState mAgentState

mDisconnectReason

private NetworkAgent.AgentDisconnectReason mDisconnectReason

mInternetConnected

private boolean mInternetConnected

mIsRoaming

private boolean mIsRoaming

mDataRoamingAllowed

private boolean mDataRoamingAllowed

mIsInBackground

private boolean mIsInBackground

mBackgroundDataAllowed

private boolean mBackgroundDataAllowed

mWifiActive

private boolean mWifiActive

mNetworkWorking

private boolean mNetworkWorking

changes

private boolean[] changes
Constructor Detail

NetworkAgentState

public NetworkAgentState()
Method Detail

getAgentState

public NetworkAgent.AgentState getAgentState()
Get current NetworkAgent state.

Returns:
current NetworkAgent state {connected | disconnected | unknown}

setAgentState

public void setAgentState(NetworkAgent.AgentState mAgentState)
Sets a new NetworkAgent state.

Parameters:
mAgentState - current NetworkAgent state {connected | disconnected | unknown}

isInternetConnected

public boolean isInternetConnected()
Return whether we are connected to the Internet.

Returns:
TRUE if we are connected to Internet.

setInternetConnected

public void setInternetConnected(boolean internetConnected)
Sets a new Internet connection state.

Parameters:
internetConnected - TRUE if connected to Internet, FALSE otherwise.

isRoaming

public boolean isRoaming()
Return whether roaming is currently enabled.

Returns:
TrUE if roaming is enabled, FALSE otherwise.

setRoaming

public void setRoaming(boolean dataRoaming)
Set roaming state.

Parameters:
dataRoaming - TRUE if enabled, FALSE otherwise.

isRoamingAllowed

public boolean isRoamingAllowed()
Return data roaming state.

Returns:
TRUE if data roaming enabled.

setRoamingAllowed

public void setRoamingAllowed(boolean dataRoamingAllowed)
Set whether roaming is allowed.

Parameters:
dataRoamingAllowed - TRUE if roaming allowed.

isInBackGround

public boolean isInBackGround()
Return whether application is in the background.

Returns:
TRUE if application is in the background.

setInBackGround

public void setInBackGround(boolean isBackGround)
Set application background state.

Parameters:
isBackGround - TRUE if application is in the background.

isWifiActive

public boolean isWifiActive()
Return whether Wifi is active.

Returns:
TRUE if Wifi is active, FALSE otherwise.

setWifiActive

public void setWifiActive(boolean wifiActive)
Set Wifi active state.

Parameters:
wifiActive - TRUE if Wifi is active.

isNetworkWorking

public boolean isNetworkWorking()
Return whether the network is currently available.

Returns:
TRUE if network is available.

setNetworkWorking

public void setNetworkWorking(boolean networkWorking)
Set whether network is currently available.

Parameters:
networkWorking - TRUE if network is available, FALSE otherwise.

getDisconnectReason

public NetworkAgent.AgentDisconnectReason getDisconnectReason()
Return reason for NetworkAgent entering disconnected state.

Returns:
AgentDisconnectReason object, i.e. reason for disconnection.

setDisconnectReason

public void setDisconnectReason(NetworkAgent.AgentDisconnectReason disconnectReason)
Set reason for setting NetworkAgent to disconnected state.

Parameters:
disconnectReason - NetworkAgent disconnect reason.

setBackgroundDataAllowed

public void setBackgroundDataAllowed(boolean backgroundDataAllowed)
Set if background data connections are allowed.

Parameters:
backgroundDataAllowed - TRUE if background data connections are permitted, FALSE otherwise.

isBackDataAllowed

public boolean isBackDataAllowed()
Return if background data connections are allowed.

Returns:
TRUE if background data connections are permitted, FALSE otherwise.

getChanges

public boolean[] getChanges()
Get which values should be overridden on the Network Agent.

Returns:
Array of StatesOfService values.

setChanges

public void setChanges(boolean[] changes)
Set which values should be overridden on the Network Agent.

Parameters:
changes - Array of StatesOfService values.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


JavaDoc