diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/sensors/blackberry/bbtemperaturesensor.cpp | 27 | ||||
-rw-r--r-- | src/plugins/sensors/blackberry/bbtemperaturesensor.h | 17 | ||||
-rw-r--r-- | src/plugins/sensors/blackberry/main.cpp | 2 |
3 files changed, 6 insertions, 40 deletions
diff --git a/src/plugins/sensors/blackberry/bbtemperaturesensor.cpp b/src/plugins/sensors/blackberry/bbtemperaturesensor.cpp index f3ec634..b38fba4 100644 --- a/src/plugins/sensors/blackberry/bbtemperaturesensor.cpp +++ b/src/plugins/sensors/blackberry/bbtemperaturesensor.cpp @@ -40,31 +40,8 @@ ****************************************************************************/ #include "bbtemperaturesensor.h" -class BbTemperatureReadingPrivate -{ -public: - BbTemperatureReadingPrivate() - : temperature(0) - { - } - - qreal temperature; -}; - -IMPLEMENT_READING(BbTemperatureReading) - -qreal BbTemperatureReading::temperature() const -{ - return d->temperature; -} - -void BbTemperatureReading::setTemperature(qreal temperature) -{ - d->temperature = temperature; -} - BbTemperatureSensor::BbTemperatureSensor(QSensor *sensor) - : BbSensorBackend<BbTemperatureReading>(devicePath(), SENSOR_TYPE_TEMPERATURE, sensor) + : BbSensorBackend<QAmbientTemperatureReading>(devicePath(), SENSOR_TYPE_TEMPERATURE, sensor) { setDescription(QLatin1String("Temperature in degrees Celsius")); } @@ -74,7 +51,7 @@ QString BbTemperatureSensor::devicePath() return QLatin1String("/dev/sensor/temp"); } -bool BbTemperatureSensor::updateReadingFromEvent(const sensor_event_t &event, BbTemperatureReading *reading) +bool BbTemperatureSensor::updateReadingFromEvent(const sensor_event_t &event, QAmbientTemperatureReading *reading) { // TODO: I was unable to test this since the device I was testing this with did not have // a temperature sensor. Verify that this works and check that the units are correct. diff --git a/src/plugins/sensors/blackberry/bbtemperaturesensor.h b/src/plugins/sensors/blackberry/bbtemperaturesensor.h index 1b9ea1b..a24c67e 100644 --- a/src/plugins/sensors/blackberry/bbtemperaturesensor.h +++ b/src/plugins/sensors/blackberry/bbtemperaturesensor.h @@ -42,20 +42,9 @@ #define BBTEMPERATURESENSOR_H #include "bbsensorbackend.h" +#include <qambienttemperaturesensor.h> -class BbTemperatureReadingPrivate; - -class BbTemperatureReading : public QSensorReading -{ - Q_OBJECT - Q_PROPERTY(qreal temperature READ temperature) - DECLARE_READING(BbTemperatureReading) -public: - qreal temperature() const; - void setTemperature(qreal temperature); -}; - -class BbTemperatureSensor : public BbSensorBackend<BbTemperatureReading> +class BbTemperatureSensor : public BbSensorBackend<QAmbientTemperatureReading> { Q_OBJECT @@ -65,7 +54,7 @@ public: static QString devicePath(); protected: - bool updateReadingFromEvent(const sensor_event_t &event, BbTemperatureReading *reading); + bool updateReadingFromEvent(const sensor_event_t &event, QAmbientTemperatureReading *reading); }; #endif diff --git a/src/plugins/sensors/blackberry/main.cpp b/src/plugins/sensors/blackberry/main.cpp index ce7aa23..9d8e87f 100644 --- a/src/plugins/sensors/blackberry/main.cpp +++ b/src/plugins/sensors/blackberry/main.cpp @@ -114,7 +114,7 @@ public: if (sensorSupported(BbRotationSensor::devicePath())) QSensorManager::registerBackend(QRotationSensor::type, bbRotationSensorId, this); if (sensorSupported(BbTemperatureSensor::devicePath())) - QSensorManager::registerBackend("BbTemperatureSensor", bbTemperatureSensorId, this); + QSensorManager::registerBackend(QAmbientTemperatureSensor::type, bbTemperatureSensorId, this); } QSensorBackend *createBackend(QSensor *sensor) Q_DECL_OVERRIDE |