org.gvsig.mobile.sensor.lib.api
This component has to provide an API to the library consumer for upload sensor data. This API includes a *Locator* that is the entry point to the library that is used to get the *Manager* instance, following the project structure defined in gvSIG 2.0. In this case we have the *SensorLocator*, that can be used to register or get the instance of the *SensorManager* that is used by the library consumer to manage the library.
The *SensorManager* offers to the library consumer the possibility to retrieve all the sensor data providers that has been previously registered using the SPI interface. It offers the functionality to retrieve the list of servers that can be used for a concrete provider. And it also can be used to create an instance of a service that can be used to upload sensor data that is called *SensorDataUploadService*.
This service needs a sensor data provider, a server URL and a time period. When this service starts, it sends a *RegisterSensor* request to the server using a template (optional, because it could be previously registered) and if the reply is ok it gets the measurements for the provider and creates a *InsertObservation* request using this measurement and the template. This last request is send every time that the time period finish.
Next sequence diagram shows how the system works:
.. image:: images/SequenceDiagram.png
:align: center
In order to manage the different templates defined for the SOS operations configured for every sensor defined in every server. This task it’s resolved building new XML files to relate the different wildcards with their values and the container SOS server. Then the gvSIG Mobile SOS-T plug-in can get persist the sensors configured values.
Next XML is an approximation to these files. This is just an example to understand the object model. The final XML could be different and it could be created using the standard gvSIG persistence.
.. code-block:: xml
RegisterSensorGPSGenericTemplate.xml
InsertObservationGPSGenericTemplate.xml
RegisterSernsorGPSForServer1Template.xml
InsertObservationGPSForServer1Template.xml
RegisterSernsorTemperatureForServer1Template.xml
InsertObservationTemperatureForServer1Template.xml
RegisterSernsorGPSForServer2Template.xml
InsertObservationGPSForServer2Template.xml