LightService.cpp Example File
bpstoqml/src/LightService.cpp
#include "LightService.hpp"
namespace bb {
namespace cascades {
namespace bps {
LightService::LightService(QObject *parent)
: AbstractSensorService(SENSOR_TYPE_LIGHT, parent)
{
}
LightService::~LightService() {
}
void LightService::handleEvent(bps_event_t *event) {
uint16_t code = bps_event_get_code(event);
if (code == SENSOR_LIGHT_READING) {
float illuminance = sensor_event_get_illuminance(event);
unsigned long long timestamp = getTimestamp(event);
SensorAccuracy accuracy = getAccuracy(event);
Q_EMIT illuminanceData(illuminance, timestamp, accuracy);
}
}
}
}
}