client will automatically be notified with a NOTIFY message whenever a desired
event has been detected (e.g. a temperature value passing a specified threshold).
Although providing an efficient way for handling event-based applications and
asynchronous communication in a WoT connected WSN, the solution offered by
TinyREST actually changes the standard HTTP API and implementation. For a WoT
solution that needs to be fully compliant to the REST principles, as is the goal of the
SmartSensor framework, this is not a suitable option.
Other options involve introducing a third party component to mediate HTTP
messages sent by applications to the gateway. An example of such a solution is
the Pubsubhubbub protocol. 4 This protocol enables the communication between
client and server using a Publish-Subscribe model by employing a component, called
Hub, that registers clients (Subscribers) interested in receiving events (about sensor
generated data), gets new data provided by the server (the gateway, acting as a
Publisher), and deliver data to the respective clients. The SmartSensor designers
consider that handling asynchronous communication in Web-enabled WSNs is still
an open issue that requires further investigations to be implemented in an efficient
and interoperable way.
A periodic data delivery model is implemented in SmartSensor by the submission
of a sensing task that describes the desired data type and the frequency of data
delivery (data sensing/sending rate). It requires that the user (or application) access
the SIM to check the latest data collected by the network. The SIM database is
periodically updated with the latest data sent by the sensors, with the frequency
previously configured in the nodes. To access the collected data, the user must access
the URI: GATEWAY/gateway/rest/getdata/data type.
Such request will return all sensor data of the required type that were collected and
stored in the SIM database until the moment of the request. If the user is accessing
SmartSensor via PEM, there is the option to automatically refresh the application,
which can be configured according to the required frequency, avoiding the need for
the user need to resubmit the request or manually update the HTML page where the
data is being displayed.
TheDriverClass. Another important class of the Communication component
is the Driver class , a super-class that represents the interaction with the sensors
from each specific WSN platform to be integrated in the SmartSensor infrastructure.
Drivers translate messages and commands to the specific language/protocols of the
WSN and vice-versa. This class is extended by subclasses for each sensor platform.
As we have already stated, SmartSensor currently provides drivers for the Arduino, 5
SUN SPOT 6 and TinyOS 7 sensor platforms.
The main operations provided by the Driver class , regardless of the sensor plat-
form used are described as follows. The advertiseService operation is responsible for
handling the advertisement messages (RequestAdvertiseMessage) sent by the gate-