| Constructor and Description |
|---|
GPSHandler(Context activity)
Constructor, allocating all necessary resources for the handler
Here, it's reading the persistent preferences
Then, we retrieve the adaptive GPS records
Then, we are trying to obtain a reference to the
LocationManager - this will fail if there is no GPS on the device
Finally, it's arming the semaphore |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
Acquire(String sensor,
String query)
Method to acquire sensor data
Here, we instruct the UI handler to reset the AGPS data as well as register the GPS receiver, if not done before
if adaptive GPS is selected by the user, we also start the thread for the GPS suppression
|
void |
destroyHandler()
Method to release all handler resources
Here, we unregister the location receiver and release all handler semaphores as well as interrupt the adaptive GPS thread
|
void |
Discover()
Method to discover the sensor symbols support by this handler
As the result of the discovery, appropriate
Sensor entries will be added to the SensorRepository, if the GPS has been successfully enabled |
void |
History(String sensor)
Method to view historical chart of the given sensor symbol - supporting timeline as well as map view here
|
void |
run()
This thread keeps on listening to WiFis and switches off the GPS readings if known WiFis are found
If requires the recording of WI sensor to be enabled
|
String |
Share(String sensor)
Method to share the last value of the given sensor
|
public GPSHandler(Context activity)
LocationManager - this will fail if there is no GPS on the device
Finally, it's arming the semaphoreactivity - 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)
Share in interface Handlersensor - String of the sensor symbol to be sharedHandler.Share(java.lang.String)public 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()
Sensor entries will be added to the SensorRepository, if the GPS has been successfully enabledDiscover in interface HandlerHandler.Discover(),
Sensor,
SensorRepositorypublic void destroyHandler()
destroyHandler in interface HandlerHandler.destroyHandler()