| Constructor and Description |
|---|
CellHandler(Context nors)
Constructor, allocating all necessary resources for the handler
Here, arming the semaphore
Then, seeing if the GSM properties are supported (the sensors only work under GSM!)
Then, seeing if airplane mode is switched on (not sensors are discovered when in airplane mode)
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
Acquire(String sensor,
String query)
Method to acquire sensor data
|
void |
destroyHandler()
Method to release all handler resources
Here, we release all semaphores and remove the phone state listener
|
void |
Discover()
Method to discover sensor symbols supported by a handler
|
void |
History(String sensor)
Method to view historical chart of the given sensor symbol
|
void |
onCellLocationChanged(CellLocation location)
Called when the cell identifier or LAC changed - read the new value and release appropriate semaphore
|
void |
onDataConnectionStateChanged(int state)
Called when the data connection state has changed (e.g., being disconnected)
|
void |
onSignalStrengthsChanged(SignalStrength signalStrength)
Called when the signal strength has changed
|
String |
Share(String sensor)
Method to share the current value of the given sensor
|
public CellHandler(Context nors)
nors - Reference to the calling Contextpublic byte[] Acquire(String sensor, String query)
Acquire in interface Handlersensor - String of the sensor symbolquery - String of the query to be fulfilled - not used hereHandler.Acquire(java.lang.String, java.lang.String)public String Share(String sensor)
Handlerpublic void History(String sensor)
History in interface Handlersensor - String of the symbol for which the history is being requestedHandler.History(java.lang.String)public void Discover()
Handlerpublic void destroyHandler()
destroyHandler in interface HandlerHandler.destroyHandler()public void onDataConnectionStateChanged(int state)
state - new state that has been detectedPhoneStateListenerpublic void onSignalStrengthsChanged(SignalStrength signalStrength)
signalStrength - strength of the newly detected signal. First, we get the ASU by calling getGsmSignalStrength(), then we calculate the dBm through dBm = -113 + 2* ASUPhoneStateListenerpublic void onCellLocationChanged(CellLocation location)
location - Reference to the new CellLocation that has been detectedPhoneStateListener