Sensor and Actuator Adapter
A smart product needs sensors in order to get information about its environment. This information is then used for local context processing within the smart product. However, a smart product also has a natural purpose, e.g., a coffee maker provides coffee. In order to realize this purpose, physical products must contain actuators, for example a coffee maker has an actuator that switches the heater element on or off. To overcome the difficulties in connecting different actuator and sensor hardware to the smart product, the SmartProducts platform provides sensor and actuator adapters. These adapters are used to connect any product specific hardware and/or software to the SmartProducts platform, e.g., by creating a driver for a novel type of sensor, connecting it to the ContextManager.
Developer: Mika
License
Download
Source code can be downloaded from SVN server. Description on the next paragrapth applies to revision 826.
How to get started
A few examples of how to use the code are available within the source code. By running TestMain.java file of the sensoradapter in Eclipse environment, the user can see how an instance of SensorAdapterImplementation is created. Its method test shows how to create (fake) moisture, temperature, and acceleration sensors and how to configure them to give different measurement data. Sensors can give just a one single measurement value, or they can be configured to keep measuring and sending the data constantly at given intervals. These data streams can be configured to keep sending one constant value, or the values can continuously variate between given limits. These exaples can be used as a base when the developer is starting to write new code for a new real sensor which will give real measurement results.
Examples:
addSensor(amountOfSensors++, "temperatureTest", "tempTestSensor", channelName, pub);
creates a new sensor and gives it id number amountOfSensors, name temperatureTest and type tempTestSensor. The new sensor will use MundoCore channel channelName and send its measurement results via publisher pub.
sensorName.measureOneTime();
asks the sensor sensorName to make one measurement.
startSensorDataStream(3, 750);
asks the sensor with id 3 to start sending measurements with 750ms intervals.
sensorName.startSensorDataStreamRamp(300, 70.0, 85.0, 2.0);
asks sensor sensorName to send new measurement data with 300ms intervals, the data values will change between 70.0 and 85.0 with a step of 2.0.
API Documentation
API documentation is not yet available.
Additional Material