-
Notifications
You must be signed in to change notification settings - Fork 0
Sensor specific applications
For the iSense platform we use Wiselib a library for applications to achieve connectivity and between gateway and Wireless devices. All gateway devices operate as intermediates and deliver to the back-end the sensor readings of the wireless devices.
A new Wiselib message is defined and used to report back the Sensor Readings. Each sensor type uses a different SensorID field in the message header, followed by the SensorValue that may be of a variable size.
Environmental Module (available here)
Initialization
em_ = new isense::EnvironmentModule(value);
if (em_ != NULL) {
em_->enable(true);
if (em_->light_sensor()->enable()) {
em_->light_sensor()->set_data_handler(this);
}
if (em_->temp_sensor()->enable()) {
em_->temp_sensor()->set_data_handler(this);
}
}
Get the temperature value and report back
int16 temp = em_->temp_sensor()->temperature();
collectorMsg_t mess;
mess.set_collector_type_id(collectorMsg_t::TEMPERATURE);
mess.set_temperature(&temp);
radio_->send(mygateway_, mess.buffer_size(), (uint8*) & mess);
Get the luminosity value and report back
uint32 lux = em_->light_sensor()->luminance();
collectorMsg_t mess;
mess.set_collector_type_id(collectorMsg_t::LIGHT);
mess.set_light(&lux);
radio_->send(mygateway_, mess.buffer_size(), (uint8*) & mess);
Pir Sensor Initialization
pir_ = new isense::PirSensor(value);
pir_->set_sensor_handler(this);
pir_->set_pir_sensor_int_interval(2000);
Pir Sensor Callback Function
virtual void handle_sensor() {
collectorMsg_t mess;
mess.set_collector_type_id(collectorMsg_t::PIR);
uint8_t pir = 1;
mess.set_pir_event(&pir);
}
A second applications responsible for detecting the connectivity between the iSense Sensors also operates simultaneously and reports in the same way network changes ( Bidirectional Link Up and Down ).
The TelosB application (see here) uses the iSense for TelosB Operating System.
All sensor information are available by the TelosbModule class available from the OS. To get the data we need to define a pointer to an instance of the class
TelosbModule * telos = new TelosbModule(os_);
and then we can use the available function like :
int16 temp = telos->temperature();
int8 humid = telos->humidity();
int16 light = telos->light();
int16 inflight = telos->infrared();