From 45c8ae3232df8955644697ee88c4321f26bb5cf2 Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Wed, 6 Jan 2021 07:30:03 +1000 Subject: QtSensors initial cmake support This commit introduces the bare minimum cmake support that should unblock the CI and allow further verification and development on most platforms: macOS, Linux, Win, iOS and Android. Some clarifications: * The support for sensorfw backend is very preliminary and can be enabled later if needed (no Qt6 version of the sensorfw). * The simulator backend is dropped as obsolete / unnecessary. * Three examples are currently commented out and shall be ported with a later commit. Task-number: QTBUG-92502 Change-Id: Id523d43ed3ef177010dc73afc5812ed374cff0dd Reviewed-by: Alexandru Croitor --- src/plugins/CMakeLists.txt | 2 + src/plugins/plugins.pro | 3 - src/plugins/sensorgestures/CMakeLists.txt | 2 + .../sensorgestures/qtsensors/CMakeLists.txt | 29 +++ src/plugins/sensorgestures/qtsensors/qtsensors.pro | 37 --- src/plugins/sensorgestures/sensorgestures.pro | 2 - src/plugins/sensorgestures/shake/CMakeLists.txt | 19 ++ src/plugins/sensorgestures/shake/shake.pro | 16 -- src/plugins/sensors/CMakeLists.txt | 39 ++++ src/plugins/sensors/android/CMakeLists.txt | 32 +++ src/plugins/sensors/android/android.pro | 41 ---- src/plugins/sensors/dummy/CMakeLists.txt | 27 +++ src/plugins/sensors/dummy/dummy.pro | 19 -- src/plugins/sensors/generic/CMakeLists.txt | 33 +++ src/plugins/sensors/generic/generic.pro | 29 --- .../sensors/iio-sensor-proxy/CMakeLists.txt | 41 ++++ .../sensors/iio-sensor-proxy/iio-sensor-proxy.pro | 31 --- src/plugins/sensors/ios/CMakeLists.txt | 50 ++++ src/plugins/sensors/ios/ios.pro | 49 ---- src/plugins/sensors/linux/CMakeLists.txt | 25 ++ src/plugins/sensors/linux/linux.pro | 13 -- src/plugins/sensors/sensorfw/CMakeLists.txt | 36 +++ src/plugins/sensors/sensorfw/sensorfw.pro | 16 -- src/plugins/sensors/sensorfw/sensorfwsensorbase.h | 2 +- src/plugins/sensors/sensors.pro | 45 ---- src/plugins/sensors/sensortag/CMakeLists.txt | 26 +++ src/plugins/sensors/sensortag/sensortag.pro | 11 - src/plugins/sensors/simulator/main.cpp | 143 ------------ src/plugins/sensors/simulator/plugin.json | 1 - .../sensors/simulator/qsensordata_simulator.cpp | 143 ------------ .../sensors/simulator/qsensordata_simulator_p.h | 128 ----------- src/plugins/sensors/simulator/simulator.pro | 32 --- .../sensors/simulator/simulatoraccelerometer.cpp | 71 ------ .../sensors/simulator/simulatoraccelerometer.h | 59 ----- .../simulator/simulatorambientlightsensor.cpp | 89 -------- .../simulator/simulatorambientlightsensor.h | 59 ----- src/plugins/sensors/simulator/simulatorcommon.cpp | 252 --------------------- src/plugins/sensors/simulator/simulatorcommon.h | 105 --------- src/plugins/sensors/simulator/simulatorcompass.cpp | 69 ------ src/plugins/sensors/simulator/simulatorcompass.h | 59 ----- .../simulator/simulatorirproximitysensor.cpp | 67 ------ .../sensors/simulator/simulatorirproximitysensor.h | 59 ----- .../sensors/simulator/simulatorlightsensor.cpp | 67 ------ .../sensors/simulator/simulatorlightsensor.h | 59 ----- .../sensors/simulator/simulatormagnetometer.cpp | 73 ------ .../sensors/simulator/simulatormagnetometer.h | 59 ----- .../sensors/simulator/simulatorproximitysensor.cpp | 67 ------ .../sensors/simulator/simulatorproximitysensor.h | 59 ----- src/plugins/sensors/winrt/CMakeLists.txt | 26 +++ src/plugins/sensors/winrt/winrt.pro | 29 --- 50 files changed, 388 insertions(+), 2062 deletions(-) create mode 100644 src/plugins/CMakeLists.txt delete mode 100644 src/plugins/plugins.pro create mode 100644 src/plugins/sensorgestures/CMakeLists.txt create mode 100644 src/plugins/sensorgestures/qtsensors/CMakeLists.txt delete mode 100644 src/plugins/sensorgestures/qtsensors/qtsensors.pro delete mode 100644 src/plugins/sensorgestures/sensorgestures.pro create mode 100644 src/plugins/sensorgestures/shake/CMakeLists.txt delete mode 100644 src/plugins/sensorgestures/shake/shake.pro create mode 100644 src/plugins/sensors/CMakeLists.txt create mode 100644 src/plugins/sensors/android/CMakeLists.txt delete mode 100644 src/plugins/sensors/android/android.pro create mode 100644 src/plugins/sensors/dummy/CMakeLists.txt delete mode 100644 src/plugins/sensors/dummy/dummy.pro create mode 100644 src/plugins/sensors/generic/CMakeLists.txt delete mode 100644 src/plugins/sensors/generic/generic.pro create mode 100644 src/plugins/sensors/iio-sensor-proxy/CMakeLists.txt delete mode 100644 src/plugins/sensors/iio-sensor-proxy/iio-sensor-proxy.pro create mode 100644 src/plugins/sensors/ios/CMakeLists.txt delete mode 100644 src/plugins/sensors/ios/ios.pro create mode 100644 src/plugins/sensors/linux/CMakeLists.txt delete mode 100644 src/plugins/sensors/linux/linux.pro create mode 100644 src/plugins/sensors/sensorfw/CMakeLists.txt delete mode 100644 src/plugins/sensors/sensorfw/sensorfw.pro delete mode 100644 src/plugins/sensors/sensors.pro create mode 100644 src/plugins/sensors/sensortag/CMakeLists.txt delete mode 100644 src/plugins/sensors/sensortag/sensortag.pro delete mode 100644 src/plugins/sensors/simulator/main.cpp delete mode 100644 src/plugins/sensors/simulator/plugin.json delete mode 100644 src/plugins/sensors/simulator/qsensordata_simulator.cpp delete mode 100644 src/plugins/sensors/simulator/qsensordata_simulator_p.h delete mode 100644 src/plugins/sensors/simulator/simulator.pro delete mode 100644 src/plugins/sensors/simulator/simulatoraccelerometer.cpp delete mode 100644 src/plugins/sensors/simulator/simulatoraccelerometer.h delete mode 100644 src/plugins/sensors/simulator/simulatorambientlightsensor.cpp delete mode 100644 src/plugins/sensors/simulator/simulatorambientlightsensor.h delete mode 100644 src/plugins/sensors/simulator/simulatorcommon.cpp delete mode 100644 src/plugins/sensors/simulator/simulatorcommon.h delete mode 100644 src/plugins/sensors/simulator/simulatorcompass.cpp delete mode 100644 src/plugins/sensors/simulator/simulatorcompass.h delete mode 100644 src/plugins/sensors/simulator/simulatorirproximitysensor.cpp delete mode 100644 src/plugins/sensors/simulator/simulatorirproximitysensor.h delete mode 100644 src/plugins/sensors/simulator/simulatorlightsensor.cpp delete mode 100644 src/plugins/sensors/simulator/simulatorlightsensor.h delete mode 100644 src/plugins/sensors/simulator/simulatormagnetometer.cpp delete mode 100644 src/plugins/sensors/simulator/simulatormagnetometer.h delete mode 100644 src/plugins/sensors/simulator/simulatorproximitysensor.cpp delete mode 100644 src/plugins/sensors/simulator/simulatorproximitysensor.h create mode 100644 src/plugins/sensors/winrt/CMakeLists.txt delete mode 100644 src/plugins/sensors/winrt/winrt.pro (limited to 'src/plugins') diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt new file mode 100644 index 00000000..fdcb878d --- /dev/null +++ b/src/plugins/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(sensors) +add_subdirectory(sensorgestures) diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro deleted file mode 100644 index c8b9e6ab..00000000 --- a/src/plugins/plugins.pro +++ /dev/null @@ -1,3 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += sensors -SUBDIRS += sensorgestures diff --git a/src/plugins/sensorgestures/CMakeLists.txt b/src/plugins/sensorgestures/CMakeLists.txt new file mode 100644 index 00000000..07fbacc9 --- /dev/null +++ b/src/plugins/sensorgestures/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(shake) +add_subdirectory(qtsensors) diff --git a/src/plugins/sensorgestures/qtsensors/CMakeLists.txt b/src/plugins/sensorgestures/qtsensors/CMakeLists.txt new file mode 100644 index 00000000..16b76086 --- /dev/null +++ b/src/plugins/sensorgestures/qtsensors/CMakeLists.txt @@ -0,0 +1,29 @@ +##################################################################### +## QtSensorGesturePlugin Plugin: +##################################################################### + +qt_internal_add_plugin(QtSensorGesturePlugin + OUTPUT_NAME qtsensorgestures_plugin + TYPE sensorgestures + DEFAULT_IF FALSE + SOURCES + qcoversensorgesturerecognizer.cpp qcoversensorgesturerecognizer.h + qdoubletapsensorgesturerecognizer.cpp qdoubletapsensorgesturerecognizer.h + qfreefallsensorgesturerecognizer.cpp qfreefallsensorgesturerecognizer.h + qhoversensorgesturerecognizer.cpp qhoversensorgesturerecognizer.h + qpickupsensorgesturerecognizer.cpp qpickupsensorgesturerecognizer.h + qshake2recognizer.cpp qshake2recognizer.h + qslamgesturerecognizer.cpp qslamgesturerecognizer.h + qtsensorgestureplugin.cpp qtsensorgestureplugin.h + qtsensorgesturesensorhandler.cpp qtsensorgesturesensorhandler.h + qturnoversensorgesturerecognizer.cpp qturnoversensorgesturerecognizer.h + qtwistsensorgesturerecognizer.cpp qtwistsensorgesturerecognizer.h + qwhipsensorgesturerecognizer.cpp qwhipsensorgesturerecognizer.h + PUBLIC_LIBRARIES + Qt::Core + Qt::Sensors +) + +#### Keys ignored in scope 1:.:.:qtsensors.pro:: +# OTHER_FILES = "plugin.json" +# PLUGIN_EXTENDS = "-" diff --git a/src/plugins/sensorgestures/qtsensors/qtsensors.pro b/src/plugins/sensorgestures/qtsensors/qtsensors.pro deleted file mode 100644 index 44f18ff5..00000000 --- a/src/plugins/sensorgestures/qtsensors/qtsensors.pro +++ /dev/null @@ -1,37 +0,0 @@ -TARGET = qtsensorgestures_plugin -QT = core sensors - -# Input -HEADERS += qtsensorgestureplugin.h \ - qcoversensorgesturerecognizer.h \ - qdoubletapsensorgesturerecognizer.h \ - qhoversensorgesturerecognizer.h \ - qfreefallsensorgesturerecognizer.h \ - qpickupsensorgesturerecognizer.h \ - qshake2recognizer.h \ - qslamgesturerecognizer.h \ - qturnoversensorgesturerecognizer.h \ - qtwistsensorgesturerecognizer.h \ - qwhipsensorgesturerecognizer.h \ - qtsensorgesturesensorhandler.h - -SOURCES += qtsensorgestureplugin.cpp \ - qcoversensorgesturerecognizer.cpp \ - qdoubletapsensorgesturerecognizer.cpp \ - qhoversensorgesturerecognizer.cpp \ - qfreefallsensorgesturerecognizer.cpp \ - qpickupsensorgesturerecognizer.cpp \ - qshake2recognizer.cpp \ - qslamgesturerecognizer.cpp \ - qturnoversensorgesturerecognizer.cpp \ - qtwistsensorgesturerecognizer.cpp \ - qwhipsensorgesturerecognizer.cpp \ - qtsensorgesturesensorhandler.cpp - -OTHER_FILES += \ - plugin.json - -PLUGIN_TYPE = sensorgestures -PLUGIN_CLASS_NAME = QtSensorGesturePlugin -PLUGIN_EXTENDS = - -load(qt_plugin) diff --git a/src/plugins/sensorgestures/sensorgestures.pro b/src/plugins/sensorgestures/sensorgestures.pro deleted file mode 100644 index 162fb8eb..00000000 --- a/src/plugins/sensorgestures/sensorgestures.pro +++ /dev/null @@ -1,2 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += shake qtsensors diff --git a/src/plugins/sensorgestures/shake/CMakeLists.txt b/src/plugins/sensorgestures/shake/CMakeLists.txt new file mode 100644 index 00000000..489881aa --- /dev/null +++ b/src/plugins/sensorgestures/shake/CMakeLists.txt @@ -0,0 +1,19 @@ +##################################################################### +## QShakeSensorGesturePlugin Plugin: +##################################################################### + +qt_internal_add_plugin(QShakeSensorGesturePlugin + OUTPUT_NAME qtsensorgestures_shakeplugin + TYPE sensorgestures + DEFAULT_IF FALSE + SOURCES + qshakerecognizer.cpp qshakerecognizer.h + qshakesensorgestureplugin.cpp qshakesensorgestureplugin.h + PUBLIC_LIBRARIES + Qt::Core + Qt::Sensors +) + +#### Keys ignored in scope 1:.:.:shake.pro:: +# OTHER_FILES = "plugin.json" +# PLUGIN_EXTENDS = "-" diff --git a/src/plugins/sensorgestures/shake/shake.pro b/src/plugins/sensorgestures/shake/shake.pro deleted file mode 100644 index efa2a0cb..00000000 --- a/src/plugins/sensorgestures/shake/shake.pro +++ /dev/null @@ -1,16 +0,0 @@ -TARGET = qtsensorgestures_shakeplugin -QT = core sensors - -# Input -HEADERS += qshakesensorgestureplugin.h \ - qshakerecognizer.h -SOURCES += qshakesensorgestureplugin.cpp \ - qshakerecognizer.cpp - -OTHER_FILES += \ - plugin.json - -PLUGIN_TYPE = sensorgestures -PLUGIN_CLASS_NAME = QShakeSensorGesturePlugin -PLUGIN_EXTENDS = - -load(qt_plugin) diff --git a/src/plugins/sensors/CMakeLists.txt b/src/plugins/sensors/CMakeLists.txt new file mode 100644 index 00000000..08bfa26a --- /dev/null +++ b/src/plugins/sensors/CMakeLists.txt @@ -0,0 +1,39 @@ +# all get generic sensor +add_subdirectory(generic) + +if(ANDROID AND NOT SENSORS_PLUGINS OR "sensorfw" IN_LIST SENSORS_PLUGINS) + add_subdirectory(android) +endif() + +# Currently disabled, see src/sensors/configure.cmake +#if (QT_FEATURE_sensorfw AND NOT SENSORS_PLUGINS OR "sensorfw" IN_LIST SENSORS_PLUGINS) +# add_subdirectory(sensorfw) +#endif() + +if (WIN32 AND NOT SENSORS_PLUGINS OR "winrt" IN_LIST SENSORS_PLUGINS) + add_subdirectory(winrt) +endif() + +if (LINUX AND NOT SENSORS_PLUGINS OR "linux" IN_LIST SENSORS_PLUGINS) + add_subdirectory(linux) +endif() + +if (IOS AND NOT SENSORS_PLUGINS OR "ios" IN_LIST SENSORS_PLUGINS) + add_subdirectory(ios) +endif() + +if(LINUX AND TARGET Qt::DBus AND NOT SENSORS_PLUGINS OR "iio-sensor-proxy" IN_LIST SENSORS_PLUGINS) + add_subdirectory(iio-sensor-proxy) +endif() + +if(LINUX AND TARGET Qt::Bluetooth AND NOT SENSORS_PLUGINS OR "sensortag" IN_LIST SENSORS_PLUGINS) + if (TARGET Qt::Bluetooth) + add_subdirectory(sensortag) + else() + message(WARNING "You have configured for sensortag, but Qt Bluetooth module was not found.") + endif() +endif() + +if(NOT SENSORS_PLUGINS OR "dummy" IN_LIST SENSORS_PLUGINS) + add_subdirectory(dummy) +endif() diff --git a/src/plugins/sensors/android/CMakeLists.txt b/src/plugins/sensors/android/CMakeLists.txt new file mode 100644 index 00000000..76ee4091 --- /dev/null +++ b/src/plugins/sensors/android/CMakeLists.txt @@ -0,0 +1,32 @@ +##################################################################### +## QCounterGesturePlugin Plugin: +##################################################################### + +qt_internal_add_plugin(AndroidSensorPlugin + OUTPUT_NAME qtsensors_android + TYPE sensors + SOURCES + androidaccelerometer.cpp androidaccelerometer.h + androidcompass.cpp androidcompass.h + androidgyroscope.cpp androidgyroscope.h + androidlight.cpp androidlight.h + androidmagnetometer.cpp androidmagnetometer.h + androidpressure.cpp androidpressure.h + androidproximity.cpp androidproximity.h + androidrotation.cpp androidrotation.h + androidtemperature.cpp androidtemperature.h + main.cpp + sensoreventqueue.h + sensormanager.cpp sensormanager.h + DEFINES + # STATICPLUGIN needed because there's a Q_IMPORT_PLUGIN in main.cpp + # Yes, the plugin imports itself statically + QT_STATICPLUGIN + PUBLIC_LIBRARIES + Qt::CorePrivate + Qt::Sensors + android +) + +#### Keys ignored in scope 1:.:.:android.pro:: +# OTHER_FILES = "plugin.json" diff --git a/src/plugins/sensors/android/android.pro b/src/plugins/sensors/android/android.pro deleted file mode 100644 index 15e26ee9..00000000 --- a/src/plugins/sensors/android/android.pro +++ /dev/null @@ -1,41 +0,0 @@ -TARGET = qtsensors_android - -QT = sensors core-private - -# STATICPLUGIN needed because there's a Q_IMPORT_PLUGIN in main.cpp -# Yes, the plugin imports itself statically -DEFINES += QT_STATICPLUGIN - -HEADERS = \ - androidaccelerometer.h \ - androidcompass.h \ - androidgyroscope.h \ - androidmagnetometer.h \ - androidpressure.h \ - androidproximity.h \ - androidrotation.h \ - androidtemperature.h \ - androidlight.h \ - sensoreventqueue.h \ - sensormanager.h - -SOURCES = \ - main.cpp \ - androidaccelerometer.cpp \ - androidcompass.cpp \ - androidgyroscope.cpp \ - androidmagnetometer.cpp \ - androidpressure.cpp \ - androidproximity.cpp \ - androidrotation.cpp \ - androidtemperature.cpp \ - androidlight.cpp \ - sensormanager.cpp - -OTHER_FILES = plugin.json - -LIBS += -landroid - -PLUGIN_TYPE = sensors -PLUGIN_CLASS_NAME = QCounterGesturePlugin -load(qt_plugin) diff --git a/src/plugins/sensors/dummy/CMakeLists.txt b/src/plugins/sensors/dummy/CMakeLists.txt new file mode 100644 index 00000000..ad245350 --- /dev/null +++ b/src/plugins/sensors/dummy/CMakeLists.txt @@ -0,0 +1,27 @@ +##################################################################### +## dummySensorPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(dummySensorPlugin + OUTPUT_NAME qtsensors_dummy + TYPE sensors + SOURCES + dummyaccelerometer.cpp dummyaccelerometer.h + dummycommon.cpp dummycommon.h + dummylightsensor.cpp dummylightsensor.h + main.cpp + PUBLIC_LIBRARIES + Qt::Core + Qt::Sensors +) + +#### Keys ignored in scope 1:.:.:dummy.pro:: +# OTHER_FILES = "plugin.json" + +## Scopes: +##################################################################### + +qt_internal_extend_target(dummySensorPlugin CONDITION UNIX AND NOT ANDROID AND NOT APPLE AND NOT OPENBSD AND NOT QNX + PUBLIC_LIBRARIES + rt +) diff --git a/src/plugins/sensors/dummy/dummy.pro b/src/plugins/sensors/dummy/dummy.pro deleted file mode 100644 index 6eab4912..00000000 --- a/src/plugins/sensors/dummy/dummy.pro +++ /dev/null @@ -1,19 +0,0 @@ -TARGET = qtsensors_dummy -QT = sensors core - -HEADERS += dummycommon.h\ - dummyaccelerometer.h\ - dummylightsensor.h - -SOURCES += dummycommon.cpp\ - dummyaccelerometer.cpp\ - dummylightsensor.cpp\ - main.cpp - -OTHER_FILES = plugin.json - -unix:!darwin:!qnx:!android:!openbsd: LIBS += -lrt - -PLUGIN_TYPE = sensors -PLUGIN_CLASS_NAME = dummySensorPlugin -load(qt_plugin) diff --git a/src/plugins/sensors/generic/CMakeLists.txt b/src/plugins/sensors/generic/CMakeLists.txt new file mode 100644 index 00000000..ccdbe811 --- /dev/null +++ b/src/plugins/sensors/generic/CMakeLists.txt @@ -0,0 +1,33 @@ +##################################################################### +## genericSensorPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(genericSensorPlugin + OUTPUT_NAME qtsensors_generic + TYPE sensors + SOURCES + genericalssensor.cpp genericalssensor.h + genericorientationsensor.cpp genericorientationsensor.h + generictiltsensor.cpp generictiltsensor.h + main.cpp + DEFINES + QTSENSORS_GENERICALSSENSOR + QTSENSORS_GENERICORIENTATIONSENSOR + QTSENSORS_GENERICTILTSENSOR + PUBLIC_LIBRARIES + Qt::Core + Qt::Sensors +) + +#### Keys ignored in scope 1:.:.:generic.pro:: +# OTHER_FILES = "plugin.json" + +## Scopes: +##################################################################### + +qt_internal_extend_target(genericSensorPlugin CONDITION NOT ANDROID + SOURCES + genericrotationsensor.cpp genericrotationsensor.h + DEFINES + QTSENSORS_GENERICROTATIONSENSOR +) diff --git a/src/plugins/sensors/generic/generic.pro b/src/plugins/sensors/generic/generic.pro deleted file mode 100644 index cf87ccf3..00000000 --- a/src/plugins/sensors/generic/generic.pro +++ /dev/null @@ -1,29 +0,0 @@ -TARGET = qtsensors_generic -QT = core sensors - -HEADERS += generictiltsensor.h - -SOURCES += main.cpp\ - generictiltsensor.cpp -DEFINES += QTSENSORS_GENERICTILTSENSOR - -HEADERS += genericorientationsensor.h\ - genericalssensor.h - -SOURCES += genericorientationsensor.cpp\ - genericalssensor.cpp -DEFINES += QTSENSORS_GENERICORIENTATIONSENSOR QTSENSORS_GENERICALSSENSOR - -!android { - HEADERS += genericrotationsensor.h - - SOURCES += genericrotationsensor.cpp - - DEFINES += QTSENSORS_GENERICROTATIONSENSOR -} - -OTHER_FILES = plugin.json - -PLUGIN_TYPE = sensors -PLUGIN_CLASS_NAME = genericSensorPlugin -load(qt_plugin) diff --git a/src/plugins/sensors/iio-sensor-proxy/CMakeLists.txt b/src/plugins/sensors/iio-sensor-proxy/CMakeLists.txt new file mode 100644 index 00000000..2a593e90 --- /dev/null +++ b/src/plugins/sensors/iio-sensor-proxy/CMakeLists.txt @@ -0,0 +1,41 @@ +##################################################################### +## IIOSensorProxySensorPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(IIOSensorProxySensorPlugin + OUTPUT_NAME qtsensors_iio-sensor-proxy + TYPE sensors + SOURCES + iiosensorproxycompass.cpp iiosensorproxycompass.h + iiosensorproxylightsensor.cpp iiosensorproxylightsensor.h + iiosensorproxyorientationsensor.cpp iiosensorproxyorientationsensor.h + iiosensorproxysensorbase.cpp iiosensorproxysensorbase.h + main.cpp + DBUS_INTERFACE_SOURCES + org.freedesktop.DBus.Properties.xml + net.hadess.SensorProxy.xml + net.hadess.SensorProxy.Compass.xml + DBUS_INTERFACE_FLAGS + "-N" + PUBLIC_LIBRARIES + Qt::Core + Qt::DBus + Qt::Sensors +) + +#### Keys ignored in scope 1:.:.:iio-sensor-proxy.pro:: +# OTHER_FILES = "plugin.json" "$$DBUS_INTERFACES" +# dbus_properties.files = "org.freedesktop.DBus.Properties.xml" +# dbus_properties.header_flags = "-N" +# sensor_proxy.files = "net.hadess.SensorProxy.xml" +# sensor_proxy.header_flags = "-N" +# sensor_proxy_compass.files = "net.hadess.SensorProxy.Compass.xml" +# sensor_proxy_compass.header_flags = "-N" + +## Scopes: +##################################################################### + +qt_internal_extend_target(IIOSensorProxySensorPlugin CONDITION NOT ANDROID + PUBLIC_LIBRARIES + rt +) diff --git a/src/plugins/sensors/iio-sensor-proxy/iio-sensor-proxy.pro b/src/plugins/sensors/iio-sensor-proxy/iio-sensor-proxy.pro deleted file mode 100644 index b68d9fbf..00000000 --- a/src/plugins/sensors/iio-sensor-proxy/iio-sensor-proxy.pro +++ /dev/null @@ -1,31 +0,0 @@ -TARGET = qtsensors_iio-sensor-proxy -QT = core dbus sensors - -PLUGIN_TYPE = sensors -PLUGIN_CLASS_NAME = IIOSensorProxySensorPlugin -load(qt_plugin) - -!android:LIBS += -lrt -HEADERS += iiosensorproxysensorbase.h \ - iiosensorproxylightsensor.h \ - iiosensorproxyorientationsensor.h \ - iiosensorproxycompass.h - -SOURCES += iiosensorproxysensorbase.cpp \ - iiosensorproxylightsensor.cpp \ - iiosensorproxyorientationsensor.cpp \ - iiosensorproxycompass.cpp \ - main.cpp - -DBUS_INTERFACES += sensor_proxy sensor_proxy_compass dbus_properties - -sensor_proxy.files = net.hadess.SensorProxy.xml -sensor_proxy.header_flags = -N - -sensor_proxy_compass.files = net.hadess.SensorProxy.Compass.xml -sensor_proxy_compass.header_flags = -N - -dbus_properties.files = org.freedesktop.DBus.Properties.xml -dbus_properties.header_flags = -N - -OTHER_FILES = plugin.json $$DBUS_INTERFACES diff --git a/src/plugins/sensors/ios/CMakeLists.txt b/src/plugins/sensors/ios/CMakeLists.txt new file mode 100644 index 00000000..9a6b100c --- /dev/null +++ b/src/plugins/sensors/ios/CMakeLists.txt @@ -0,0 +1,50 @@ +##################################################################### +## IOSSensorPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(IOSSensorPlugin + OUTPUT_NAME qtsensors_ios + TYPE sensors + SOURCES + main.mm + PUBLIC_LIBRARIES + ${FWFoundation} + Qt::Core + Qt::Sensors +) + +#### Keys ignored in scope 1:.:.:ios.pro:: +# OTHER_FILES = "plugin.json" + +## Scopes: +##################################################################### + +qt_internal_extend_target(IOSSensorPlugin CONDITION IOS AND UIKIT + SOURCES + ioscompass.h ioscompass.mm + DEFINES + HAVE_COMPASS + PUBLIC_LIBRARIES + ${FWCoreLocation} +) + +qt_internal_extend_target(IOSSensorPlugin CONDITION UIKIT AND NOT TVOS + SOURCES + iosaccelerometer.h iosaccelerometer.mm + iosgyroscope.h iosgyroscope.mm + iosmagnetometer.h iosmagnetometer.mm + iosmotionmanager.h iosmotionmanager.mm + DEFINES + HAVE_COREMOTION + PUBLIC_LIBRARIES + ${FWCoreMotion} +) + +qt_internal_extend_target(IOSSensorPlugin CONDITION UIKIT AND NOT WATCHOS + SOURCES + iosproximitysensor.h iosproximitysensor.mm + DEFINES + HAVE_UIDEVICE + PUBLIC_LIBRARIES + ${FWUIKit} +) diff --git a/src/plugins/sensors/ios/ios.pro b/src/plugins/sensors/ios/ios.pro deleted file mode 100644 index 91ec3ae0..00000000 --- a/src/plugins/sensors/ios/ios.pro +++ /dev/null @@ -1,49 +0,0 @@ -TARGET = qtsensors_ios -QT = core sensors - -OTHER_FILES = plugin.json - -OBJECTIVE_SOURCES += main.mm -LIBS += -framework Foundation - -uikit { - ios { - HEADERS += \ - ioscompass.h - OBJECTIVE_SOURCES += \ - ioscompass.mm - - DEFINES += HAVE_COMPASS - LIBS += -framework CoreLocation - } - - !tvos { - HEADERS += \ - iosaccelerometer.h \ - iosgyroscope.h \ - iosmagnetometer.h \ - iosmotionmanager.h - OBJECTIVE_SOURCES += \ - iosaccelerometer.mm \ - iosgyroscope.mm \ - iosmagnetometer.mm \ - iosmotionmanager.mm - - DEFINES += HAVE_COREMOTION - LIBS += -framework CoreMotion - } - - !watchos { - HEADERS += \ - iosproximitysensor.h - OBJECTIVE_SOURCES += \ - iosproximitysensor.mm - - DEFINES += HAVE_UIDEVICE - LIBS += -framework UIKit - } -} - -PLUGIN_TYPE = sensors -PLUGIN_CLASS_NAME = IOSSensorPlugin -load(qt_plugin) diff --git a/src/plugins/sensors/linux/CMakeLists.txt b/src/plugins/sensors/linux/CMakeLists.txt new file mode 100644 index 00000000..aa3950ad --- /dev/null +++ b/src/plugins/sensors/linux/CMakeLists.txt @@ -0,0 +1,25 @@ +##################################################################### +## LinuxSensorPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(LinuxSensorPlugin + OUTPUT_NAME qtsensors_linuxsys + TYPE sensors + SOURCES + linuxsysaccelerometer.cpp linuxsysaccelerometer.h + main.cpp + PUBLIC_LIBRARIES + Qt::Core + Qt::Sensors +) + +#### Keys ignored in scope 1:.:.:linux.pro:: +# OTHER_FILES = "plugin.json" + +## Scopes: +##################################################################### + +qt_internal_extend_target(LinuxSensorPlugin CONDITION NOT ANDROID + PUBLIC_LIBRARIES + rt +) diff --git a/src/plugins/sensors/linux/linux.pro b/src/plugins/sensors/linux/linux.pro deleted file mode 100644 index 33706e7d..00000000 --- a/src/plugins/sensors/linux/linux.pro +++ /dev/null @@ -1,13 +0,0 @@ -TARGET = qtsensors_linuxsys -QT = core sensors - -OTHER_FILES = plugin.json - -!android:LIBS += -lrt -HEADERS += linuxsysaccelerometer.h -SOURCES += linuxsysaccelerometer.cpp \ -main.cpp - -PLUGIN_TYPE = sensors -PLUGIN_CLASS_NAME = LinuxSensorPlugin -load(qt_plugin) diff --git a/src/plugins/sensors/sensorfw/CMakeLists.txt b/src/plugins/sensors/sensorfw/CMakeLists.txt new file mode 100644 index 00000000..9b4dceca --- /dev/null +++ b/src/plugins/sensors/sensorfw/CMakeLists.txt @@ -0,0 +1,36 @@ +##################################################################### +## sensorfwSensorPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(sensorfwSensorPlugin + OUTPUT_NAME qtsensors_sensorfw + TYPE sensors + SOURCES + main.cpp + sensorfwaccelerometer.cpp sensorfwaccelerometer.h + sensorfwals.cpp sensorfwals.h + sensorfwcompass.cpp sensorfwcompass.h + sensorfwgyroscope.cpp sensorfwgyroscope.h + sensorfwirproximitysensor.cpp sensorfwirproximitysensor.h + sensorfwlidsensor.cpp sensorfwlidsensor.h + sensorfwlightsensor.cpp sensorfwlightsensor.h + sensorfwmagnetometer.cpp sensorfwmagnetometer.h + sensorfworientationsensor.cpp sensorfworientationsensor.h + sensorfwproximitysensor.cpp sensorfwproximitysensor.h + sensorfwrotationsensor.cpp sensorfwrotationsensor.h + sensorfwsensorbase.cpp sensorfwsensorbase.h + sensorfwtapsensor.cpp sensorfwtapsensor.h + PUBLIC_LIBRARIES + Qt::Core + Qt::DBus + Qt::Network + LIBRARIES + Qt::SensorsPrivate + sensorfw +) + +#### Keys ignored in scope 1:.:.:sensorfw.pro:: +# CONFIGFILES.files = "Sensors.conf" +# CONFIGFILES.path = "/etc/xdg/QtProject/" +# INSTALLS = "CONFIGFILES" +# OTHER_FILES = "plugin.json" diff --git a/src/plugins/sensors/sensorfw/sensorfw.pro b/src/plugins/sensors/sensorfw/sensorfw.pro deleted file mode 100644 index 63a66117..00000000 --- a/src/plugins/sensors/sensorfw/sensorfw.pro +++ /dev/null @@ -1,16 +0,0 @@ -TARGET = qtsensors_sensorfw -QT = core sensors-private network dbus - -include(sensorfw.pri) - -QMAKE_USE += sensorfw - -CONFIGFILES.files = Sensors.conf -CONFIGFILES.path = /etc/xdg/QtProject/ -INSTALLS += CONFIGFILES - -OTHER_FILES = plugin.json - -PLUGIN_TYPE = sensors -PLUGIN_CLASS_NAME = sensorfwSensorPlugin -load(qt_plugin) diff --git a/src/plugins/sensors/sensorfw/sensorfwsensorbase.h b/src/plugins/sensors/sensorfw/sensorfwsensorbase.h index 7e7f5c33..308265fb 100644 --- a/src/plugins/sensors/sensorfw/sensorfwsensorbase.h +++ b/src/plugins/sensors/sensorfw/sensorfwsensorbase.h @@ -101,7 +101,7 @@ protected: int bufferSize() const; virtual qreal correctionFactor() const; bool reinitIsNeeded; - bool isFeatureSupported(QSensor::Feature feature) const; + bool isFeatureSupported(QSensor::Feature feature) const override; private: bool initSensorInterface(QString const &); diff --git a/src/plugins/sensors/sensors.pro b/src/plugins/sensors/sensors.pro deleted file mode 100644 index c637e6ac..00000000 --- a/src/plugins/sensors/sensors.pro +++ /dev/null @@ -1,45 +0,0 @@ -TEMPLATE = subdirs -QT_FOR_CONFIG += sensors-private - -android { - isEmpty(SENSORS_PLUGINS): SENSORS_PLUGINS = android generic -} - -qtConfig(sensorfw) { - isEmpty(SENSORS_PLUGINS): SENSORS_PLUGINS = sensorfw generic -} - -darwin { - isEmpty(SENSORS_PLUGINS): SENSORS_PLUGINS = ios generic -} - -win32 { - isEmpty(SENSORS_PLUGINS): SENSORS_PLUGINS = winrt generic -} - -qtHaveModule(simulator) { - isEmpty(SENSORS_PLUGINS): SENSORS_PLUGINS = simulator generic -} - -linux { - isEmpty(SENSORS_PLUGINS): SENSORS_PLUGINS = linux iio-sensor-proxy generic -} - -contains(CONFIG, sensortag) { - qtHaveModule(bluetooth) { - SENSORS_PLUGINS = sensortag generic - } else { - message("You have configured for sensortag, but Qt Bluetooth module was not found.") - } -} - -contains(SENSORS_PLUGINS, dummy):SUBDIRS += dummy -isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, generic):SUBDIRS += generic -isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, simulator):qtHaveModule(simulator):SUBDIRS += simulator -isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, linux):linux:SUBDIRS += linux -isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, iio-sensor-proxy):linux:qtHaveModule(dbus):SUBDIRS += iio-sensor-proxy -isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, android):android:SUBDIRS += android -isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, sensorfw):sensorfw:SUBDIRS += sensorfw -isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, sensortag):linux:SUBDIRS += sensortag -isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, ios):darwin:SUBDIRS += ios -isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, winrt):SUBDIRS += winrt diff --git a/src/plugins/sensors/sensortag/CMakeLists.txt b/src/plugins/sensors/sensortag/CMakeLists.txt new file mode 100644 index 00000000..4f70d76c --- /dev/null +++ b/src/plugins/sensors/sensortag/CMakeLists.txt @@ -0,0 +1,26 @@ +##################################################################### +## SensortagSensorPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(SensortagSensorPlugin + OUTPUT_NAME qtsensors_sensortag + TYPE sensors + SOURCES + main.cpp + sensortagaccelerometer.cpp sensortagaccelerometer.h + sensortagals.cpp sensortagals.h + sensortagbase.cpp sensortagbase.h + sensortaggyroscope.cpp sensortaggyroscope.h + sensortaghumiditysensor.cpp sensortaghumiditysensor.h + sensortaglightsensor.cpp sensortaglightsensor.h + sensortagmagnetometer.cpp sensortagmagnetometer.h + sensortagpressuresensor.cpp sensortagpressuresensor.h + sensortagtemperaturesensor.cpp sensortagtemperaturesensor.h + PUBLIC_LIBRARIES + Qt::Bluetooth + Qt::Core + Qt::SensorsPrivate +) + +#### Keys ignored in scope 1:.:.:sensortag.pro:: +# OTHER_FILES = "plugin.json" diff --git a/src/plugins/sensors/sensortag/sensortag.pro b/src/plugins/sensors/sensortag/sensortag.pro deleted file mode 100644 index 42252970..00000000 --- a/src/plugins/sensors/sensortag/sensortag.pro +++ /dev/null @@ -1,11 +0,0 @@ -TARGET = qtsensors_sensortag -QT = core sensors-private bluetooth -CONFIG += c++11 - -include(sensortag.pri) - -OTHER_FILES = plugin.json - -PLUGIN_TYPE = sensors -PLUGIN_CLASS_NAME = SensortagSensorPlugin -load(qt_plugin) diff --git a/src/plugins/sensors/simulator/main.cpp b/src/plugins/sensors/simulator/main.cpp deleted file mode 100644 index 167711a9..00000000 --- a/src/plugins/sensors/simulator/main.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "simulatoraccelerometer.h" -#include "simulatorambientlightsensor.h" -#include "simulatorlightsensor.h" -#include "simulatorcompass.h" -#include "simulatorproximitysensor.h" -#include "simulatorirproximitysensor.h" -#include "simulatormagnetometer.h" -#include -#include -#include - -class SimulatorSensorPlugin : 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: - SimulatorSensorPlugin() - { - SensorsConnection *connection = SensorsConnection::instance(); - if (!connection) return; // hardly likely but just in case... - connect(connection, SIGNAL(setAvailableFeatures(quint32)), this, SLOT(setAvailableFeatures(quint32))); - } - - void registerSensors() override - { - QSensorManager::registerBackend(QAccelerometer::type, SimulatorAccelerometer::id, this); - QSensorManager::registerBackend(QAmbientLightSensor::type, SimulatorAmbientLightSensor::id, this); - QSensorManager::registerBackend(QLightSensor::type, SimulatorLightSensor::id, this); - QSensorManager::registerBackend(QCompass::type, SimulatorCompass::id, this); - QSensorManager::registerBackend(QProximitySensor::type, SimulatorProximitySensor::id, this); - QSensorManager::registerBackend(QIRProximitySensor::type, SimulatorIRProximitySensor::id, this); - QSensorManager::registerBackend(QMagnetometer::type, SimulatorMagnetometer::id, this); - } - - QSensorBackend *createBackend(QSensor *sensor) override - { - if (sensor->identifier() == SimulatorAccelerometer::id) { - return new SimulatorAccelerometer(sensor); - } - - if (sensor->identifier() == SimulatorAmbientLightSensor::id) { - return new SimulatorAmbientLightSensor(sensor); - } - - if (sensor->identifier() == SimulatorLightSensor::id) { - return new SimulatorLightSensor(sensor); - } - - if (sensor->identifier() == SimulatorProximitySensor::id) { - return new SimulatorProximitySensor(sensor); - } - - if (sensor->identifier() == SimulatorIRProximitySensor::id) { - return new SimulatorIRProximitySensor(sensor); - } - - if (sensor->identifier() == SimulatorCompass::id) { - return new SimulatorCompass(sensor); - } - - if (sensor->identifier() == SimulatorMagnetometer::id) { - return new SimulatorMagnetometer(sensor); - } - - return 0; - } - - // Copied from the emulator codebase - enum Features { - Accelerometer = 0x01, - Magnetometer = 0x02, - Compass = 0x04, - Infraredsensor = 0x08, - Lightsensor = 0x10 - }; - -public slots: - void setAvailableFeatures(quint32 features) - { - check(features&Accelerometer, QAccelerometer::type, SimulatorAccelerometer::id); - check(features&Lightsensor, QLightSensor::type, SimulatorLightSensor::id); - check(features&Lightsensor, QAmbientLightSensor::type, SimulatorAmbientLightSensor::id); - check(features&Magnetometer, QMagnetometer::type, SimulatorMagnetometer::id); - check(features&Compass, QCompass::type, SimulatorCompass::id); - check(features&Infraredsensor, QIRProximitySensor::type, SimulatorIRProximitySensor::id); - check(features&Infraredsensor, QProximitySensor::type, SimulatorProximitySensor::id); - } - -private: - void check(bool test, const QByteArray &type, const QByteArray &id) - { - if (test) { - if (!QSensorManager::isBackendRegistered(type, id)) - QSensorManager::registerBackend(type, id, this); - } else { - if (QSensorManager::isBackendRegistered(type, id)) - QSensorManager::unregisterBackend(type, id); - } - } -}; - -#include "main.moc" - diff --git a/src/plugins/sensors/simulator/plugin.json b/src/plugins/sensors/simulator/plugin.json deleted file mode 100644 index 77f47afe..00000000 --- a/src/plugins/sensors/simulator/plugin.json +++ /dev/null @@ -1 +0,0 @@ -{ "Keys": [ "simulator" ] } diff --git a/src/plugins/sensors/simulator/qsensordata_simulator.cpp b/src/plugins/sensors/simulator/qsensordata_simulator.cpp deleted file mode 100644 index 3e590d66..00000000 --- a/src/plugins/sensors/simulator/qsensordata_simulator.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qsensordata_simulator_p.h" - -#include - -namespace QtMobility { - -void qt_registerSensorTypes() -{ - qRegisterMetaTypeStreamOperators("QtMobility::QAmbientLightReadingData"); - qRegisterMetaTypeStreamOperators("QtMobility::QLightReadingData"); - qRegisterMetaTypeStreamOperators("QtMobility::QAccelerometerReadingData"); - qRegisterMetaTypeStreamOperators("QtMobility::QCompassReadingData"); - qRegisterMetaTypeStreamOperators("QtMobility::QProximityReadingData"); - qRegisterMetaTypeStreamOperators("QtMobility::QIRProximityReadingData"); - qRegisterMetaTypeStreamOperators("QtMobility::QMagnetometerReadingData"); -} - -QDataStream &operator<<(QDataStream &out, const QAmbientLightReadingData &s) -{ - out << static_cast(s.lightLevel) << s.timestamp; - return out; -} - -QDataStream &operator>>(QDataStream &in, QAmbientLightReadingData &s) -{ - qint32 lightLevel; - in >> lightLevel >> s.timestamp; - s.lightLevel = static_cast(lightLevel); - return in; -} - -QDataStream &operator<<(QDataStream &out, const QLightReadingData &s) -{ - out << s.lux << s.timestamp; - return out; -} - -QDataStream &operator>>(QDataStream &in, QLightReadingData &s) -{ - in >> s.lux >> s.timestamp; - return in; -} - -QDataStream &operator<<(QDataStream &out, const QAccelerometerReadingData &s) -{ - out << s.x << s.y << s.z << s.timestamp; - return out; -} - -QDataStream &operator>>(QDataStream &in, QAccelerometerReadingData &s) -{ - in >> s.x >> s.y >> s.z >> s.timestamp; - return in; -} - -QDataStream &operator<<(QDataStream &out, const QCompassReadingData &s) -{ - out << s.azimuth << s.calibrationLevel << s.timestamp; - return out; -} - -QDataStream &operator>>(QDataStream &in, QCompassReadingData &s) -{ - in >> s.azimuth >> s.calibrationLevel >> s.timestamp; - return in; -} - -QDataStream &operator<<(QDataStream &out, const QProximityReadingData &s) -{ - out << s.close << s.timestamp; - return out; -} - -QDataStream &operator>>(QDataStream &in, QProximityReadingData &s) -{ - in >> s.close >> s.timestamp; - return in; -} - -QDataStream &operator<<(QDataStream &out, const QIRProximityReadingData &s) -{ - out << s.irProximity << s.timestamp; - return out; -} - -QDataStream &operator>>(QDataStream &in, QIRProximityReadingData &s) -{ - in >> s.irProximity >> s.timestamp; - return in; -} - -QDataStream &operator<<(QDataStream &out, const QMagnetometerReadingData &s) -{ - out << s.x << s.y << s.z << s.calibrationLevel << s.timestamp; - return out; -} - -QDataStream &operator>>(QDataStream &in, QMagnetometerReadingData &s) -{ - in >> s.x >> s.y >> s.z >> s.calibrationLevel >> s.timestamp; - return in; -} - -} // namespace diff --git a/src/plugins/sensors/simulator/qsensordata_simulator_p.h b/src/plugins/sensors/simulator/qsensordata_simulator_p.h deleted file mode 100644 index 410078d8..00000000 --- a/src/plugins/sensors/simulator/qsensordata_simulator_p.h +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSENSORDATA_SIMULATOR_P_H -#define QSENSORDATA_SIMULATOR_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -namespace QtMobility { - -enum SimulatorLightLevel { - Undefined = 0, - Dark, - Twilight, - Light, - Bright, - Sunny -}; - -struct QAmbientLightReadingData -{ - SimulatorLightLevel lightLevel; - QDateTime timestamp; -}; - -struct QLightReadingData -{ - double lux; - QDateTime timestamp; -}; - -struct QAccelerometerReadingData -{ - double x; - double y; - double z; - QDateTime timestamp; -}; - -struct QMagnetometerReadingData -{ - double x; - double y; - double z; - double calibrationLevel; - QDateTime timestamp; -}; - -struct QCompassReadingData -{ - double azimuth; - double calibrationLevel; - QDateTime timestamp; -}; - -struct QProximityReadingData -{ - bool close; - QDateTime timestamp; -}; - -struct QIRProximityReadingData -{ - double irProximity; - QDateTime timestamp; -}; - -void qt_registerSensorTypes(); - -} - -Q_DECLARE_METATYPE(QtMobility::QAmbientLightReadingData) -Q_DECLARE_METATYPE(QtMobility::QLightReadingData) -Q_DECLARE_METATYPE(QtMobility::QAccelerometerReadingData) -Q_DECLARE_METATYPE(QtMobility::QMagnetometerReadingData) -Q_DECLARE_METATYPE(QtMobility::QCompassReadingData) -Q_DECLARE_METATYPE(QtMobility::QProximityReadingData) -Q_DECLARE_METATYPE(QtMobility::QIRProximityReadingData) - -#endif // QSENSORDATA_SIMULATOR_P_H diff --git a/src/plugins/sensors/simulator/simulator.pro b/src/plugins/sensors/simulator/simulator.pro deleted file mode 100644 index ac8ea506..00000000 --- a/src/plugins/sensors/simulator/simulator.pro +++ /dev/null @@ -1,32 +0,0 @@ -TARGET = qtsensors_simulator - -QT=core gui network sensors simulator - -HEADERS += \ - simulatorcommon.h\ - simulatoraccelerometer.h\ - simulatorambientlightsensor.h\ - simulatorlightsensor.h\ - simulatorcompass.h\ - simulatorproximitysensor.h\ - simulatorirproximitysensor.h\ - simulatormagnetometer.h\ - qsensordata_simulator_p.h - -SOURCES += \ - simulatorcommon.cpp\ - simulatoraccelerometer.cpp\ - simulatorambientlightsensor.cpp\ - simulatorlightsensor.cpp\ - simulatorcompass.cpp\ - simulatorproximitysensor.cpp\ - simulatorirproximitysensor.cpp\ - simulatormagnetometer.cpp\ - qsensordata_simulator.cpp\ - main.cpp - -OTHER_FILES = plugin.json - -PLUGIN_TYPE = sensors -PLUGIN_CLASS_NAME = SimulatorSensorPlugin -load(qt_plugin) diff --git a/src/plugins/sensors/simulator/simulatoraccelerometer.cpp b/src/plugins/sensors/simulator/simulatoraccelerometer.cpp deleted file mode 100644 index 280fc7ee..00000000 --- a/src/plugins/sensors/simulator/simulatoraccelerometer.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "simulatoraccelerometer.h" -#include -#include - -const char *SimulatorAccelerometer::id("Simulator.Accelerometer"); - -SimulatorAccelerometer::SimulatorAccelerometer(QSensor *sensor) - : SimulatorCommon(sensor) -{ - setReading(&m_reading); -} - -void SimulatorAccelerometer::poll() -{ - QtMobility::QAccelerometerReadingData data = SensorsConnection::instance()->qtAccelerometerData; - quint64 newTimestamp; - if (!data.timestamp.isValid()) - newTimestamp = static_cast(QDateTime::currentMSecsSinceEpoch()) / 1000; - else - newTimestamp = static_cast(data.timestamp.toSecsSinceEpoch()); - if (m_reading.x() != data.x - || m_reading.y() != data.y - || m_reading.z() != data.z) { - m_reading.setTimestamp(newTimestamp); - m_reading.setX(data.x); - m_reading.setY(data.y); - m_reading.setZ(data.z); - - newReadingAvailable(); - } -} - diff --git a/src/plugins/sensors/simulator/simulatoraccelerometer.h b/src/plugins/sensors/simulator/simulatoraccelerometer.h deleted file mode 100644 index a4205867..00000000 --- a/src/plugins/sensors/simulator/simulatoraccelerometer.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SIMULATORACCELEROMETER_H -#define SIMULATORACCELEROMETER_H - -#include "simulatorcommon.h" -#include - -class SimulatorAccelerometer : public SimulatorCommon -{ -public: - static const char *id; - - SimulatorAccelerometer(QSensor *sensor); - - void poll() override; -private: - QAccelerometerReading m_reading; -}; - -#endif - diff --git a/src/plugins/sensors/simulator/simulatorambientlightsensor.cpp b/src/plugins/sensors/simulator/simulatorambientlightsensor.cpp deleted file mode 100644 index 5d84b36c..00000000 --- a/src/plugins/sensors/simulator/simulatorambientlightsensor.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "simulatorambientlightsensor.h" -#include -#include - -const char *SimulatorAmbientLightSensor::id("Simulator.AmbientLightSensor"); - -SimulatorAmbientLightSensor::SimulatorAmbientLightSensor(QSensor *sensor) - : SimulatorCommon(sensor) -{ - setReading(&m_reading); -} - -void SimulatorAmbientLightSensor::poll() -{ - QtMobility::QAmbientLightReadingData data = SensorsConnection::instance()->qtAmbientLightData; - QAmbientLightReading::LightLevel convertedLightLevel; - switch (data.lightLevel) { - case QtMobility::Dark: - convertedLightLevel = QAmbientLightReading::Dark; - break; - case QtMobility::Twilight: - convertedLightLevel = QAmbientLightReading::Twilight; - break; - case QtMobility::Light: - convertedLightLevel = QAmbientLightReading::Light; - break; - case QtMobility::Bright: - convertedLightLevel = QAmbientLightReading::Bright; - break; - case QtMobility::Sunny: - convertedLightLevel = QAmbientLightReading::Sunny; - break; - default: - convertedLightLevel = QAmbientLightReading::Undefined; - break; - } - - quint64 newTimestamp; - if (!data.timestamp.isValid()) - newTimestamp = static_cast(QDateTime::currentMSecsSinceEpoch()) / 1000; - else - newTimestamp = static_cast(data.timestamp.toSecsSinceEpoch()); - if (m_reading.lightLevel() != convertedLightLevel) { - m_reading.setTimestamp(newTimestamp); - m_reading.setLightLevel(convertedLightLevel); - - newReadingAvailable(); - } -} - diff --git a/src/plugins/sensors/simulator/simulatorambientlightsensor.h b/src/plugins/sensors/simulator/simulatorambientlightsensor.h deleted file mode 100644 index 0aadffe6..00000000 --- a/src/plugins/sensors/simulator/simulatorambientlightsensor.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SIMULATORAMBIENTLIGHTSENSOR_H -#define SIMULATORAMBIENTLIGHTSENSOR_H - -#include "simulatorcommon.h" -#include - -class SimulatorAmbientLightSensor : public SimulatorCommon -{ -public: - static const char *id; - - SimulatorAmbientLightSensor(QSensor *sensor); - - void poll() override; -private: - QAmbientLightReading m_reading; -}; - -#endif - diff --git a/src/plugins/sensors/simulator/simulatorcommon.cpp b/src/plugins/sensors/simulator/simulatorcommon.cpp deleted file mode 100644 index a1693364..00000000 --- a/src/plugins/sensors/simulator/simulatorcommon.cpp +++ /dev/null @@ -1,252 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "simulatorcommon.h" -#include "qsensordata_simulator_p.h" -#include -#include -#include - -using namespace Simulator; - -Q_GLOBAL_STATIC(SensorsConnection, sensorsConnection) - -class SimulatorAsyncConnection: public QThread -{ - Q_OBJECT -public: - SimulatorAsyncConnection() - : QThread() - { - QtMobility::qt_registerSensorTypes(); - - moveToThread(this); - connect(this, SIGNAL(queueConnectToServer()), - this, SLOT(doConnectToServer()), - Qt::QueuedConnection); - - start(); - } - - ~SimulatorAsyncConnection() - { - quit(); - wait(); - } - - void connectToServer() - { - emit queueConnectToServer(); - } - -signals: - void queueConnectToServer(); - - void initialSensorsDataSent(); - void connectionFailed(); - void setAvailableFeatures(quint32 features); - void setAmbientLightData(const QtMobility::QAmbientLightReadingData &); - void setLightData(const QtMobility::QLightReadingData &); - void setAccelerometerData(const QtMobility::QAccelerometerReadingData &); - void setMagnetometerData(const QtMobility::QMagnetometerReadingData &); - void setCompassData(const QtMobility::QCompassReadingData &); - void setProximityData(const QtMobility::QProximityReadingData &); - void setIRProximityData(const QtMobility::QIRProximityReadingData &); - -private slots: - void doConnectToServer() - { - mConnection.reset(new Connection(Connection::Client, "QtSimulator_Mobility_ServerName1.3.0.0", - 0xbeef+1, Version(1,0,0,0), this)); - mWorker.reset(mConnection->connectToServer(Connection::simulatorHostName(true), 0xbeef+1)); - if (!mWorker) { - qWarning("QtSensors simulator backend could not connect to the simulator!"); - emit connectionFailed(); - return; - } - mWorker->addReceiver(this); - mWorker->call("setRequestsSensors"); - } - -private: - QScopedPointer mConnection; - QScopedPointer mWorker; -}; - -SensorsConnection::SensorsConnection(QObject *parent) - : QObject(parent) - , mInitialDataSent(false) - , mConnectionFailed(false) -{ - mConnection = new SimulatorAsyncConnection(); - - connect(mConnection, SIGNAL(initialSensorsDataSent()), - this, SLOT(initialSensorsDataSent())); - connect(mConnection, SIGNAL(connectionFailed()), - this, SLOT(slotConnectionFailed())); - connect(mConnection, SIGNAL(setAvailableFeatures(quint32)), - this, SIGNAL(setAvailableFeatures(quint32))); - connect(mConnection, SIGNAL(setAmbientLightData(QtMobility::QAmbientLightReadingData)), - this, SLOT(setAmbientLightData(QtMobility::QAmbientLightReadingData))); - connect(mConnection, SIGNAL(setLightData(QtMobility::QLightReadingData)), - this, SLOT(setLightData(QtMobility::QLightReadingData))); - connect(mConnection, SIGNAL(setAccelerometerData(QtMobility::QAccelerometerReadingData)), - this, SLOT(setAccelerometerData(QtMobility::QAccelerometerReadingData))); - connect(mConnection, SIGNAL(setMagnetometerData(QtMobility::QMagnetometerReadingData)), - this, SLOT(setMagnetometerData(QtMobility::QMagnetometerReadingData))); - connect(mConnection, SIGNAL(setCompassData(QtMobility::QCompassReadingData)), - this, SLOT(setCompassData(QtMobility::QCompassReadingData))); - connect(mConnection, SIGNAL(setProximityData(QtMobility::QProximityReadingData)), - this, SLOT(setProximityData(QtMobility::QProximityReadingData))); - connect(mConnection, SIGNAL(setIRProximityData(QtMobility::QIRProximityReadingData)), - this, SLOT(setIRProximityData(QtMobility::QIRProximityReadingData))); - - mConnection->connectToServer(); -} - -SensorsConnection::~SensorsConnection() -{ - delete mConnection; -} - -SensorsConnection *SensorsConnection::instance() -{ - SensorsConnection *connection = sensorsConnection(); - // It's safe to return 0 because this is checked when used - //if (!connection) qFatal("Cannot return from SensorsConnection::instance because sensorsConnection() returned 0"); - return connection; -} - -void SensorsConnection::setAmbientLightData(const QtMobility::QAmbientLightReadingData &data) -{ - qtAmbientLightData = data; -} - -void SensorsConnection::setLightData(const QtMobility::QLightReadingData &data) -{ - qtLightData = data; -} - -void SensorsConnection::setAccelerometerData(const QtMobility::QAccelerometerReadingData &data) -{ - qtAccelerometerData = data; -} - -void SensorsConnection::setMagnetometerData(const QtMobility::QMagnetometerReadingData &data) -{ - qtMagnetometerData = data; -} - -void SensorsConnection::setCompassData(const QtMobility::QCompassReadingData &data) -{ - qtCompassData = data; -} - -void SensorsConnection::setProximityData(const QtMobility::QProximityReadingData &data) -{ - qtProximityData = data; -} - -void SensorsConnection::setIRProximityData(const QtMobility::QIRProximityReadingData &data) -{ - qtIRProximityData = data; -} - -void SensorsConnection::initialSensorsDataSent() -{ - mInitialDataSent = true; -} - -void SensorsConnection::slotConnectionFailed() -{ - mInitialDataSent = false; - mConnectionFailed = true; -} - -SimulatorCommon::SimulatorCommon(QSensor *sensor) - : QSensorBackend(sensor) - , m_timerid(0) -{ - addDataRate(1, 100); - sensor->setDataRate(20); - (void)SensorsConnection::instance(); // Ensure this exists -} - -void SimulatorCommon::start() -{ - SensorsConnection *connection = SensorsConnection::instance(); - if (!connection) { - sensorStopped(); - return; - } - - if (m_timerid) - return; - - int rate = sensor()->dataRate(); - if (rate == 0) - rate = 20; - int interval = 1000 / rate; - if (interval < 0) - interval = 1000; - - if (interval) - m_timerid = startTimer(interval); -} - -void SimulatorCommon::stop() -{ - if (m_timerid) { - killTimer(m_timerid); - m_timerid = 0; - } -} - -void SimulatorCommon::timerEvent(QTimerEvent * /*event*/) -{ - SensorsConnection *connection = SensorsConnection::instance(); - if (!connection || connection->connectionFailed()) { - stop(); - sensorStopped(); - } - if (!connection->safe()) return; // wait until it's safe to read the data - poll(); -} - -#include "simulatorcommon.moc" diff --git a/src/plugins/sensors/simulator/simulatorcommon.h b/src/plugins/sensors/simulator/simulatorcommon.h deleted file mode 100644 index e47f24d0..00000000 --- a/src/plugins/sensors/simulator/simulatorcommon.h +++ /dev/null @@ -1,105 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SIMULATORCOMMON_H -#define SIMULATORCOMMON_H - -#include -#include "qsensordata_simulator_p.h" - -class QTimer; - -class SimulatorAsyncConnection; - -class SensorsConnection : public QObject -{ - Q_OBJECT -public: - explicit SensorsConnection(QObject *parent = 0); - virtual ~SensorsConnection(); - - static SensorsConnection *instance(); - bool safe() const { return mInitialDataSent; } - bool connectionFailed() const { return mConnectionFailed; } - -signals: - void setAvailableFeatures(quint32 features); - -public slots: - void setAmbientLightData(const QtMobility::QAmbientLightReadingData &); - void setLightData(const QtMobility::QLightReadingData &); - void setAccelerometerData(const QtMobility::QAccelerometerReadingData &); - void setMagnetometerData(const QtMobility::QMagnetometerReadingData &); - void setCompassData(const QtMobility::QCompassReadingData &); - void setProximityData(const QtMobility::QProximityReadingData &); - void setIRProximityData(const QtMobility::QIRProximityReadingData &); - void initialSensorsDataSent(); - void slotConnectionFailed(); - -private: - SimulatorAsyncConnection *mConnection; - bool mInitialDataSent; - bool mConnectionFailed; - -public: - QtMobility::QAmbientLightReadingData qtAmbientLightData; - QtMobility::QLightReadingData qtLightData; - QtMobility::QAccelerometerReadingData qtAccelerometerData; - QtMobility::QMagnetometerReadingData qtMagnetometerData; - QtMobility::QCompassReadingData qtCompassData; - QtMobility::QProximityReadingData qtProximityData; - QtMobility::QIRProximityReadingData qtIRProximityData; -}; - -class SimulatorCommon : public QSensorBackend -{ -public: - SimulatorCommon(QSensor *sensor); - - void start() override; - void stop() override; - virtual void poll() = 0; - void timerEvent(QTimerEvent * /*event*/) override; - -private: - int m_timerid; -}; - -#endif - diff --git a/src/plugins/sensors/simulator/simulatorcompass.cpp b/src/plugins/sensors/simulator/simulatorcompass.cpp deleted file mode 100644 index e9d0f1d7..00000000 --- a/src/plugins/sensors/simulator/simulatorcompass.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "simulatorcompass.h" -#include -#include - -const char *SimulatorCompass::id("Simulator.Compass"); - -SimulatorCompass::SimulatorCompass(QSensor *sensor) - : SimulatorCommon(sensor) -{ - setReading(&m_reading); -} - -void SimulatorCompass::poll() -{ - QtMobility::QCompassReadingData data = SensorsConnection::instance()->qtCompassData; - quint64 newTimestamp; - if (!data.timestamp.isValid()) - newTimestamp = static_cast(QDateTime::currentMSecsSinceEpoch()) / 1000; - else - newTimestamp = static_cast(data.timestamp.toSecsSinceEpoch()); - if (m_reading.azimuth() != data.azimuth - || m_reading.calibrationLevel() != data.calibrationLevel) { - m_reading.setTimestamp(newTimestamp); - m_reading.setAzimuth(data.azimuth); - m_reading.setCalibrationLevel(data.calibrationLevel); - - newReadingAvailable(); - } -} - diff --git a/src/plugins/sensors/simulator/simulatorcompass.h b/src/plugins/sensors/simulator/simulatorcompass.h deleted file mode 100644 index 69162c69..00000000 --- a/src/plugins/sensors/simulator/simulatorcompass.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SIMULATORCOMPASS_H -#define SIMULATORCOMPASS_H - -#include "simulatorcommon.h" -#include - -class SimulatorCompass : public SimulatorCommon -{ -public: - static const char *id; - - SimulatorCompass(QSensor *sensor); - - void poll() override; -private: - QCompassReading m_reading; -}; - -#endif - diff --git a/src/plugins/sensors/simulator/simulatorirproximitysensor.cpp b/src/plugins/sensors/simulator/simulatorirproximitysensor.cpp deleted file mode 100644 index d041a86d..00000000 --- a/src/plugins/sensors/simulator/simulatorirproximitysensor.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "simulatorirproximitysensor.h" -#include -#include - -const char *SimulatorIRProximitySensor::id("Simulator.IRProximitySensor"); - -SimulatorIRProximitySensor::SimulatorIRProximitySensor(QSensor *sensor) - : SimulatorCommon(sensor) -{ - setReading(&m_reading); -} - -void SimulatorIRProximitySensor::poll() -{ - QtMobility::QIRProximityReadingData data = SensorsConnection::instance()->qtIRProximityData; - quint64 newTimestamp; - if (!data.timestamp.isValid()) - newTimestamp = static_cast(QDateTime::currentMSecsSinceEpoch()) / 1000; - else - newTimestamp = static_cast(data.timestamp.toSecsSinceEpoch()); - if (m_reading.reflectance() != data.irProximity) { - m_reading.setTimestamp(newTimestamp); - m_reading.setReflectance(data.irProximity); - - newReadingAvailable(); - } -} - diff --git a/src/plugins/sensors/simulator/simulatorirproximitysensor.h b/src/plugins/sensors/simulator/simulatorirproximitysensor.h deleted file mode 100644 index db20968b..00000000 --- a/src/plugins/sensors/simulator/simulatorirproximitysensor.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SIMULATORIRPROXIMITYSENSOR_H -#define SIMULATORIRPROXIMITYSENSOR_H - -#include "simulatorcommon.h" -#include - -class SimulatorIRProximitySensor : public SimulatorCommon -{ -public: - static const char *id; - - SimulatorIRProximitySensor(QSensor *sensor); - - void poll() override; -private: - QIRProximityReading m_reading; -}; - -#endif - diff --git a/src/plugins/sensors/simulator/simulatorlightsensor.cpp b/src/plugins/sensors/simulator/simulatorlightsensor.cpp deleted file mode 100644 index bb4dd94d..00000000 --- a/src/plugins/sensors/simulator/simulatorlightsensor.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "simulatorlightsensor.h" -#include -#include - -const char *SimulatorLightSensor::id("Simulator.LightSensor"); - -SimulatorLightSensor::SimulatorLightSensor(QSensor *sensor) - : SimulatorCommon(sensor) -{ - setReading(&m_reading); -} - -void SimulatorLightSensor::poll() -{ - QtMobility::QLightReadingData data = SensorsConnection::instance()->qtLightData; - quint64 newTimestamp; - if (!data.timestamp.isValid()) - newTimestamp = static_cast(QDateTime::currentMSecsSinceEpoch()) / 1000; - else - newTimestamp = static_cast(data.timestamp.toSecsSinceEpoch()); - if (m_reading.lux() != data.lux) { - m_reading.setTimestamp(newTimestamp); - m_reading.setLux(data.lux); - - newReadingAvailable(); - } -} - diff --git a/src/plugins/sensors/simulator/simulatorlightsensor.h b/src/plugins/sensors/simulator/simulatorlightsensor.h deleted file mode 100644 index 3af3a526..00000000 --- a/src/plugins/sensors/simulator/simulatorlightsensor.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SIMULATORLIGHTSENSOR_H -#define SIMULATORLIGHTSENSOR_H - -#include "simulatorcommon.h" -#include - -class SimulatorLightSensor : public SimulatorCommon -{ -public: - static const char *id; - - SimulatorLightSensor(QSensor *sensor); - - void poll() override; -private: - QLightReading m_reading; -}; - -#endif - diff --git a/src/plugins/sensors/simulator/simulatormagnetometer.cpp b/src/plugins/sensors/simulator/simulatormagnetometer.cpp deleted file mode 100644 index b54525ab..00000000 --- a/src/plugins/sensors/simulator/simulatormagnetometer.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "simulatormagnetometer.h" -#include -#include - -const char *SimulatorMagnetometer::id("Simulator.Magnetometer"); - -SimulatorMagnetometer::SimulatorMagnetometer(QSensor *sensor) - : SimulatorCommon(sensor) -{ - setReading(&m_reading); -} - -void SimulatorMagnetometer::poll() -{ - QtMobility::QMagnetometerReadingData data = SensorsConnection::instance()->qtMagnetometerData; - quint64 newTimestamp; - if (!data.timestamp.isValid()) - newTimestamp = static_cast(QDateTime::currentMSecsSinceEpoch()) / 1000; - else - newTimestamp = static_cast(data.timestamp.toSecsSinceEpoch()); - if (m_reading.x() != data.x - || m_reading.y() != data.y - || m_reading.z() != data.z - || m_reading.calibrationLevel() != data.calibrationLevel) { - m_reading.setTimestamp(newTimestamp); - m_reading.setX(data.x); - m_reading.setY(data.y); - m_reading.setZ(data.z); - m_reading.setCalibrationLevel(data.calibrationLevel); - - newReadingAvailable(); - } -} - diff --git a/src/plugins/sensors/simulator/simulatormagnetometer.h b/src/plugins/sensors/simulator/simulatormagnetometer.h deleted file mode 100644 index facbad41..00000000 --- a/src/plugins/sensors/simulator/simulatormagnetometer.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SIMULATORMAGNETOMETER_H -#define SIMULATORMAGNETOMETER_H - -#include "simulatorcommon.h" -#include - -class SimulatorMagnetometer : public SimulatorCommon -{ -public: - static const char *id; - - SimulatorMagnetometer(QSensor *sensor); - - void poll() override; -private: - QMagnetometerReading m_reading; -}; - -#endif - diff --git a/src/plugins/sensors/simulator/simulatorproximitysensor.cpp b/src/plugins/sensors/simulator/simulatorproximitysensor.cpp deleted file mode 100644 index 6a28ce52..00000000 --- a/src/plugins/sensors/simulator/simulatorproximitysensor.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "simulatorproximitysensor.h" -#include -#include - -const char *SimulatorProximitySensor::id("Simulator.ProximitySensor"); - -SimulatorProximitySensor::SimulatorProximitySensor(QSensor *sensor) - : SimulatorCommon(sensor) -{ - setReading(&m_reading); -} - -void SimulatorProximitySensor::poll() -{ - QtMobility::QProximityReadingData data = SensorsConnection::instance()->qtProximityData; - quint64 newTimestamp; - if (!data.timestamp.isValid()) - newTimestamp = static_cast(QDateTime::currentMSecsSinceEpoch() / 1000; - else - newTimestamp = static_cast(data.timestamp.toSecsSinceEpoch(); - if (m_reading.close() != data.close) { - m_reading.setTimestamp(newTimestamp); - m_reading.setClose(data.close); - - newReadingAvailable(); - } -} - diff --git a/src/plugins/sensors/simulator/simulatorproximitysensor.h b/src/plugins/sensors/simulator/simulatorproximitysensor.h deleted file mode 100644 index 16e6f6bb..00000000 --- a/src/plugins/sensors/simulator/simulatorproximitysensor.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SIMULATORPROXIMITYSENSOR_H -#define SIMULATORPROXIMITYSENSOR_H - -#include "simulatorcommon.h" -#include - -class SimulatorProximitySensor : public SimulatorCommon -{ -public: - static const char *id; - - SimulatorProximitySensor(QSensor *sensor); - - void poll() override; -private: - QProximityReading m_reading; -}; - -#endif - diff --git a/src/plugins/sensors/winrt/CMakeLists.txt b/src/plugins/sensors/winrt/CMakeLists.txt new file mode 100644 index 00000000..2099547e --- /dev/null +++ b/src/plugins/sensors/winrt/CMakeLists.txt @@ -0,0 +1,26 @@ +##################################################################### +## WinRtSensorPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(WinRtSensorPlugin + OUTPUT_NAME qtsensors_winrt + TYPE sensors + SOURCES + main.cpp + winrtaccelerometer.cpp winrtaccelerometer.h + winrtambientlightsensor.cpp winrtambientlightsensor.h + winrtcommon.cpp winrtcommon.h + winrtcompass.cpp winrtcompass.h + winrtgyroscope.cpp winrtgyroscope.h + winrtorientationsensor.cpp winrtorientationsensor.h + winrtrotationsensor.cpp winrtrotationsensor.h + PUBLIC_LIBRARIES + Qt::Core + Qt::Sensors + LIBRARIES + Qt::CorePrivate + runtimeobject +) + +#### Keys ignored in scope 1:.:.:winrt.pro:: +# OTHER_FILES = "plugin.json" diff --git a/src/plugins/sensors/winrt/winrt.pro b/src/plugins/sensors/winrt/winrt.pro deleted file mode 100644 index 0de6293b..00000000 --- a/src/plugins/sensors/winrt/winrt.pro +++ /dev/null @@ -1,29 +0,0 @@ -TARGET = qtsensors_winrt -QT = sensors core core_private - -HEADERS += \ - winrtaccelerometer.h \ - winrtambientlightsensor.h \ - winrtcommon.h \ - winrtcompass.h \ - winrtorientationsensor.h \ - winrtrotationsensor.h \ - winrtgyroscope.h - -SOURCES += \ - main.cpp \ - winrtaccelerometer.cpp \ - winrtambientlightsensor.cpp \ - winrtcommon.cpp \ - winrtcompass.cpp \ - winrtorientationsensor.cpp \ - winrtrotationsensor.cpp \ - winrtgyroscope.cpp - -OTHER_FILES = plugin.json - -LIBS += runtimeobject.lib - -PLUGIN_TYPE = sensors -PLUGIN_CLASS_NAME = WinRtSensorPlugin -load(qt_plugin) -- cgit v1.2.3