| Constructor and Description |
|---|
WeatherHandler(Context airs)
Constructor, allocating all necessary resources for the handler
Here, it's arming the semaphore and retrieving the reference to the XMLParser as well as a reference to the
LocationManager |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
Acquire(String sensor,
String query)
Method to acquire sensor data
Here, we start the thread for retrieving the weather and switch on the GPS, if not done before
|
void |
destroyHandler()
Method to release all handler resources
Here, we unregister the location receiver, shut down the retrieval thread, unregister the connectivity receiver and release all semaphores
|
void |
Discover()
Method to discover the sensor symbols support by this handler, if the weather is supported
As the result of the discovery, appropriate
Sensor entries will be added to the SensorRepository |
void |
History(String sensor)
Method to view historical chart of the given sensor symbol
|
void |
run()
run weather retrieval in separate thread
|
String |
Share(String sensor)
Method to share the last value of the given sensor
|
public WeatherHandler(Context airs)
LocationManagerairs - 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 SensorRepositoryDiscover in interface HandlerHandler.Discover(),
Sensor,
SensorRepositorypublic void run()
run in interface RunnableRunnable.run()public void destroyHandler()
destroyHandler in interface HandlerHandler.destroyHandler()