From e6e740b5cfacbaa816d461f74bec4240aaa99e21 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 18 Sep 2013 17:15:49 +0200 Subject: Android: Add missing sensors This adds Android backends for QAmbientTemperatureSensor, QPressureSensor and QProximitySensor. Task-number: QTBUG-30531 Change-Id: I8d97f62d007c886fcc8dd701e23f6a35a3cbd748 Reviewed-by: Lorn Potter --- .../qtproject/qt5/android/sensors/QtSensors.java | 11 ++++ .../sensors/android/src/androidjnisensors.cpp | 11 ++++ .../sensors/android/src/androidjnisensors.h | 9 ++- .../sensors/android/src/androidpressure.cpp | 63 +++++++++++++++++++ src/plugins/sensors/android/src/androidpressure.h | 58 +++++++++++++++++ .../sensors/android/src/androidproximity.cpp | 72 ++++++++++++++++++++++ src/plugins/sensors/android/src/androidproximity.h | 59 ++++++++++++++++++ .../sensors/android/src/androidtemperature.cpp | 66 ++++++++++++++++++++ .../sensors/android/src/androidtemperature.h | 58 +++++++++++++++++ src/plugins/sensors/android/src/main.cpp | 30 +++++++-- src/plugins/sensors/android/src/src.pro | 6 ++ src/sensors/doc/src/compatmap.qdoc | 6 +- 12 files changed, 438 insertions(+), 11 deletions(-) create mode 100644 src/plugins/sensors/android/src/androidpressure.cpp create mode 100644 src/plugins/sensors/android/src/androidpressure.h create mode 100644 src/plugins/sensors/android/src/androidproximity.cpp create mode 100644 src/plugins/sensors/android/src/androidproximity.h create mode 100644 src/plugins/sensors/android/src/androidtemperature.cpp create mode 100644 src/plugins/sensors/android/src/androidtemperature.h diff --git a/src/plugins/sensors/android/jar/src/org/qtproject/qt5/android/sensors/QtSensors.java b/src/plugins/sensors/android/jar/src/org/qtproject/qt5/android/sensors/QtSensors.java index c7956d2d..5507b07b 100644 --- a/src/plugins/sensors/android/jar/src/org/qtproject/qt5/android/sensors/QtSensors.java +++ b/src/plugins/sensors/android/jar/src/org/qtproject/qt5/android/sensors/QtSensors.java @@ -98,6 +98,17 @@ public class QtSensors implements SensorEventListener return null; } + private static float getSensorMaximumRange(int sensorType) + { + try { + Sensor s = m_sensorManager.getDefaultSensor(sensorType); + return s.getMaximumRange(); + } catch(Exception e) { + e.printStackTrace(); + } + return 0; + } + private static boolean registerSensor(int sensorType, int rate) { synchronized (m_syncObject) { diff --git a/src/plugins/sensors/android/src/androidjnisensors.cpp b/src/plugins/sensors/android/src/androidjnisensors.cpp index 6365433c..af39e0b6 100644 --- a/src/plugins/sensors/android/src/androidjnisensors.cpp +++ b/src/plugins/sensors/android/src/androidjnisensors.cpp @@ -53,6 +53,7 @@ static jmethodID getSensorListMethodId; static jmethodID registerSensorMethodId; static jmethodID unregisterSensorMethodId; static jmethodID getSensorDescriptionMethodId; +static jmethodID getSensorMaximumRangeMethodId; static QHash > listenersHash; QReadWriteLock listenersLocker; @@ -119,6 +120,15 @@ namespace AndroidSensors return ret; } + qreal sensorMaximumRange(AndroidSensorType sensor) + { + AttachedJNIEnv aenv; + if (!aenv.jniEnv) + return 0; + jfloat range = aenv.jniEnv->CallStaticFloatMethod(sensorsClass, getSensorMaximumRangeMethodId, jint(sensor)); + return range; + } + bool registerListener(AndroidSensorType sensor, AndroidSensorsListenerInterface *listener, int dataRate) { listenersLocker.lockForWrite(); @@ -214,6 +224,7 @@ static bool registerNatives(JNIEnv *env) GET_AND_CHECK_STATIC_METHOD(registerSensorMethodId, sensorsClass, "registerSensor", "(II)Z"); GET_AND_CHECK_STATIC_METHOD(unregisterSensorMethodId, sensorsClass, "unregisterSensor", "(I)Z"); GET_AND_CHECK_STATIC_METHOD(getSensorDescriptionMethodId, sensorsClass, "getSensorDescription", "(I)Ljava/lang/String;"); + GET_AND_CHECK_STATIC_METHOD(getSensorMaximumRangeMethodId, sensorsClass, "getSensorMaximumRange", "(I)F"); return true; } diff --git a/src/plugins/sensors/android/src/androidjnisensors.h b/src/plugins/sensors/android/src/androidjnisensors.h index 53ca58d0..30aab6cc 100644 --- a/src/plugins/sensors/android/src/androidjnisensors.h +++ b/src/plugins/sensors/android/src/androidjnisensors.h @@ -53,17 +53,21 @@ namespace AndroidSensors enum AndroidSensorType { TYPE_ACCELEROMETER = 1, - TYPE_AMBIENT_TEMPERATURE = 13, + TYPE_AMBIENT_TEMPERATURE = 13, //Added in API level 14 + TYPE_GAME_ROTATION_VECTOR = 15, //Added in API level 18 TYPE_GRAVITY = 9, TYPE_GYROSCOPE = 4, + TYPE_GYROSCOPE_UNCALIBRATED = 16, //Added in API level 18 TYPE_LIGHT = 5, TYPE_LINEAR_ACCELERATION = 10, TYPE_MAGNETIC_FIELD = 2, + TYPE_MAGNETIC_FIELD_UNCALIBRATED = 14, //Added in API level 18 TYPE_ORIENTATION = 3, //This constant was deprecated in API level 8. use SensorManager.getOrientation() instead. TYPE_PRESSURE = 6, TYPE_PROXIMITY = 8, - TYPE_RELATIVE_HUMIDITY = 12, + TYPE_RELATIVE_HUMIDITY = 12, //Added in API level 14 TYPE_ROTATION_VECTOR = 11, + TYPE_SIGNIFICANT_MOTION = 17, //Added in API level 18 TYPE_TEMPERATURE = 7 //This constant was deprecated in API level 14. use Sensor.TYPE_AMBIENT_TEMPERATURE instead. }; @@ -76,6 +80,7 @@ namespace AndroidSensors QVector availableSensors(); QString sensorDescription(AndroidSensorType sensor); + qreal sensorMaximumRange(AndroidSensorType sensor); bool registerListener(AndroidSensorType sensor, AndroidSensorsListenerInterface *listener, int dataRate = 0); bool unregisterListener(AndroidSensorType sensor, AndroidSensorsListenerInterface *listener); } diff --git a/src/plugins/sensors/android/src/androidpressure.cpp b/src/plugins/sensors/android/src/androidpressure.cpp new file mode 100644 index 00000000..1cabecbb --- /dev/null +++ b/src/plugins/sensors/android/src/androidpressure.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2013 BogDan Vatra +** Copyright (C) 2013 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://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 "androidpressure.h" + +AndroidPressure::AndroidPressure(AndroidSensors::AndroidSensorType type, QSensor *sensor) + : AndroidCommonSensor(type, sensor) +{} + + +void AndroidPressure::onAccuracyChanged(jint accuracy) +{ + Q_UNUSED(accuracy) +} + +void AndroidPressure::onSensorChanged(jlong timestamp, const jfloat *values, uint size) +{ + if (size < 1) + return; + m_reader.setTimestamp(timestamp/1000); + // check https://developer.android.com/reference/android/hardware/SensorEvent.html#values + m_reader.setPressure(values[0]*100); //Android uses hPa, we use Pa + newReadingAvailable(); +} diff --git a/src/plugins/sensors/android/src/androidpressure.h b/src/plugins/sensors/android/src/androidpressure.h new file mode 100644 index 00000000..44f1d53f --- /dev/null +++ b/src/plugins/sensors/android/src/androidpressure.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2013 BogDan Vatra +** Copyright (C) 2013 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://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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$ +** +****************************************************************************/ + +#ifndef ANDROIDPRESSURE_H +#define ANDROIDPRESSURE_H +#include + +#include "androidcommonsensor.h" + +class AndroidPressure : public AndroidCommonSensor +{ +public: + AndroidPressure(AndroidSensors::AndroidSensorType type, QSensor *sensor); +private: + virtual void onAccuracyChanged(jint accuracy); + virtual void onSensorChanged(jlong timestamp, const jfloat *values, uint size); +}; + +#endif // ANDROIDPRESSURE_H diff --git a/src/plugins/sensors/android/src/androidproximity.cpp b/src/plugins/sensors/android/src/androidproximity.cpp new file mode 100644 index 00000000..9d10f77b --- /dev/null +++ b/src/plugins/sensors/android/src/androidproximity.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2013 BogDan Vatra +** Copyright (C) 2013 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://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 "androidproximity.h" +#include "androidjnisensors.h" + +AndroidProximity::AndroidProximity(AndroidSensors::AndroidSensorType type, QSensor *sensor) + : AndroidCommonSensor(type, sensor) +{ + m_maximumRange = AndroidSensors::sensorMaximumRange(type); + + // if we can't get the range, we arbitrarily define anything closer than 10 cm as "close" + if (m_maximumRange <= 0) + m_maximumRange = 10.0; +} + + +void AndroidProximity::onAccuracyChanged(jint accuracy) +{ + Q_UNUSED(accuracy) +} + +void AndroidProximity::onSensorChanged(jlong timestamp, const jfloat *values, uint size) +{ + if (size < 1) + return; + m_reader.setTimestamp(timestamp/1000); + + qreal reading = values[0]; + bool close = (reading < m_maximumRange); + m_reader.setClose(close); + newReadingAvailable(); +} diff --git a/src/plugins/sensors/android/src/androidproximity.h b/src/plugins/sensors/android/src/androidproximity.h new file mode 100644 index 00000000..1911798d --- /dev/null +++ b/src/plugins/sensors/android/src/androidproximity.h @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2013 BogDan Vatra +** Copyright (C) 2013 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://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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$ +** +****************************************************************************/ + +#ifndef ANDROIDPROXIMITY_H +#define ANDROIDPROXIMITY_H +#include + +#include "androidcommonsensor.h" + +class AndroidProximity : public AndroidCommonSensor +{ +public: + AndroidProximity(AndroidSensors::AndroidSensorType type, QSensor *sensor); +private: + virtual void onAccuracyChanged(jint accuracy); + virtual void onSensorChanged(jlong timestamp, const jfloat *values, uint size); + qreal m_maximumRange; +}; + +#endif // ANDROIDPROXIMITY_H diff --git a/src/plugins/sensors/android/src/androidtemperature.cpp b/src/plugins/sensors/android/src/androidtemperature.cpp new file mode 100644 index 00000000..b3f41daa --- /dev/null +++ b/src/plugins/sensors/android/src/androidtemperature.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2013 BogDan Vatra +** Copyright (C) 2013 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://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 "androidtemperature.h" + +AndroidTemperature::AndroidTemperature(AndroidSensors::AndroidSensorType type, QSensor *sensor) + : AndroidCommonSensor(type, sensor) +{} + + +void AndroidTemperature::onAccuracyChanged(jint accuracy) +{ + Q_UNUSED(accuracy) +} + +void AndroidTemperature::onSensorChanged(jlong timestamp, const jfloat *values, uint size) +{ + if (size < 1) + return; + m_reader.setTimestamp(timestamp/1000); + + // TODO: I was unable to test this since the devices I was testing this with did not have + // a temperature sensor. Verify that this works and check that the units are correct. + + m_reader.setTemperature(values[0]); + newReadingAvailable(); +} diff --git a/src/plugins/sensors/android/src/androidtemperature.h b/src/plugins/sensors/android/src/androidtemperature.h new file mode 100644 index 00000000..667169cd --- /dev/null +++ b/src/plugins/sensors/android/src/androidtemperature.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2013 BogDan Vatra +** Copyright (C) 2013 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://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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$ +** +****************************************************************************/ + +#ifndef ANDROIDTEMPERATURE_H +#define ANDROIDTEMPERATURE_H +#include + +#include "androidcommonsensor.h" + +class AndroidTemperature : public AndroidCommonSensor +{ +public: + AndroidTemperature(AndroidSensors::AndroidSensorType type, QSensor *sensor); +private: + virtual void onAccuracyChanged(jint accuracy); + virtual void onSensorChanged(jlong timestamp, const jfloat *values, uint size); +}; + +#endif // ANDROIDTEMPERATURE_H diff --git a/src/plugins/sensors/android/src/main.cpp b/src/plugins/sensors/android/src/main.cpp index 0cb4de49..17d499ef 100644 --- a/src/plugins/sensors/android/src/main.cpp +++ b/src/plugins/sensors/android/src/main.cpp @@ -47,7 +47,10 @@ #include "androidgyroscope.h" #include "androidlight.h" #include "androidmagnetometer.h" +#include "androidpressure.h" +#include "androidproximity.h" #include "androidrotation.h" +#include "androidtemperature.h" using namespace AndroidSensors; @@ -66,7 +69,8 @@ public: break; case TYPE_AMBIENT_TEMPERATURE: case TYPE_TEMPERATURE: - break; // add the temperature sensor backend + QSensorManager::registerBackend(QAmbientTemperatureSensor::type, QByteArray::number(sensor), this); + break; case TYPE_GRAVITY: break; // add the gravity sensor backend case TYPE_GYROSCOPE: @@ -83,14 +87,22 @@ public: case TYPE_ORIENTATION: break; // add the orientation sensor backend case TYPE_PRESSURE: - break; // add the pressure sensor backend + QSensorManager::registerBackend(QPressureSensor::type, QByteArray::number(sensor), this); + break; case TYPE_PROXIMITY: - break; // add the proximity sensor backend + QSensorManager::registerBackend(QProximitySensor::type, QByteArray::number(sensor), this); + break; case TYPE_RELATIVE_HUMIDITY: break; // add the relative humidity sensor backend case TYPE_ROTATION_VECTOR: QSensorManager::registerBackend(QRotationSensor::type, QByteArray::number(sensor), this); break; + + case TYPE_GAME_ROTATION_VECTOR: + case TYPE_GYROSCOPE_UNCALIBRATED: + case TYPE_MAGNETIC_FIELD_UNCALIBRATED: + case TYPE_SIGNIFICANT_MOTION: + break; // add backends for API level 18 sensors } } } @@ -103,7 +115,7 @@ public: return new AndroidAccelerometer(type, sensor); case TYPE_AMBIENT_TEMPERATURE: case TYPE_TEMPERATURE: - break; // add the temperature sensor backend + return new AndroidTemperature(type, sensor); case TYPE_GRAVITY: break; // add the gravity sensor backend case TYPE_GYROSCOPE: @@ -117,13 +129,19 @@ public: case TYPE_ORIENTATION: break; // add the orientation sensor backend case TYPE_PRESSURE: - break; // add the pressure sensor backend + return new AndroidPressure(type, sensor); case TYPE_PROXIMITY: - break; // add the proximity sensor backend + return new AndroidProximity(type, sensor); case TYPE_RELATIVE_HUMIDITY: break; // add the relative humidity sensor backend case TYPE_ROTATION_VECTOR: return new AndroidRotation(type, sensor); + + case TYPE_GAME_ROTATION_VECTOR: + case TYPE_GYROSCOPE_UNCALIBRATED: + case TYPE_MAGNETIC_FIELD_UNCALIBRATED: + case TYPE_SIGNIFICANT_MOTION: + break; // add backends for API level 18 sensors } return 0; } diff --git a/src/plugins/sensors/android/src/src.pro b/src/plugins/sensors/android/src/src.pro index 715a0111..a184aae7 100644 --- a/src/plugins/sensors/android/src/src.pro +++ b/src/plugins/sensors/android/src/src.pro @@ -14,7 +14,10 @@ HEADERS = \ androidcommonsensor.h \ androidgyroscope.h \ androidmagnetometer.h \ + androidpressure.h \ + androidproximity.h \ androidrotation.h \ + androidtemperature.h \ androidlight.h SOURCES = \ @@ -23,7 +26,10 @@ SOURCES = \ androidaccelerometer.cpp \ androidgyroscope.cpp \ androidmagnetometer.cpp \ + androidpressure.cpp \ + androidproximity.cpp \ androidrotation.cpp \ + androidtemperature.cpp \ androidlight.cpp OTHER_FILES = plugin.json diff --git a/src/sensors/doc/src/compatmap.qdoc b/src/sensors/doc/src/compatmap.qdoc index 5e541def..e3a35304 100644 --- a/src/sensors/doc/src/compatmap.qdoc +++ b/src/sensors/doc/src/compatmap.qdoc @@ -90,7 +90,7 @@ Ambient Temperature Sensor - + @@ -162,7 +162,7 @@ Pressure Sensor - + @@ -171,7 +171,7 @@ Proximity Sensor - + -- cgit v1.2.3