summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/plugins.pro3
-rw-r--r--src/plugins/sensors/eandroid/eandroid.pro30
-rw-r--r--src/plugins/sensors/eandroid/eandroidaccelerometer.cpp38
-rw-r--r--src/plugins/sensors/eandroid/eandroidaccelerometer.h38
-rw-r--r--src/plugins/sensors/eandroid/eandroidambientlightsensor.cpp47
-rw-r--r--src/plugins/sensors/eandroid/eandroidambientlightsensor.h38
-rw-r--r--src/plugins/sensors/eandroid/eandroidbasesensor.cpp59
-rw-r--r--src/plugins/sensors/eandroid/eandroidbasesensor.h40
-rw-r--r--src/plugins/sensors/eandroid/eandroidgyroscope.cpp40
-rw-r--r--src/plugins/sensors/eandroid/eandroidgyroscope.h38
-rw-r--r--src/plugins/sensors/eandroid/eandroidlight.cpp36
-rw-r--r--src/plugins/sensors/eandroid/eandroidlight.h38
-rw-r--r--src/plugins/sensors/eandroid/eandroidmagnetometer.cpp57
-rw-r--r--src/plugins/sensors/eandroid/eandroidmagnetometer.h38
-rw-r--r--src/plugins/sensors/eandroid/eandroidrotationsensor.cpp42
-rw-r--r--src/plugins/sensors/eandroid/eandroidrotationsensor.h38
-rw-r--r--src/plugins/sensors/eandroid/eandroidsensordevice.cpp212
-rw-r--r--src/plugins/sensors/eandroid/eandroidsensordevice.h99
-rw-r--r--src/plugins/sensors/eandroid/main.cpp142
-rw-r--r--src/plugins/sensors/eandroid/plugin.json1
-rw-r--r--src/plugins/sensors/sensors.pro3
21 files changed, 0 insertions, 1077 deletions
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
deleted file mode 100644
index cb74ee6..0000000
--- a/src/plugins/plugins.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS += sensors
-
diff --git a/src/plugins/sensors/eandroid/eandroid.pro b/src/plugins/sensors/eandroid/eandroid.pro
deleted file mode 100644
index 3b15f74..0000000
--- a/src/plugins/sensors/eandroid/eandroid.pro
+++ /dev/null
@@ -1,30 +0,0 @@
-TARGET = qtsensors_eandroid
-QT = core sensors
-
-PLUGIN_TYPE = sensors
-load(qt_plugin)
-
-LIBS += -lhardware
-
-HEADERS += \
- eandroidambientlightsensor.h \
- eandroidsensordevice.h \
- eandroidbasesensor.h \
- eandroidaccelerometer.h \
- eandroidlight.h \
- eandroidgyroscope.h \
- eandroidmagnetometer.h \
- eandroidrotationsensor.h
-
-SOURCES += \
- main.cpp \
- eandroidambientlightsensor.cpp \
- eandroidsensordevice.cpp \
- eandroidbasesensor.cpp \
- eandroidaccelerometer.cpp \
- eandroidlight.cpp \
- eandroidgyroscope.cpp \
- eandroidmagnetometer.cpp \
- eandroidrotationsensor.cpp
-
-OTHER_FILES = plugin.json
diff --git a/src/plugins/sensors/eandroid/eandroidaccelerometer.cpp b/src/plugins/sensors/eandroid/eandroidaccelerometer.cpp
deleted file mode 100644
index 0d4fa62..0000000
--- a/src/plugins/sensors/eandroid/eandroidaccelerometer.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use the contact form at
-** http://www.qt.io
-**
-** This file is part of Qt Enterprise Embedded.
-**
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** the contact form at http://www.qt.io
-**
-****************************************************************************/
-#include <eandroidaccelerometer.h>
-
-EAndroidAccelerometer::EAndroidAccelerometer(int type, QSensor *sensor)
- : EAndroidBaseSensor(type, sensor)
-{
- setReading<QAccelerometerReading>(&m_reading);
-}
-
-EAndroidAccelerometer::~EAndroidAccelerometer()
-{
-}
-
-void EAndroidAccelerometer::processEvent(sensors_event_t &event)
-{
- m_reading.setTimestamp(event.timestamp / 1000);
- m_reading.setX(event.data[0]);
- m_reading.setY(event.data[1]);
- m_reading.setZ(event.data[2]);
- newReadingAvailable();
-}
diff --git a/src/plugins/sensors/eandroid/eandroidaccelerometer.h b/src/plugins/sensors/eandroid/eandroidaccelerometer.h
deleted file mode 100644
index 0062c2c..0000000
--- a/src/plugins/sensors/eandroid/eandroidaccelerometer.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use the contact form at
-** http://www.qt.io
-**
-** This file is part of Qt Enterprise Embedded.
-**
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** the contact form at http://www.qt.io
-**
-****************************************************************************/
-#ifndef EANDROIDACCELEROMETER_H
-#define EANDROIDACCELEROMETER_H
-
-#include <eandroidbasesensor.h>
-
-#include <QtSensors/QAccelerometerReading>
-
-class EAndroidAccelerometer : public EAndroidBaseSensor
-{
- Q_OBJECT
-public:
- EAndroidAccelerometer(int type, QSensor *sensor);
- ~EAndroidAccelerometer();
- void processEvent(sensors_event_t &event);
-
-private:
- QAccelerometerReading m_reading;
-};
-
-#endif // EANDROIDACCELEROMETER_H
diff --git a/src/plugins/sensors/eandroid/eandroidambientlightsensor.cpp b/src/plugins/sensors/eandroid/eandroidambientlightsensor.cpp
deleted file mode 100644
index 10e4bc3..0000000
--- a/src/plugins/sensors/eandroid/eandroidambientlightsensor.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use the contact form at
-** http://www.qt.io
-**
-** This file is part of Qt Enterprise Embedded.
-**
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** the contact form at http://www.qt.io
-**
-****************************************************************************/
-#include "eandroidambientlightsensor.h"
-
-EAndroidAmbientLightSensor::EAndroidAmbientLightSensor(int type, QSensor *sensor)
- : EAndroidBaseSensor(type, sensor)
-{
- setReading<QAmbientLightReading>(&m_reading);
-}
-
-EAndroidAmbientLightSensor::~EAndroidAmbientLightSensor()
-{
-}
-
-void EAndroidAmbientLightSensor::processEvent(sensors_event_t &event)
-{
- const int lightLevelLux = event.light;
-
- if (lightLevelLux < 10)
- m_reading.setLightLevel(QAmbientLightReading::Dark);
- else if (lightLevelLux < 80)
- m_reading.setLightLevel(QAmbientLightReading::Twilight);
- else if (lightLevelLux < 400)
- m_reading.setLightLevel(QAmbientLightReading::Light);
- else if (lightLevelLux < 2500)
- m_reading.setLightLevel(QAmbientLightReading::Bright);
- else
- m_reading.setLightLevel(QAmbientLightReading::Sunny);
-
- newReadingAvailable();
-}
diff --git a/src/plugins/sensors/eandroid/eandroidambientlightsensor.h b/src/plugins/sensors/eandroid/eandroidambientlightsensor.h
deleted file mode 100644
index dba24ea..0000000
--- a/src/plugins/sensors/eandroid/eandroidambientlightsensor.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use the contact form at
-** http://www.qt.io
-**
-** This file is part of Qt Enterprise Embedded.
-**
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** the contact form at http://www.qt.io
-**
-****************************************************************************/
-#ifndef EANDROIDAMBIENTLIGHTSENSOR_H
-#define EANDROIDAMBIENTLIGHTSENSOR_H
-
-#include <eandroidbasesensor.h>
-
-#include <QtSensors/QAmbientLightReading>
-
-class EAndroidAmbientLightSensor : public EAndroidBaseSensor
-{
- Q_OBJECT
-public:
- EAndroidAmbientLightSensor(int type, QSensor *sensor);
- ~EAndroidAmbientLightSensor();
- void processEvent(sensors_event_t &event);
-
-private:
- QAmbientLightReading m_reading;
-};
-
-#endif // EANDROIDAMBIENTLIGHTSENSOR_H
diff --git a/src/plugins/sensors/eandroid/eandroidbasesensor.cpp b/src/plugins/sensors/eandroid/eandroidbasesensor.cpp
deleted file mode 100644
index 49ec5e4..0000000
--- a/src/plugins/sensors/eandroid/eandroidbasesensor.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use the contact form at
-** http://www.qt.io
-**
-** This file is part of Qt Enterprise Embedded.
-**
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** the contact form at http://www.qt.io
-**
-****************************************************************************/
-#include <eandroidbasesensor.h>
-#include <eandroidsensordevice.h>
-
-EAndroidBaseSensor::EAndroidBaseSensor(int sensorType, QSensor *sensor)
- : QSensorBackend(sensor)
-{
- m_type = sensorType;
- m_isStarted = false;
- EAndroidSensorDevice *device = EAndroidSensorDevice::instance();
- setDescription(device->description(sensorType));
-#if 0 // #### TODO - QTBUG-33293
- qint32 maxRate = device->maxDataRate(sensorType); // convert to Hz
- addDataRate(1, 70);
- addOutputRange(1,55,6);
-#endif
-}
-
-EAndroidBaseSensor::~EAndroidBaseSensor()
-{
- if (m_isStarted)
- stop();
-}
-
-void EAndroidBaseSensor::start()
-{
- EAndroidSensorDevice::instance()->registerListener(m_type, this, sensor()->dataRate());
- m_isStarted = true;
-}
-
-void EAndroidBaseSensor::stop()
-{
- if (m_isStarted) {
- m_isStarted = false;
- EAndroidSensorDevice::instance()->unregisterListener(m_type, this);
- }
-}
-
-void EAndroidBaseSensor::processEvent(sensors_event_t &event)
-{
- Q_UNUSED(event)
-}
diff --git a/src/plugins/sensors/eandroid/eandroidbasesensor.h b/src/plugins/sensors/eandroid/eandroidbasesensor.h
deleted file mode 100644
index 16afebf..0000000
--- a/src/plugins/sensors/eandroid/eandroidbasesensor.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use the contact form at
-** http://www.qt.io
-**
-** This file is part of Qt Enterprise Embedded.
-**
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** the contact form at http://www.qt.io
-**
-****************************************************************************/
-#ifndef EANDROIDBASESENSOR_H
-#define EANDROIDBASESENSOR_H
-
-#include <qsensorbackend.h>
-#include <hardware/sensors.h>
-
-class EAndroidBaseSensor : public QSensorBackend
-{
- Q_OBJECT
-public:
- EAndroidBaseSensor(int sensorType, QSensor *sensor);
- virtual ~EAndroidBaseSensor();
- virtual void start();
- virtual void stop();
- virtual void processEvent(sensors_event_t &event);
-
-private:
- int m_type;
- bool m_isStarted;
-};
-
-#endif // EANDROIDBASESENSOR_H
diff --git a/src/plugins/sensors/eandroid/eandroidgyroscope.cpp b/src/plugins/sensors/eandroid/eandroidgyroscope.cpp
deleted file mode 100644
index 783933f..0000000
--- a/src/plugins/sensors/eandroid/eandroidgyroscope.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use the contact form at
-** http://www.qt.io
-**
-** This file is part of Qt Enterprise Embedded.
-**
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** the contact form at http://www.qt.io
-**
-****************************************************************************/
-#include "eandroidgyroscope.h"
-#include <math.h>
-
-EAndroidGyroscope::EAndroidGyroscope(int type, QSensor *sensor)
- : EAndroidBaseSensor(type, sensor)
-{
- setReading<QGyroscopeReading>(&m_reading);
-}
-
-EAndroidGyroscope::~EAndroidGyroscope()
-{
-}
-
-void EAndroidGyroscope::processEvent(sensors_event_t &event)
-{
- m_reading.setTimestamp(event.timestamp / 1000);
- m_reading.setX(event.gyro.x *180/M_PI);
- m_reading.setY(event.gyro.y *180/M_PI);
- m_reading.setZ(event.gyro.z *180/M_PI);
- newReadingAvailable();
-}
-
diff --git a/src/plugins/sensors/eandroid/eandroidgyroscope.h b/src/plugins/sensors/eandroid/eandroidgyroscope.h
deleted file mode 100644
index 96a8005..0000000
--- a/src/plugins/sensors/eandroid/eandroidgyroscope.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use the contact form at
-** http://www.qt.io
-**
-** This file is part of Qt Enterprise Embedded.
-**
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** the contact form at http://www.qt.io
-**
-****************************************************************************/
-#ifndef EANDROIDGYROSCOPE_H
-#define EANDROIDGYROSCOPE_H
-
-#include <eandroidbasesensor.h>
-
-#include <QtSensors/QGyroscopeReading>
-
-class EAndroidGyroscope : public EAndroidBaseSensor
-{
- Q_OBJECT
-public:
- EAndroidGyroscope(int type, QSensor *sensor);
- ~EAndroidGyroscope();
- void processEvent(sensors_event_t &event);
-
-private:
- QGyroscopeReading m_reading;
-};
-
-#endif // EANDROIDGYROSCOPE_H
diff --git a/src/plugins/sensors/eandroid/eandroidlight.cpp b/src/plugins/sensors/eandroid/eandroidlight.cpp
deleted file mode 100644
index a7e9243..0000000
--- a/src/plugins/sensors/eandroid/eandroidlight.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use the contact form at
-** http://www.qt.io
-**
-** This file is part of Qt Enterprise Embedded.
-**
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** the contact form at http://www.qt.io
-**
-****************************************************************************/
-#include <eandroidlight.h>
-
-EAndroidLight::EAndroidLight(int type, QSensor *sensor)
- : EAndroidBaseSensor(type, sensor)
-{
- setReading<QLightReading>(&m_reading);
-}
-
-EAndroidLight::~EAndroidLight()
-{
-}
-
-void EAndroidLight::processEvent(sensors_event_t &event)
-{
- m_reading.setTimestamp(event.timestamp / 1000);
- m_reading.setLux(event.light);
- newReadingAvailable();
-}
diff --git a/src/plugins/sensors/eandroid/eandroidlight.h b/src/plugins/sensors/eandroid/eandroidlight.h
deleted file mode 100644
index 75ce1ac..0000000
--- a/src/plugins/sensors/eandroid/eandroidlight.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use the contact form at
-** http://www.qt.io
-**
-** This file is part of Qt Enterprise Embedded.
-**
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** the contact form at http://www.qt.io
-**
-****************************************************************************/
-#ifndef EANDROIDLIGHT_H
-#define EANDROIDLIGHT_H
-
-#include <eandroidbasesensor.h>
-
-#include <QtSensors/QLightReading>
-
-class EAndroidLight : public EAndroidBaseSensor
-{
- Q_OBJECT
-public:
- EAndroidLight(int type, QSensor *sensor);
- ~EAndroidLight();
- void processEvent(sensors_event_t &ev);
-
-private:
- QLightReading m_reading;
-};
-
-#endif // EANDROIDLIGHT_H
diff --git a/src/plugins/sensors/eandroid/eandroidmagnetometer.cpp b/src/plugins/sensors/eandroid/eandroidmagnetometer.cpp
deleted file mode 100644
index 73597b2..0000000
--- a/src/plugins/sensors/eandroid/eandroidmagnetometer.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use the contact form at
-** http://www.qt.io
-**
-** This file is part of Qt Enterprise Embedded.
-**
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** the contact form at http://www.qt.io
-**
-****************************************************************************/
-#include "eandroidmagnetometer.h"
-
-EAndroidMagnetometer::EAndroidMagnetometer(int type, QSensor *sensor)
- : EAndroidBaseSensor(type, sensor)
-{
- setReading<QMagnetometerReading>(&m_reading);
-}
-
-EAndroidMagnetometer::~EAndroidMagnetometer()
-{
-}
-
-void EAndroidMagnetometer::processEvent(sensors_event_t &event)
-{
- m_reading.setTimestamp(event.timestamp / 1000);
- // convect micro-Tesla to tesla
- m_reading.setX(event.magnetic.x / 1e6);
- m_reading.setY(event.magnetic.y / 1e6);
- m_reading.setZ(event.magnetic.z / 1e6);
-
- switch (event.magnetic.status) {
- case SENSOR_STATUS_UNRELIABLE:
- m_reading.setCalibrationLevel(0.0);
- break;
- case SENSOR_STATUS_ACCURACY_LOW:
- m_reading.setCalibrationLevel(0.3);
- break;
- case SENSOR_STATUS_ACCURACY_MEDIUM:
- m_reading.setCalibrationLevel(0.6);
- break;
- case SENSOR_STATUS_ACCURACY_HIGH:
- m_reading.setCalibrationLevel(1.0);
- break;
- default:
- break;
- }
-
- newReadingAvailable();
-}
diff --git a/src/plugins/sensors/eandroid/eandroidmagnetometer.h b/src/plugins/sensors/eandroid/eandroidmagnetometer.h
deleted file mode 100644
index 92838b5..0000000
--- a/src/plugins/sensors/eandroid/eandroidmagnetometer.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use the contact form at
-** http://www.qt.io
-**
-** This file is part of Qt Enterprise Embedded.
-**
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** the contact form at http://www.qt.io
-**
-****************************************************************************/
-#ifndef EANDROIDMAGNETOMETER_H
-#define EANDROIDMAGNETOMETER_H
-
-#include <eandroidbasesensor.h>
-
-#include <QtSensors/QMagnetometerReading>
-
-class EAndroidMagnetometer : public EAndroidBaseSensor
-{
- Q_OBJECT
-public:
- EAndroidMagnetometer(int type, QSensor *sensor);
- ~EAndroidMagnetometer();
- void processEvent(sensors_event_t &event);
-
-private:
- QMagnetometerReading m_reading;
-};
-
-#endif // EANDROIDMAGNETOMETER_H
diff --git a/src/plugins/sensors/eandroid/eandroidrotationsensor.cpp b/src/plugins/sensors/eandroid/eandroidrotationsensor.cpp
deleted file mode 100644
index ee0ab7a..0000000
--- a/src/plugins/sensors/eandroid/eandroidrotationsensor.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use the contact form at
-** http://www.qt.io
-**
-** This file is part of Qt Enterprise Embedded.
-**
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** the contact form at http://www.qt.io
-**
-****************************************************************************/
-#include "eandroidrotationsensor.h"
-#include <math.h>
-
-EAndroidRotationSensor::EAndroidRotationSensor(int type, QSensor *sensor)
- : EAndroidBaseSensor(type, sensor)
-{
- setReading<QRotationReading>(&m_reading);
-}
-
-EAndroidRotationSensor::~EAndroidRotationSensor()
-{
-}
-
-void EAndroidRotationSensor::processEvent(sensors_event_t &event)
-{
- m_reading.setTimestamp(event.timestamp / 1000);
-
- float rz = -event.data[0] * 180 / M_PI;
- float rx = -event.data[1] * 180 / M_PI;
- float ry = event.data[2] * 180 / M_PI;
-
- m_reading.setFromEuler(rx, ry, rz);
- newReadingAvailable();
-}
diff --git a/src/plugins/sensors/eandroid/eandroidrotationsensor.h b/src/plugins/sensors/eandroid/eandroidrotationsensor.h
deleted file mode 100644
index 79ac239..0000000
--- a/src/plugins/sensors/eandroid/eandroidrotationsensor.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use the contact form at
-** http://www.qt.io
-**
-** This file is part of Qt Enterprise Embedded.
-**
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** the contact form at http://www.qt.io
-**
-****************************************************************************/
-#ifndef EANDROIDROTATIONSENSOR_H
-#define EANDROIDROTATIONSENSOR_H
-
-#include <eandroidbasesensor.h>
-
-#include <QtSensors/QRotationReading>
-
-class EAndroidRotationSensor : public EAndroidBaseSensor
-{
- Q_OBJECT
-public:
- EAndroidRotationSensor(int type, QSensor *sensor);
- ~EAndroidRotationSensor();
- void processEvent(sensors_event_t &event);
-
-private:
- QRotationReading m_reading;
-};
-
-#endif // EANDROIDROTATIONSENSOR_H
diff --git a/src/plugins/sensors/eandroid/eandroidsensordevice.cpp b/src/plugins/sensors/eandroid/eandroidsensordevice.cpp
deleted file mode 100644
index 9b9e03e..0000000
--- a/src/plugins/sensors/eandroid/eandroidsensordevice.cpp
+++ /dev/null
@@ -1,212 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use the contact form at
-** http://www.qt.io
-**
-** This file is part of Qt Enterprise Embedded.
-**
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** the contact form at http://www.qt.io
-**
-****************************************************************************/
-#include <eandroidsensordevice.h>
-
-EventReaderThread::EventReaderThread(EAndroidSensorDevice *device) :
- m_device(device)
-{
-}
-
-SensorEventArray* EventReaderThread::lock()
-{
- m_mutex.lock();
- return &m_events;
-}
-
-void EventReaderThread::run()
-{
- static const size_t numEvents = 16;
- sensors_event_t buffer[numEvents];
- int err = 0;
- int n;
- do {
- n = m_device->m_sensorDevice->poll(m_device->m_sensorDevice, buffer, numEvents);
- if (n < 0) {
- qWarning("poll() failed (%s)\n", strerror(-err));
- break;
- }
- m_mutex.lock();
- for (int i = 0 ; i < n ; i++) {
- sensors_event_t& event = buffer[i];
- if (event.version != sizeof(sensors_event_t)) {
- qWarning("incorrect event version (version=%d, expected=%d",
- event.version, sizeof(sensors_event_t));
- break;
- }
- m_events.append(event);
- }
- m_mutex.unlock();
- eventPending();
- } while (true);
-}
-
-EAndroidSensorDevice::EAndroidSensorDevice()
- : m_eventThread(0),
- m_sensorModule(0),
- m_sensorDevice(0),
- m_availableSensorsList(0),
- m_initSuccess(true)
-{
- m_initSuccess = initSensorDevice();
- if (m_initSuccess) {
- m_eventThread = new EventReaderThread(this);
- connect(m_eventThread, SIGNAL(eventPending()), this,
- SLOT(processSensorEvents()), Qt::QueuedConnection);
- } else {
- qWarning("Failed to initialize sensor module. Possibly a missing sensor driver?");
- }
-}
-
-EAndroidSensorDevice* EAndroidSensorDevice::m_instance = 0;
-EAndroidSensorDevice* EAndroidSensorDevice::instance()
-{
- if (!m_instance)
- m_instance = new EAndroidSensorDevice();
- return m_instance;
-}
-
-void EAndroidSensorDevice::registerListener(int type, EAndroidBaseSensor *sensor, int dataRateHz)
-{
- bool startReaderThread = m_listenersHash.isEmpty();
- bool enableSensor = m_listenersHash[type].isEmpty();
- m_listenersHash[type].push_back(sensor);
- if (startReaderThread)
- m_eventThread->start();
- if (enableSensor) {
- setActive(type, true);
- setDelay(type, dataRateHz);
- }
-}
-
-void EAndroidSensorDevice::unregisterListener(int type, EAndroidBaseSensor *sensor)
-{
- m_listenersHash[type].removeOne(sensor);
- bool disableSensor = m_listenersHash[type].isEmpty();
- if (disableSensor)
- m_listenersHash.remove(type);
- bool stopReaderThread = m_listenersHash.isEmpty();
- if (stopReaderThread)
- m_eventThread->quit();
- if (disableSensor)
- setActive(type, false);
-}
-
-int EAndroidSensorDevice::indexForType(int type) const
-{
- for (int i = 0; i < m_availableSensors; ++i)
- if (m_availableSensorsList[i].type == type)
- return i;
- qWarning() << "invalid sensor type: " << type;
- return -1;
-}
-
-void EAndroidSensorDevice::setActive(int type, bool enable)
-{
- for (int i = 0; i < m_availableSensors; i++) {
- if (m_availableSensorsList[i].type == type) {
- int err = m_sensorDevice->activate(m_sensorDevice,
- m_availableSensorsList[i].handle, enable);
- if (err != 0)
- qWarning("activate() for '%s'failed (%s)\n",
- m_availableSensorsList[i].name, strerror(-err));
- }
- }
-}
-
-void EAndroidSensorDevice::setDelay(int type, int dataRateHz) const
-{
- qint64 ns;
- // convert microseconds to nanoseconds
- qint32 maxRateNs = maxDataRate(type) * 1000;
- if (dataRateHz == 0) {
- // if dataRateHz is not set, then we use maxRateNs
- ns = maxRateNs;
- } else {
- // convert Hz to nanoseconds
- ns = 1000000000LL / dataRateHz;
- if (ns > maxRateNs)
- ns = maxRateNs;
- }
- int index = indexForType(type);
- if (index != -1)
- m_sensorDevice->setDelay(m_sensorDevice,
- m_availableSensorsList[index].handle, ns);
-
-}
-
-qint32 EAndroidSensorDevice::maxDataRate(int type) const
-{
- // minDelay - minimum delay allowed between events in microseconds
- int index = indexForType(type);
- if (index != -1)
- return m_availableSensorsList[index].minDelay;
- return 0;
-}
-
-QString EAndroidSensorDevice::description(int type) const
-{
- int index = indexForType(type);
- if (index != -1) {
- QString desc;
- desc.append(m_availableSensorsList[index].name);
- desc.append(QString(" (Vendor:%1) ").arg(m_availableSensorsList[index].vendor));
- return desc;
- }
- return QString();
-}
-
-int EAndroidSensorDevice::availableSensors(sensor_t const** list) const
-{
- if (m_initSuccess)
- return m_sensorModule->get_sensors_list(m_sensorModule, list);
- return 0;
-}
-
-bool EAndroidSensorDevice::initSensorDevice()
-{
- int err = 0;
- err = hw_get_module(SENSORS_HARDWARE_MODULE_ID,
- (hw_module_t const**)&m_sensorModule);
- if (err != 0 || !m_sensorModule) {
- qWarning("hw_get_module() failed (%s)\n", strerror(-err));
- return false;
- }
-
- err = sensors_open(&m_sensorModule->common, &m_sensorDevice);
- if (err != 0 || !m_sensorDevice) {
- qWarning("sensors_open() failed (%s)\n", strerror(-err));
- return false;
- }
-
- m_availableSensors = m_sensorModule->get_sensors_list(m_sensorModule,
- &m_availableSensorsList);
- return true;
-}
-
-void EAndroidSensorDevice::processSensorEvents() const
-{
- SensorEventArray *eventqueue = m_eventThread->lock();
- for (int i = 0; i < eventqueue->size(); i++) {
- sensors_event_t event = eventqueue->at(i);
- foreach (EAndroidBaseSensor *sensorListener, m_listenersHash[event.type])
- sensorListener->processEvent(event);
- }
- eventqueue->clear();
- m_eventThread->unlock();
-}
diff --git a/src/plugins/sensors/eandroid/eandroidsensordevice.h b/src/plugins/sensors/eandroid/eandroidsensordevice.h
deleted file mode 100644
index db4e0f4..0000000
--- a/src/plugins/sensors/eandroid/eandroidsensordevice.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use the contact form at
-** http://www.qt.io
-**
-** This file is part of Qt Enterprise Embedded.
-**
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** the contact form at http://www.qt.io
-**
-****************************************************************************/
-#ifndef EANDROIDSENSORDEVICE_H
-#define EANDROIDSENSORDEVICE_H
-
-#include <eandroidaccelerometer.h>
-#include <eandroidlight.h>
-#include <eandroidambientlightsensor.h>
-#include <eandroidgyroscope.h>
-#include <eandroidmagnetometer.h>
-#include <eandroidrotationsensor.h>
-
-#include <QtCore/QThread>
-#include <QtCore/QMutex>
-#include <QtCore/QReadWriteLock>
-#include <QtCore/QVarLengthArray>
-#include <QtCore/QHash>
-#include <QtCore/QList>
-#include <QtCore/QDebug>
-
-typedef QVarLengthArray<sensors_event_t, 16> SensorEventArray;
-typedef QHash<int, QList<EAndroidBaseSensor *> > ListenersHash;
-
-class EAndroidSensorDevice;
-
-class EventReaderThread : public QThread
-{
- Q_OBJECT
-public:
- EventReaderThread(EAndroidSensorDevice *manager);
- void run();
- SensorEventArray* lock();
- inline void unlock() { m_mutex.unlock(); }
-
-signals:
- void eventPending();
-
-private:
- EAndroidSensorDevice *m_device;
- SensorEventArray m_events;
- QMutex m_mutex;
-};
-
-class EAndroidSensorDevice : public QObject
-{
- Q_OBJECT
-public:
- static EAndroidSensorDevice* instance();
-
- void registerListener(int type, EAndroidBaseSensor *sensor, int dataRateHz);
- void unregisterListener(int type, EAndroidBaseSensor *sensor);
- int availableSensors(sensor_t const** list) const;
- qint32 maxDataRate(int type) const;
- QString description(int type) const;
-
-protected:
- bool initSensorDevice();
- int indexForType(int type) const;
- void setActive(int type, bool enable);
- void setDelay(int type, int dataRateHz) const;
-
-public slots:
- void processSensorEvents() const;
-
-private:
- static EAndroidSensorDevice* m_instance;
- EAndroidSensorDevice();
- EAndroidSensorDevice(const EAndroidSensorDevice &);
- EAndroidSensorDevice& operator=(const EAndroidSensorDevice &);
-
- friend class EventReaderThread;
- EventReaderThread *m_eventThread;
-
- sensors_module_t* m_sensorModule;
- sensors_poll_device_t* m_sensorDevice;
- sensor_t const* m_availableSensorsList;
- int m_availableSensors;
- bool m_initSuccess;
-
- ListenersHash m_listenersHash;
-};
-
-#endif // EANDROIDSENSORDEVICE_H
diff --git a/src/plugins/sensors/eandroid/main.cpp b/src/plugins/sensors/eandroid/main.cpp
deleted file mode 100644
index 8b62a18..0000000
--- a/src/plugins/sensors/eandroid/main.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://www.qt.io/licensing. For further information
-** use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <qsensorplugin.h>
-#include <qsensorbackend.h>
-#include <qsensormanager.h>
-#include <qsensor.h>
-
-#include <eandroidsensordevice.h>
-
-class EAndroidSensorPlugin : public QObject, public QSensorPluginInterface, public QSensorBackendFactory
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "com.qt-project.Qt.QSensorPluginInterface/1.0" FILE "plugin.json")
- Q_INTERFACES(QSensorPluginInterface)
-public:
- void registerSensors()
- {
-#define REGISTER_BACKEND(type, id) \
- QSensorManager::registerBackend(type, id, this); \
-
- sensor_t const* sensors;
- QByteArray id;
- int count = EAndroidSensorDevice::instance()->availableSensors(&sensors);
- for (int i = 0; i < count; i++) {
- id = QByteArray::number(sensors[i].type);
- switch (sensors[i].type) {
- case SENSOR_TYPE_ACCELEROMETER:
- REGISTER_BACKEND(QAccelerometer::type, id)
- break;
- case SENSOR_TYPE_MAGNETIC_FIELD:
- REGISTER_BACKEND(QMagnetometer::type, id)
- break;
- case SENSOR_TYPE_ORIENTATION:
- break;
- case SENSOR_TYPE_GYROSCOPE:
- REGISTER_BACKEND(QGyroscope::type, id)
- break;
- case SENSOR_TYPE_LIGHT:
- REGISTER_BACKEND(QLightSensor::type, id);
- REGISTER_BACKEND(QAmbientLightSensor::type, id);
- break;
- case SENSOR_TYPE_PRESSURE:
- break;
- case SENSOR_TYPE_TEMPERATURE:
- break;
- case SENSOR_TYPE_PROXIMITY:
- break;
- case SENSOR_TYPE_GRAVITY:
- break;
- case SENSOR_TYPE_LINEAR_ACCELERATION:
- break;
- case SENSOR_TYPE_ROTATION_VECTOR:
- REGISTER_BACKEND(QRotationSensor::type, id);
- break;
- case SENSOR_TYPE_RELATIVE_HUMIDITY:
- break;
- case SENSOR_TYPE_AMBIENT_TEMPERATURE:
- break;
- }
- }
-#undef REGISTER_BACKEND
- }
-
- QSensorBackend *createBackend(QSensor *sensor)
- {
- int sensorType = sensor->identifier().toInt();
- switch (sensorType) {
- case SENSOR_TYPE_ACCELEROMETER:
- return new EAndroidAccelerometer(sensorType, sensor);
- case SENSOR_TYPE_MAGNETIC_FIELD:
- return new EAndroidMagnetometer(sensorType, sensor);
- case SENSOR_TYPE_ORIENTATION:
- break;
- case SENSOR_TYPE_GYROSCOPE:
- return new EAndroidGyroscope(sensorType, sensor);
- case SENSOR_TYPE_LIGHT:
- if (sensor->type() == QAmbientLightSensor::type)
- return new EAndroidAmbientLightSensor(sensorType, sensor);
- else if (sensor->type() == QLightSensor::type)
- return new EAndroidLight(sensorType, sensor);
- case SENSOR_TYPE_PRESSURE:
- break;
- case SENSOR_TYPE_TEMPERATURE:
- break;
- case SENSOR_TYPE_PROXIMITY:
- break;
- case SENSOR_TYPE_GRAVITY:
- break;
- case SENSOR_TYPE_LINEAR_ACCELERATION:
- break;
- case SENSOR_TYPE_ROTATION_VECTOR:
- return new EAndroidRotationSensor(sensorType, sensor);
- case SENSOR_TYPE_RELATIVE_HUMIDITY:
- break;
- case SENSOR_TYPE_AMBIENT_TEMPERATURE:
- break;
- default:
- break;
- }
- return 0;
- }
-};
-
-#include "main.moc"
diff --git a/src/plugins/sensors/eandroid/plugin.json b/src/plugins/sensors/eandroid/plugin.json
deleted file mode 100644
index 8a55b3a..0000000
--- a/src/plugins/sensors/eandroid/plugin.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "Keys": [ "notused" ] }
diff --git a/src/plugins/sensors/sensors.pro b/src/plugins/sensors/sensors.pro
deleted file mode 100644
index d02cc99..0000000
--- a/src/plugins/sensors/sensors.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-TEMPLATE = subdirs
-android: SUBDIRS += eandroid
-