-
Notifications
You must be signed in to change notification settings - Fork 5
Home
SensApp is a platform for sensor and sensor data handling developed by the SensApp partner SINTEF. It is an open-source, service based application for sensor registration, data collection, storage and visualization of sensor data.
SensApp provides four elementary services to support the definition of IoT applications. The registry stores information (e.g., description, creation date) about the sensors that are involved in the application. The database service implements a storage facility for sensor data, providing dedicated queries to expose the collected data to the data miner. The notification service is used by third party application to subscribe for notification when relevant data are pushed. Finally, the dispatcher received the data from the sensors, stores the data in the relevant database according to the information stored in the registry, and finally triggers the notification mechanisms with the newly arrived data.
The services are implemented as REST services exposed on top of the HTTP protocol which makes them easy to deploy on a cloud infrastructure. Sensor data are represented with the SenML standard, used as an intermediary representation of sensor data in the platform. SensApp also provides a web-based administration interface built on top of the offered REST interface. This interface supports the manipulation of sensors, and provides graphical widgets to visualize data collected in SensApp.
These are further described here:
- The Registry Service stores information of each sensor. This information contains an ID, a description and a schema for the data storage, for example the data type of the stored values. Additional information, like a location or an update frequency can be stored using user defined key-value pairs.
- The Database Service is used to store collected sensor data in a database, (currently MongoDB is being used). Queries to transfer stored data to the data miner are provided.
- The Notification Service can send notifications if new or relevant data is available. This can be used, for example, by third party visualization software to show updated graphs and statistics to the user.
- The Dispatcher Service receives data from the sensors and according to its registry entry, the data is stored in the database and a notification is triggered, if a related notification topic is registered.
Technically, the SensApp server is written in Scala and uses Spray . SensApp requires a servlet container (Jetty) and a NoSQL database (MongoDB ). By default, the SensApp server is deployed on one machine.
On one hand, the data exchanged between the various SensApp services themselves and between these services and the devices are represented in SenML standard using JSON syntax. The choice for this syntax has been made to minimise the amount (size in term of byte) of data to be exchanged between the services and the devices.
Sensor Markup Language (SenML) was designed by the IETF so that processors with very limited capabilities could easily encode a sensor measurement into the media type, while at the same time a server parsing the data could relatively efficiently collect a large number of sensor measurements.
In order to register a sensor, users need to send a HTTP POST request with a JSON body as follows:
{
"id": "Bike1/gps_alt", "descr": "GPS altitude of the bike",
"schema": { "backend": "raw", "template": "Numerical" }
}
Existing templates are:
- Numerical
- Boolean
- String
- Summed
In order to retrieve a sensor description, users need send to the server a HTTP GET request to an URL formatted as below:
- http://SERVER_URL/sensapp/registry/sensors/device_name
Accordingly, the result of the following request: http://SERVER_URL/sensapp/registry/sensors/Bike1/gps_alt is a JSON describing the Bike1/gps_alt sensor.
In order to add metadata to a registered sensor, users need to send a HTTP PUT request to an URL formatted as below:
- http://SERVER_URL/sensapp/registry/sensors/device_name
The body of this request should be formatted in JSON as follows:
{ "tags": { "owner": "X", "license": "LGPL" } }
In SensApp, a sensor is only for one type of data. If one wants to logically group several data types, then she has to create a composite sensor, which is a group of sensors. In order to do so, send a HTTP POST request to:
- http://SERVER_URL/sensapp/registry/composite/sensors
With a JSON body following this structure:
{
"id": "Bike1","descr": "A Bike",
"tags": { "owner": "X", "license": "LGPL" },
"sensors": [
"/registry/sensors/Bike1/gps_alt", "/registry/sensors/Bike1/gpsfix",
"/registry/sensors/Bike1/ground_speed"
]
}
In this JSON structure, the array called "sensors" contains the list of sensors that will form the composite.
In order to push measurements into SensApp, users need to send a HTTP PUT request to the following URL:
- http://SERVER_URL/sensapp/dispatch
Sample measurements are available at the following address:
One can push data into the composite sensor by using a HTTP PUT request to the following URL:
- http://SERVER_URL/sensapp/dispatch
With a JSON body structured as follows:
{
"bn": " Tmrt_site1", "bt": 1361521838,
"e": [
{"n":"/T", "u": "count", "v": 17.94},
{"n":"/cloudiness", "u": "count", "v": 2 },
{"n":"/Tmrt", "u": "count", "v": 8.0 }
]
}
- bn: composite name
- bt: basetime
- n: sensor name
- u: unit
- v: value
In order to retrieve a sensor data, users need send to the server a HTTP GET request to an URL formatted as below:
- http://SERVER_URL/sensapp/registry/sensors/device_name
Follow the “dataset” link to access to the resource that contains the data:
- http://SERVER_URL/sensapp/databases/raw/data/device_name
Limit the retrieved data to only the 10 last measures:
- http://SERVER_URL/sensapp/databases/raw/data/device_name?limit=10
Limit the retrieved data with a time slot:
- http://SERVER_URL/sensapp/databases/raw/data/device_name?from=XXX&to=XXX