ProximityService.cpp Example File
bpstoqml/src/ProximityService.cpp
#include "ProximityService.hpp"
namespace bb {
namespace cascades {
namespace bps {
ProximityService::ProximityService(QObject *parent)
: AbstractSensorService(SENSOR_TYPE_PROXIMITY, parent)
{
}
ProximityService::~ProximityService() {
}
void ProximityService::handleEvent(bps_event_t *event) {
uint16_t code = bps_event_get_code(event);
if (code == SENSOR_PROXIMITY_READING) {
float proximity = sensor_event_get_proximity(event);
unsigned long long timestamp = getTimestamp(event);
SensorAccuracy accuracy = getAccuracy(event);
Q_EMIT proximityData(proximity, timestamp, accuracy);
}
}
}
}
}