summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt8
-rw-r--r--src/imports/imports.pro4
-rw-r--r--src/imports/sensors/plugin.json1
-rw-r--r--src/imports/sensors/plugins.qmltypes613
-rw-r--r--src/imports/sensors/qmlaccelerometer.h107
-rw-r--r--src/imports/sensors/qmlaltimeter.cpp131
-rw-r--r--src/imports/sensors/qmlaltimeter.h84
-rw-r--r--src/imports/sensors/qmlambientlightsensor.h86
-rw-r--r--src/imports/sensors/qmlambienttemperaturesensor.cpp131
-rw-r--r--src/imports/sensors/qmlambienttemperaturesensor.h84
-rw-r--r--src/imports/sensors/qmlcompass.cpp148
-rw-r--r--src/imports/sensors/qmlcompass.h88
-rw-r--r--src/imports/sensors/qmldir4
-rw-r--r--src/imports/sensors/qmldistancesensor.cpp131
-rw-r--r--src/imports/sensors/qmldistancesensor.h85
-rw-r--r--src/imports/sensors/qmlgyroscope.cpp164
-rw-r--r--src/imports/sensors/qmlgyroscope.h92
-rw-r--r--src/imports/sensors/qmlholstersensor.cpp131
-rw-r--r--src/imports/sensors/qmlholstersensor.h84
-rw-r--r--src/imports/sensors/qmlhumiditysensor.cpp150
-rw-r--r--src/imports/sensors/qmlhumiditysensor.h90
-rw-r--r--src/imports/sensors/qmlirproximitysensor.cpp129
-rw-r--r--src/imports/sensors/qmlirproximitysensor.h83
-rw-r--r--src/imports/sensors/qmllidsensor.cpp149
-rw-r--r--src/imports/sensors/qmllidsensor.h88
-rw-r--r--src/imports/sensors/qmllightsensor.cpp145
-rw-r--r--src/imports/sensors/qmllightsensor.h89
-rw-r--r--src/imports/sensors/qmlmagnetometer.h102
-rw-r--r--src/imports/sensors/qmlorientationsensor.h86
-rw-r--r--src/imports/sensors/qmlpressuresensor.cpp151
-rw-r--r--src/imports/sensors/qmlpressuresensor.h88
-rw-r--r--src/imports/sensors/qmlproximitysensor.cpp131
-rw-r--r--src/imports/sensors/qmlproximitysensor.h86
-rw-r--r--src/imports/sensors/qmlrotationsensor.h98
-rw-r--r--src/imports/sensors/qmlsensorgesture.cpp262
-rw-r--r--src/imports/sensors/qmlsensorgesture.h100
-rw-r--r--src/imports/sensors/qmlsensorglobal.cpp121
-rw-r--r--src/imports/sensors/qmlsensorglobal.h70
-rw-r--r--src/imports/sensors/qmlsensorrange.cpp88
-rw-r--r--src/imports/sensors/qmlsensorrange.h94
-rw-r--r--src/imports/sensors/qmltapsensor.h96
-rw-r--r--src/imports/sensors/qmltiltsensor.cpp163
-rw-r--r--src/imports/sensors/qmltiltsensor.h90
-rw-r--r--src/imports/sensors/sensors.cpp244
-rw-r--r--src/imports/sensors/sensors.pro56
-rw-r--r--src/plugins/CMakeLists.txt1
-rw-r--r--src/plugins/plugins.pro3
-rw-r--r--src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.cpp144
-rw-r--r--src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.h84
-rw-r--r--src/plugins/sensorgestures/qtsensors/qdoubletapsensorgesturerecognizer.cpp99
-rw-r--r--src/plugins/sensorgestures/qtsensors/qdoubletapsensorgesturerecognizer.h78
-rw-r--r--src/plugins/sensorgestures/qtsensors/qfreefallsensorgesturerecognizer.cpp123
-rw-r--r--src/plugins/sensorgestures/qtsensors/qfreefallsensorgesturerecognizer.h80
-rw-r--r--src/plugins/sensorgestures/qtsensors/qhoversensorgesturerecognizer.cpp222
-rw-r--r--src/plugins/sensorgestures/qtsensors/qhoversensorgesturerecognizer.h92
-rw-r--r--src/plugins/sensorgestures/qtsensors/qpickupsensorgesturerecognizer.cpp213
-rw-r--r--src/plugins/sensorgestures/qtsensors/qpickupsensorgesturerecognizer.h87
-rw-r--r--src/plugins/sensorgestures/qtsensors/qshake2recognizer.cpp231
-rw-r--r--src/plugins/sensorgestures/qtsensors/qshake2recognizer.h116
-rw-r--r--src/plugins/sensorgestures/qtsensors/qslamgesturerecognizer.cpp215
-rw-r--r--src/plugins/sensorgestures/qtsensors/qslamgesturerecognizer.h100
-rw-r--r--src/plugins/sensorgestures/qtsensors/qtsensorgestureplugin.cpp113
-rw-r--r--src/plugins/sensorgestures/qtsensors/qtsensorgestureplugin.h68
-rw-r--r--src/plugins/sensorgestures/qtsensors/qtsensorgesturesensorhandler.cpp193
-rw-r--r--src/plugins/sensorgestures/qtsensors/qtsensorgesturesensorhandler.h98
-rw-r--r--src/plugins/sensorgestures/qtsensors/qtsensors.pro37
-rw-r--r--src/plugins/sensorgestures/qtsensors/qturnoversensorgesturerecognizer.cpp139
-rw-r--r--src/plugins/sensorgestures/qtsensors/qturnoversensorgesturerecognizer.h80
-rw-r--r--src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.cpp291
-rw-r--r--src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.h96
-rw-r--r--src/plugins/sensorgestures/qtsensors/qwhipsensorgesturerecognizer.cpp241
-rw-r--r--src/plugins/sensorgestures/qtsensors/qwhipsensorgesturerecognizer.h100
-rw-r--r--src/plugins/sensorgestures/sensorgestures.pro2
-rw-r--r--src/plugins/sensorgestures/shake/qshakerecognizer.cpp160
-rw-r--r--src/plugins/sensorgestures/shake/qshakerecognizer.h98
-rw-r--r--src/plugins/sensorgestures/shake/qshakesensorgestureplugin.cpp74
-rw-r--r--src/plugins/sensorgestures/shake/qshakesensorgestureplugin.h65
-rw-r--r--src/plugins/sensorgestures/shake/shake.pro16
-rw-r--r--src/plugins/sensors/CMakeLists.txt30
-rw-r--r--src/plugins/sensors/android/CMakeLists.txt35
-rw-r--r--src/plugins/sensors/android/android.pro41
-rw-r--r--src/plugins/sensors/android/androidaccelerometer.cpp40
-rw-r--r--src/plugins/sensors/android/androidaccelerometer.h40
-rw-r--r--src/plugins/sensors/android/androidcompass.cpp58
-rw-r--r--src/plugins/sensors/android/androidcompass.h40
-rw-r--r--src/plugins/sensors/android/androidgyroscope.cpp40
-rw-r--r--src/plugins/sensors/android/androidgyroscope.h40
-rw-r--r--src/plugins/sensors/android/androidlight.cpp40
-rw-r--r--src/plugins/sensors/android/androidlight.h40
-rw-r--r--src/plugins/sensors/android/androidmagnetometer.cpp40
-rw-r--r--src/plugins/sensors/android/androidmagnetometer.h40
-rw-r--r--src/plugins/sensors/android/androidpressure.cpp40
-rw-r--r--src/plugins/sensors/android/androidpressure.h40
-rw-r--r--src/plugins/sensors/android/androidproximity.cpp42
-rw-r--r--src/plugins/sensors/android/androidproximity.h42
-rw-r--r--src/plugins/sensors/android/androidrotation.cpp81
-rw-r--r--src/plugins/sensors/android/androidrotation.h40
-rw-r--r--src/plugins/sensors/android/androidtemperature.cpp40
-rw-r--r--src/plugins/sensors/android/androidtemperature.h40
-rw-r--r--src/plugins/sensors/android/main.cpp58
-rw-r--r--src/plugins/sensors/android/qt_attribution.json12
-rw-r--r--src/plugins/sensors/android/sensoreventqueue.h43
-rw-r--r--src/plugins/sensors/android/sensormanager.cpp80
-rw-r--r--src/plugins/sensors/android/sensormanager.h57
-rw-r--r--src/plugins/sensors/dummy/CMakeLists.txt30
-rw-r--r--src/plugins/sensors/dummy/dummy.pro19
-rw-r--r--src/plugins/sensors/dummy/dummyaccelerometer.cpp40
-rw-r--r--src/plugins/sensors/dummy/dummyaccelerometer.h40
-rw-r--r--src/plugins/sensors/dummy/dummycommon.cpp42
-rw-r--r--src/plugins/sensors/dummy/dummycommon.h40
-rw-r--r--src/plugins/sensors/dummy/dummylightsensor.cpp40
-rw-r--r--src/plugins/sensors/dummy/dummylightsensor.h40
-rw-r--r--src/plugins/sensors/dummy/main.cpp44
-rw-r--r--src/plugins/sensors/generic/CMakeLists.txt36
-rw-r--r--src/plugins/sensors/generic/generic.pro29
-rw-r--r--src/plugins/sensors/generic/genericalssensor.cpp40
-rw-r--r--src/plugins/sensors/generic/genericalssensor.h40
-rw-r--r--src/plugins/sensors/generic/genericorientationsensor.cpp40
-rw-r--r--src/plugins/sensors/generic/genericorientationsensor.h40
-rw-r--r--src/plugins/sensors/generic/genericrotationsensor.cpp40
-rw-r--r--src/plugins/sensors/generic/genericrotationsensor.h40
-rw-r--r--src/plugins/sensors/generic/generictiltsensor.cpp42
-rw-r--r--src/plugins/sensors/generic/generictiltsensor.h40
-rw-r--r--src/plugins/sensors/generic/main.cpp77
-rw-r--r--src/plugins/sensors/iio-sensor-proxy/CMakeLists.txt50
-rw-r--r--src/plugins/sensors/iio-sensor-proxy/iio-sensor-proxy.pro31
-rw-r--r--src/plugins/sensors/iio-sensor-proxy/iiosensorproxycompass.cpp42
-rw-r--r--src/plugins/sensors/iio-sensor-proxy/iiosensorproxycompass.h42
-rw-r--r--src/plugins/sensors/iio-sensor-proxy/iiosensorproxylightsensor.cpp42
-rw-r--r--src/plugins/sensors/iio-sensor-proxy/iiosensorproxylightsensor.h42
-rw-r--r--src/plugins/sensors/iio-sensor-proxy/iiosensorproxyorientationsensor.cpp42
-rw-r--r--src/plugins/sensors/iio-sensor-proxy/iiosensorproxyorientationsensor.h42
-rw-r--r--src/plugins/sensors/iio-sensor-proxy/iiosensorproxysensorbase.cpp42
-rw-r--r--src/plugins/sensors/iio-sensor-proxy/iiosensorproxysensorbase.h42
-rw-r--r--src/plugins/sensors/iio-sensor-proxy/main.cpp54
-rw-r--r--src/plugins/sensors/iio-sensor-proxy/org.freedesktop.DBus.Properties.xml2
-rw-r--r--src/plugins/sensors/ios/CMakeLists.txt59
-rw-r--r--src/plugins/sensors/ios/ios.pro49
-rw-r--r--src/plugins/sensors/ios/iosaccelerometer.h40
-rw-r--r--src/plugins/sensors/ios/iosaccelerometer.mm40
-rw-r--r--src/plugins/sensors/ios/ioscompass.h40
-rw-r--r--src/plugins/sensors/ios/ioscompass.mm40
-rw-r--r--src/plugins/sensors/ios/iosgyroscope.h40
-rw-r--r--src/plugins/sensors/ios/iosgyroscope.mm40
-rw-r--r--src/plugins/sensors/ios/iosmagnetometer.h40
-rw-r--r--src/plugins/sensors/ios/iosmagnetometer.mm44
-rw-r--r--src/plugins/sensors/ios/iosmotionmanager.h40
-rw-r--r--src/plugins/sensors/ios/iosmotionmanager.mm40
-rw-r--r--src/plugins/sensors/ios/iospressure.h37
-rw-r--r--src/plugins/sensors/ios/iospressure.mm65
-rw-r--r--src/plugins/sensors/ios/iosproximitysensor.h40
-rw-r--r--src/plugins/sensors/ios/iosproximitysensor.mm40
-rw-r--r--src/plugins/sensors/ios/main.mm55
-rw-r--r--src/plugins/sensors/linux/linux.pro13
-rw-r--r--src/plugins/sensors/linux/linuxsysaccelerometer.cpp188
-rw-r--r--src/plugins/sensors/linux/linuxsysaccelerometer.h74
-rw-r--r--src/plugins/sensors/linux/main.cpp72
-rw-r--r--src/plugins/sensors/linux/plugin.json1
-rw-r--r--src/plugins/sensors/sensorfw/CMakeLists.txt38
-rw-r--r--src/plugins/sensors/sensorfw/main.cpp40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfw.pro16
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwaccelerometer.cpp45
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwaccelerometer.h44
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwals.cpp40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwals.h40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwcompass.cpp40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwcompass.h40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwgyroscope.cpp45
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwgyroscope.h45
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwirproximitysensor.cpp40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwirproximitysensor.h40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwlidsensor.cpp40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwlidsensor.h40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwlightsensor.cpp40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwlightsensor.h40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwmagnetometer.cpp47
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwmagnetometer.h45
-rw-r--r--src/plugins/sensors/sensorfw/sensorfworientationsensor.cpp40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfworientationsensor.h40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwproximitysensor.cpp40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwproximitysensor.h40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwrotationsensor.cpp45
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwrotationsensor.h43
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwsensorbase.cpp47
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwsensorbase.h42
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwtapsensor.cpp40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwtapsensor.h40
-rw-r--r--src/plugins/sensors/sensors.pro45
-rw-r--r--src/plugins/sensors/sensortag/Sensors.conf13
-rw-r--r--src/plugins/sensors/sensortag/main.cpp113
-rw-r--r--src/plugins/sensors/sensortag/plugin.json1
-rw-r--r--src/plugins/sensors/sensortag/sensortag.pri22
-rw-r--r--src/plugins/sensors/sensortag/sensortag.pro11
-rw-r--r--src/plugins/sensors/sensortag/sensortagaccelerometer.cpp82
-rw-r--r--src/plugins/sensors/sensortag/sensortagaccelerometer.h68
-rw-r--r--src/plugins/sensors/sensortag/sensortagals.cpp97
-rw-r--r--src/plugins/sensors/sensortag/sensortagals.h68
-rw-r--r--src/plugins/sensors/sensortag/sensortagbase.cpp600
-rw-r--r--src/plugins/sensors/sensortag/sensortagbase.h252
-rw-r--r--src/plugins/sensors/sensortag/sensortaggyroscope.cpp84
-rw-r--r--src/plugins/sensors/sensortag/sensortaggyroscope.h67
-rw-r--r--src/plugins/sensors/sensortag/sensortaghumiditysensor.cpp74
-rw-r--r--src/plugins/sensors/sensortag/sensortaghumiditysensor.h62
-rw-r--r--src/plugins/sensors/sensortag/sensortaglightsensor.cpp78
-rw-r--r--src/plugins/sensors/sensortag/sensortaglightsensor.h66
-rw-r--r--src/plugins/sensors/sensortag/sensortagmagnetometer.cpp80
-rw-r--r--src/plugins/sensors/sensortag/sensortagmagnetometer.h69
-rw-r--r--src/plugins/sensors/sensortag/sensortagpressuresensor.cpp73
-rw-r--r--src/plugins/sensors/sensortag/sensortagpressuresensor.h65
-rw-r--r--src/plugins/sensors/sensortag/sensortagtemperaturesensor.cpp73
-rw-r--r--src/plugins/sensors/sensortag/sensortagtemperaturesensor.h62
-rw-r--r--src/plugins/sensors/simulator/main.cpp143
-rw-r--r--src/plugins/sensors/simulator/plugin.json1
-rw-r--r--src/plugins/sensors/simulator/qsensordata_simulator.cpp143
-rw-r--r--src/plugins/sensors/simulator/qsensordata_simulator_p.h128
-rw-r--r--src/plugins/sensors/simulator/simulator.pro32
-rw-r--r--src/plugins/sensors/simulator/simulatoraccelerometer.cpp71
-rw-r--r--src/plugins/sensors/simulator/simulatoraccelerometer.h59
-rw-r--r--src/plugins/sensors/simulator/simulatorambientlightsensor.cpp89
-rw-r--r--src/plugins/sensors/simulator/simulatorambientlightsensor.h59
-rw-r--r--src/plugins/sensors/simulator/simulatorcommon.cpp252
-rw-r--r--src/plugins/sensors/simulator/simulatorcommon.h105
-rw-r--r--src/plugins/sensors/simulator/simulatorcompass.cpp69
-rw-r--r--src/plugins/sensors/simulator/simulatorcompass.h59
-rw-r--r--src/plugins/sensors/simulator/simulatorirproximitysensor.cpp67
-rw-r--r--src/plugins/sensors/simulator/simulatorirproximitysensor.h59
-rw-r--r--src/plugins/sensors/simulator/simulatorlightsensor.cpp67
-rw-r--r--src/plugins/sensors/simulator/simulatorlightsensor.h59
-rw-r--r--src/plugins/sensors/simulator/simulatormagnetometer.cpp73
-rw-r--r--src/plugins/sensors/simulator/simulatormagnetometer.h59
-rw-r--r--src/plugins/sensors/simulator/simulatorproximitysensor.cpp67
-rw-r--r--src/plugins/sensors/simulator/simulatorproximitysensor.h59
-rw-r--r--src/plugins/sensors/winrt/CMakeLists.txt32
-rw-r--r--src/plugins/sensors/winrt/main.cpp63
-rw-r--r--src/plugins/sensors/winrt/winrt.pro27
-rw-r--r--src/plugins/sensors/winrt/winrtaccelerometer.cpp87
-rw-r--r--src/plugins/sensors/winrt/winrtaccelerometer.h40
-rw-r--r--src/plugins/sensors/winrt/winrtambientlightsensor.cpp84
-rw-r--r--src/plugins/sensors/winrt/winrtambientlightsensor.h40
-rw-r--r--src/plugins/sensors/winrt/winrtcommon.cpp40
-rw-r--r--src/plugins/sensors/winrt/winrtcommon.h40
-rw-r--r--src/plugins/sensors/winrt/winrtcompass.cpp86
-rw-r--r--src/plugins/sensors/winrt/winrtcompass.h40
-rw-r--r--src/plugins/sensors/winrt/winrtgyroscope.cpp88
-rw-r--r--src/plugins/sensors/winrt/winrtgyroscope.h42
-rw-r--r--src/plugins/sensors/winrt/winrtorientationsensor.cpp83
-rw-r--r--src/plugins/sensors/winrt/winrtorientationsensor.h40
-rw-r--r--src/plugins/sensors/winrt/winrtrotationsensor.cpp85
-rw-r--r--src/plugins/sensors/winrt/winrtrotationsensor.h42
-rw-r--r--src/sensors/CMakeLists.txt95
-rw-r--r--src/sensors/configure.cmake58
-rw-r--r--src/sensors/doc/images/sensorgesture-cover.pngbin23183 -> 0 bytes
-rw-r--r--src/sensors/doc/images/sensorgesture-doubletap.pngbin30073 -> 0 bytes
-rw-r--r--src/sensors/doc/images/sensorgesture-facedown.pngbin17917 -> 0 bytes
-rw-r--r--src/sensors/doc/images/sensorgesture-faceup.pngbin35115 -> 0 bytes
-rw-r--r--src/sensors/doc/images/sensorgesture-flat.pngbin21828 -> 0 bytes
-rw-r--r--src/sensors/doc/images/sensorgesture-hover.pngbin22512 -> 0 bytes
-rw-r--r--src/sensors/doc/images/sensorgesture-shake.pngbin34512 -> 0 bytes
-rw-r--r--src/sensors/doc/images/sensorgesture-slam_1.pngbin26212 -> 0 bytes
-rw-r--r--src/sensors/doc/images/sensorgesture-slam_2.pngbin29763 -> 0 bytes
-rw-r--r--src/sensors/doc/images/sensorgesture-twist.pngbin29643 -> 0 bytes
-rw-r--r--src/sensors/doc/images/sensorgesture-whip.pngbin32058 -> 0 bytes
-rw-r--r--src/sensors/doc/qtsensors-module-use.qdocinc15
-rw-r--r--src/sensors/doc/qtsensors.qdocconf25
-rw-r--r--src/sensors/doc/snippets/sensorgestures/creating.cpp72
-rw-r--r--src/sensors/doc/snippets/sensorgestures/main.cpp44
-rw-r--r--src/sensors/doc/snippets/sensorgestures/myplugin.h82
-rw-r--r--src/sensors/doc/snippets/sensorgestures/plugin.cpp99
-rw-r--r--src/sensors/doc/snippets/sensorgestures/sensorgestures.pro8
-rw-r--r--src/sensors/doc/snippets/sensors/CMakeLists.txt32
-rw-r--r--src/sensors/doc/snippets/sensors/creating.cpp44
-rw-r--r--src/sensors/doc/snippets/sensors/main.cpp40
-rw-r--r--src/sensors/doc/snippets/sensors/mybackend.h40
-rw-r--r--src/sensors/doc/snippets/sensors/plugin.cpp42
-rw-r--r--src/sensors/doc/snippets/sensors/sensors.pro10
-rw-r--r--src/sensors/doc/snippets/sensors/start.cpp84
-rw-r--r--src/sensors/doc/snippets/sensors/tutorial.cpp25
-rw-r--r--src/sensors/doc/snippets/snippets.pro5
-rw-r--r--src/sensors/doc/src/compatmap.qdoc281
-rw-r--r--src/sensors/doc/src/genericbackend.qdoc28
-rw-r--r--src/sensors/doc/src/porting.qdoc126
-rw-r--r--src/sensors/doc/src/qt6-changes.qdoc94
-rw-r--r--src/sensors/doc/src/qtsensorgestures-cpp.qdoc70
-rw-r--r--src/sensors/doc/src/qtsensorgestures-emulator.qdoc49
-rw-r--r--src/sensors/doc/src/qtsensorgestures-plugins.qdoc167
-rw-r--r--src/sensors/doc/src/qtsensors-backend.qdoc53
-rw-r--r--src/sensors/doc/src/qtsensors-cpp.qdoc43
-rw-r--r--src/sensors/doc/src/qtsensors-modules.qdoc58
-rw-r--r--src/sensors/doc/src/qtsensors-tutorial.qdoc36
-rw-r--r--src/sensors/doc/src/qtsensors.qdoc180
-rw-r--r--src/sensors/doc/src/qtsensors5.qdoc80
-rw-r--r--src/sensors/doc/src/sensor-examples.qdoc29
-rw-r--r--src/sensors/doc/src/sensorfwbackend.qdoc28
-rw-r--r--src/sensors/gestures/qsensorgesture.cpp250
-rw-r--r--src/sensors/gestures/qsensorgesture.h92
-rw-r--r--src/sensors/gestures/qsensorgesture_p.h85
-rw-r--r--src/sensors/gestures/qsensorgesturemanager.cpp138
-rw-r--r--src/sensors/gestures/qsensorgesturemanager.h77
-rw-r--r--src/sensors/gestures/qsensorgesturemanagerprivate.cpp244
-rw-r--r--src/sensors/gestures/qsensorgesturemanagerprivate_p.h111
-rw-r--r--src/sensors/gestures/qsensorgestureplugininterface.cpp97
-rw-r--r--src/sensors/gestures/qsensorgestureplugininterface.h67
-rw-r--r--src/sensors/gestures/qsensorgesturerecognizer.cpp218
-rw-r--r--src/sensors/gestures/qsensorgesturerecognizer.h83
-rw-r--r--src/sensors/gestures/simulatorgesturescommon.cpp121
-rw-r--r--src/sensors/gestures/simulatorgesturescommon_p.h92
-rwxr-xr-xsrc/sensors/make_sensor.pl131
-rw-r--r--src/sensors/qaccelerometer.cpp44
-rw-r--r--src/sensors/qaccelerometer.h47
-rw-r--r--src/sensors/qaccelerometer_p.h40
-rw-r--r--src/sensors/qaltimeter.cpp151
-rw-r--r--src/sensors/qaltimeter.h81
-rw-r--r--src/sensors/qaltimeter_p.h68
-rw-r--r--src/sensors/qambientlightsensor.cpp44
-rw-r--r--src/sensors/qambientlightsensor.h47
-rw-r--r--src/sensors/qambientlightsensor_p.h42
-rw-r--r--src/sensors/qambienttemperaturesensor.cpp44
-rw-r--r--src/sensors/qambienttemperaturesensor.h44
-rw-r--r--src/sensors/qambienttemperaturesensor_p.h42
-rw-r--r--src/sensors/qcompass.cpp44
-rw-r--r--src/sensors/qcompass.h44
-rw-r--r--src/sensors/qcompass_p.h42
-rw-r--r--src/sensors/qdistancesensor.cpp163
-rw-r--r--src/sensors/qdistancesensor.h82
-rw-r--r--src/sensors/qdistancesensor_p.h75
-rw-r--r--src/sensors/qgyroscope.cpp44
-rw-r--r--src/sensors/qgyroscope.h44
-rw-r--r--src/sensors/qgyroscope_p.h42
-rw-r--r--src/sensors/qholstersensor.cpp157
-rw-r--r--src/sensors/qholstersensor.h81
-rw-r--r--src/sensors/qholstersensor_p.h68
-rw-r--r--src/sensors/qhumiditysensor.cpp44
-rw-r--r--src/sensors/qhumiditysensor.h44
-rw-r--r--src/sensors/qhumiditysensor_p.h40
-rw-r--r--src/sensors/qirproximitysensor.cpp47
-rw-r--r--src/sensors/qirproximitysensor.h44
-rw-r--r--src/sensors/qirproximitysensor_p.h42
-rw-r--r--src/sensors/qlidsensor.cpp47
-rw-r--r--src/sensors/qlidsensor.h44
-rw-r--r--src/sensors/qlidsensor_p.h42
-rw-r--r--src/sensors/qlightsensor.cpp44
-rw-r--r--src/sensors/qlightsensor.h44
-rw-r--r--src/sensors/qlightsensor_p.h40
-rw-r--r--src/sensors/qmagnetometer.cpp44
-rw-r--r--src/sensors/qmagnetometer.h44
-rw-r--r--src/sensors/qmagnetometer_p.h42
-rw-r--r--src/sensors/qorientationsensor.cpp44
-rw-r--r--src/sensors/qorientationsensor.h47
-rw-r--r--src/sensors/qorientationsensor_p.h42
-rw-r--r--src/sensors/qpressuresensor.cpp44
-rw-r--r--src/sensors/qpressuresensor.h44
-rw-r--r--src/sensors/qpressuresensor_p.h42
-rw-r--r--src/sensors/qproximitysensor.cpp44
-rw-r--r--src/sensors/qproximitysensor.h44
-rw-r--r--src/sensors/qproximitysensor_p.h42
-rw-r--r--src/sensors/qrotationsensor.cpp44
-rw-r--r--src/sensors/qrotationsensor.h44
-rw-r--r--src/sensors/qrotationsensor_p.h40
-rw-r--r--src/sensors/qsensor.cpp57
-rw-r--r--src/sensors/qsensor.h70
-rw-r--r--src/sensors/qsensor_p.h42
-rw-r--r--src/sensors/qsensorbackend.cpp58
-rw-r--r--src/sensors/qsensorbackend.h44
-rw-r--r--src/sensors/qsensorbackend_p.h40
-rw-r--r--src/sensors/qsensormanager.cpp105
-rw-r--r--src/sensors/qsensormanager.h40
-rw-r--r--src/sensors/qsensorplugin.cpp40
-rw-r--r--src/sensors/qsensorplugin.h40
-rw-r--r--src/sensors/qsensorsglobal.h55
-rw-r--r--src/sensors/qt_cmdline.cmake0
-rw-r--r--src/sensors/qtapsensor.cpp57
-rw-r--r--src/sensors/qtapsensor.h47
-rw-r--r--src/sensors/qtapsensor_p.h40
-rw-r--r--src/sensors/qtiltsensor.cpp58
-rw-r--r--src/sensors/qtiltsensor.h44
-rw-r--r--src/sensors/qtiltsensor_p.h42
-rw-r--r--src/sensors/sensorlog_p.h42
-rw-r--r--src/sensors/sensors.pro87
-rw-r--r--src/sensorsquick/CMakeLists.txt39
-rw-r--r--src/sensorsquick/qmlaccelerometer.cpp (renamed from src/imports/sensors/qmlaccelerometer.cpp)84
-rw-r--r--src/sensorsquick/qmlaccelerometer_p.h94
-rw-r--r--src/sensorsquick/qmlambientlightsensor.cpp (renamed from src/imports/sensors/qmlambientlightsensor.cpp)62
-rw-r--r--src/sensorsquick/qmlambientlightsensor_p.h70
-rw-r--r--src/sensorsquick/qmlambienttemperaturesensor.cpp95
-rw-r--r--src/sensorsquick/qmlambienttemperaturesensor_p.h68
-rw-r--r--src/sensorsquick/qmlcompass.cpp113
-rw-r--r--src/sensorsquick/qmlcompass_p.h73
-rw-r--r--src/sensorsquick/qmlgyroscope.cpp130
-rw-r--r--src/sensorsquick/qmlgyroscope_p.h78
-rw-r--r--src/sensorsquick/qmlhumiditysensor.cpp115
-rw-r--r--src/sensorsquick/qmlhumiditysensor_p.h77
-rw-r--r--src/sensorsquick/qmlirproximitysensor.cpp96
-rw-r--r--src/sensorsquick/qmlirproximitysensor_p.h67
-rw-r--r--src/sensorsquick/qmllidsensor.cpp116
-rw-r--r--src/sensorsquick/qmllidsensor_p.h75
-rw-r--r--src/sensorsquick/qmllightsensor.cpp109
-rw-r--r--src/sensorsquick/qmllightsensor_p.h72
-rw-r--r--src/sensorsquick/qmlmagnetometer.cpp (renamed from src/imports/sensors/qmlmagnetometer.cpp)95
-rw-r--r--src/sensorsquick/qmlmagnetometer_p.h93
-rw-r--r--src/sensorsquick/qmlorientationsensor.cpp (renamed from src/imports/sensors/qmlorientationsensor.cpp)62
-rw-r--r--src/sensorsquick/qmlorientationsensor_p.h69
-rw-r--r--src/sensorsquick/qmlpressuresensor.cpp115
-rw-r--r--src/sensorsquick/qmlpressuresensor_p.h74
-rw-r--r--src/sensorsquick/qmlproximitysensor.cpp95
-rw-r--r--src/sensorsquick/qmlproximitysensor_p.h68
-rw-r--r--src/sensorsquick/qmlrotationsensor.cpp (renamed from src/imports/sensors/qmlrotationsensor.cpp)90
-rw-r--r--src/sensorsquick/qmlrotationsensor_p.h83
-rw-r--r--src/sensorsquick/qmlsensor.cpp (renamed from src/imports/sensors/qmlsensor.cpp)168
-rw-r--r--src/sensorsquick/qmlsensor_p.h (renamed from src/imports/sensors/qmlsensor.h)137
-rw-r--r--src/sensorsquick/qmlsensorglobal.cpp86
-rw-r--r--src/sensorsquick/qmlsensorglobal_p.h50
-rw-r--r--src/sensorsquick/qmlsensorrange.cpp52
-rw-r--r--src/sensorsquick/qmlsensorrange_p.h77
-rw-r--r--src/sensorsquick/qmltapsensor.cpp (renamed from src/imports/sensors/qmltapsensor.cpp)76
-rw-r--r--src/sensorsquick/qmltapsensor_p.h83
-rw-r--r--src/sensorsquick/qmltiltsensor.cpp128
-rw-r--r--src/sensorsquick/qmltiltsensor_p.h75
-rw-r--r--src/sensorsquick/qsensorsquickglobal_p.h23
-rw-r--r--src/src.pro18
419 files changed, 4948 insertions, 24789 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 00000000..97b75b56
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,8 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+add_subdirectory(sensors)
+add_subdirectory(plugins)
+if(TARGET Qt::Quick)
+ add_subdirectory(sensorsquick)
+endif()
diff --git a/src/imports/imports.pro b/src/imports/imports.pro
deleted file mode 100644
index a68f6a5e..00000000
--- a/src/imports/imports.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += sensors
-
diff --git a/src/imports/sensors/plugin.json b/src/imports/sensors/plugin.json
deleted file mode 100644
index 0967ef42..00000000
--- a/src/imports/sensors/plugin.json
+++ /dev/null
@@ -1 +0,0 @@
-{}
diff --git a/src/imports/sensors/plugins.qmltypes b/src/imports/sensors/plugins.qmltypes
deleted file mode 100644
index c68c37b3..00000000
--- a/src/imports/sensors/plugins.qmltypes
+++ /dev/null
@@ -1,613 +0,0 @@
-import QtQuick.tooling 1.2
-
-// This file describes the plugin-supplied types contained in the library.
-// It is used for QML tooling purposes only.
-//
-// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable QtSensors 5.15'
-
-Module {
- dependencies: ["QtQuick 2.0"]
- Component {
- name: "QmlAccelerometer"
- prototype: "QmlSensor"
- exports: [
- "QtSensors/Accelerometer 5.0",
- "QtSensors/Accelerometer 5.1",
- "QtSensors/Accelerometer 5.2"
- ]
- exportMetaObjectRevisions: [0, 1, 1]
- Enum {
- name: "AccelerationMode"
- values: {
- "Combined": 0,
- "Gravity": 1,
- "User": 2
- }
- }
- Property { name: "accelerationMode"; revision: 1; type: "AccelerationMode" }
- Signal {
- name: "accelerationModeChanged"
- revision: 1
- Parameter { name: "accelerationMode"; type: "AccelerationMode" }
- }
- }
- Component {
- name: "QmlAccelerometerReading"
- prototype: "QmlSensorReading"
- exports: [
- "QtSensors/AccelerometerReading 5.0",
- "QtSensors/AccelerometerReading 5.1",
- "QtSensors/AccelerometerReading 5.2"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 0, 0]
- Property { name: "x"; type: "double"; isReadonly: true }
- Property { name: "y"; type: "double"; isReadonly: true }
- Property { name: "z"; type: "double"; isReadonly: true }
- }
- Component {
- name: "QmlAltimeter"
- prototype: "QmlSensor"
- exports: ["QtSensors/Altimeter 5.1", "QtSensors/Altimeter 5.2"]
- exportMetaObjectRevisions: [0, 0]
- }
- Component {
- name: "QmlAltimeterReading"
- prototype: "QmlSensorReading"
- exports: [
- "QtSensors/AltimeterReading 5.1",
- "QtSensors/AltimeterReading 5.2"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 0]
- Property { name: "altitude"; type: "double"; isReadonly: true }
- }
- Component {
- name: "QmlAmbientLightSensor"
- prototype: "QmlSensor"
- exports: [
- "QtSensors/AmbientLightSensor 5.0",
- "QtSensors/AmbientLightSensor 5.1",
- "QtSensors/AmbientLightSensor 5.2"
- ]
- exportMetaObjectRevisions: [0, 0, 0]
- }
- Component {
- name: "QmlAmbientLightSensorReading"
- prototype: "QmlSensorReading"
- exports: [
- "QtSensors/AmbientLightReading 5.0",
- "QtSensors/AmbientLightReading 5.1",
- "QtSensors/AmbientLightReading 5.2"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 0, 0]
- Property { name: "lightLevel"; type: "QAmbientLightReading::LightLevel"; isReadonly: true }
- }
- Component {
- name: "QmlAmbientTemperatureReading"
- prototype: "QmlSensorReading"
- exports: [
- "QtSensors/AmbientTemperatureReading 5.1",
- "QtSensors/AmbientTemperatureReading 5.2"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 0]
- Property { name: "temperature"; type: "double"; isReadonly: true }
- }
- Component {
- name: "QmlAmbientTemperatureSensor"
- prototype: "QmlSensor"
- exports: [
- "QtSensors/AmbientTemperatureSensor 5.1",
- "QtSensors/AmbientTemperatureSensor 5.2"
- ]
- exportMetaObjectRevisions: [0, 0]
- }
- Component {
- name: "QmlCompass"
- prototype: "QmlSensor"
- exports: [
- "QtSensors/Compass 5.0",
- "QtSensors/Compass 5.1",
- "QtSensors/Compass 5.2"
- ]
- exportMetaObjectRevisions: [0, 0, 0]
- }
- Component {
- name: "QmlCompassReading"
- prototype: "QmlSensorReading"
- exports: [
- "QtSensors/CompassReading 5.0",
- "QtSensors/CompassReading 5.1",
- "QtSensors/CompassReading 5.2"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 0, 0]
- Property { name: "azimuth"; type: "double"; isReadonly: true }
- Property { name: "calibrationLevel"; type: "double"; isReadonly: true }
- }
- Component {
- name: "QmlDistanceReading"
- prototype: "QmlSensorReading"
- exports: ["QtSensors/DistanceReading 5.4"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Property { name: "distance"; type: "double"; isReadonly: true }
- }
- Component {
- name: "QmlDistanceSensor"
- prototype: "QmlSensor"
- exports: ["QtSensors/DistanceSensor 5.4"]
- exportMetaObjectRevisions: [0]
- }
- Component {
- name: "QmlGyroscope"
- prototype: "QmlSensor"
- exports: [
- "QtSensors/Gyroscope 5.0",
- "QtSensors/Gyroscope 5.1",
- "QtSensors/Gyroscope 5.2"
- ]
- exportMetaObjectRevisions: [0, 0, 0]
- }
- Component {
- name: "QmlGyroscopeReading"
- prototype: "QmlSensorReading"
- exports: [
- "QtSensors/GyroscopeReading 5.0",
- "QtSensors/GyroscopeReading 5.1",
- "QtSensors/GyroscopeReading 5.2"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 0, 0]
- Property { name: "x"; type: "double"; isReadonly: true }
- Property { name: "y"; type: "double"; isReadonly: true }
- Property { name: "z"; type: "double"; isReadonly: true }
- }
- Component {
- name: "QmlHolsterReading"
- prototype: "QmlSensorReading"
- exports: [
- "QtSensors/HolsterReading 5.1",
- "QtSensors/HolsterReading 5.2"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 0]
- Property { name: "holstered"; type: "bool"; isReadonly: true }
- }
- Component {
- name: "QmlHolsterSensor"
- prototype: "QmlSensor"
- exports: [
- "QtSensors/HolsterSensor 5.1",
- "QtSensors/HolsterSensor 5.2"
- ]
- exportMetaObjectRevisions: [0, 0]
- }
- Component {
- name: "QmlHumidityReading"
- prototype: "QmlSensorReading"
- exports: ["QtSensors/HumidityReading 5.9"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Property { name: "relativeHumidity"; type: "double"; isReadonly: true }
- Property { name: "absoluteHumidity"; type: "double"; isReadonly: true }
- }
- Component {
- name: "QmlHumiditySensor"
- prototype: "QmlSensor"
- exports: ["QtSensors/HumiditySensor 5.9"]
- exportMetaObjectRevisions: [0]
- }
- Component {
- name: "QmlIRProximitySensor"
- prototype: "QmlSensor"
- exports: [
- "QtSensors/IRProximitySensor 5.0",
- "QtSensors/IRProximitySensor 5.1",
- "QtSensors/IRProximitySensor 5.2"
- ]
- exportMetaObjectRevisions: [0, 0, 0]
- }
- Component {
- name: "QmlIRProximitySensorReading"
- prototype: "QmlSensorReading"
- exports: [
- "QtSensors/IRProximityReading 5.0",
- "QtSensors/IRProximityReading 5.1",
- "QtSensors/IRProximityReading 5.2"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 0, 0]
- Property { name: "reflectance"; type: "double"; isReadonly: true }
- }
- Component {
- name: "QmlLidReading"
- prototype: "QmlSensorReading"
- exports: ["QtSensors/LidReading 5.9"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Property { name: "backLidChanged"; type: "bool"; isReadonly: true }
- Property { name: "frontLidClosed"; type: "bool"; isReadonly: true }
- Signal {
- name: "backLidChanged"
- Parameter { name: "closed"; type: "bool" }
- }
- Signal {
- name: "frontLidChanged"
- type: "bool"
- Parameter { name: "closed"; type: "bool" }
- }
- }
- Component {
- name: "QmlLidSensor"
- prototype: "QmlSensor"
- exports: ["QtSensors/LidSensor 5.9"]
- exportMetaObjectRevisions: [0]
- }
- Component {
- name: "QmlLightSensor"
- prototype: "QmlSensor"
- exports: [
- "QtSensors/LightSensor 5.0",
- "QtSensors/LightSensor 5.1",
- "QtSensors/LightSensor 5.2"
- ]
- exportMetaObjectRevisions: [0, 0, 0]
- Property { name: "fieldOfView"; type: "double"; isReadonly: true }
- Signal {
- name: "fieldOfViewChanged"
- Parameter { name: "fieldOfView"; type: "double" }
- }
- }
- Component {
- name: "QmlLightSensorReading"
- prototype: "QmlSensorReading"
- exports: [
- "QtSensors/LightReading 5.0",
- "QtSensors/LightReading 5.1",
- "QtSensors/LightReading 5.2"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 0, 0]
- Property { name: "illuminance"; type: "double"; isReadonly: true }
- }
- Component {
- name: "QmlMagnetometer"
- prototype: "QmlSensor"
- exports: [
- "QtSensors/Magnetometer 5.0",
- "QtSensors/Magnetometer 5.1",
- "QtSensors/Magnetometer 5.2"
- ]
- exportMetaObjectRevisions: [0, 0, 0]
- Property { name: "returnGeoValues"; type: "bool" }
- Signal {
- name: "returnGeoValuesChanged"
- Parameter { name: "returnGeoValues"; type: "bool" }
- }
- }
- Component {
- name: "QmlMagnetometerReading"
- prototype: "QmlSensorReading"
- exports: [
- "QtSensors/MagnetometerReading 5.0",
- "QtSensors/MagnetometerReading 5.1",
- "QtSensors/MagnetometerReading 5.2"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 0, 0]
- Property { name: "x"; type: "double"; isReadonly: true }
- Property { name: "y"; type: "double"; isReadonly: true }
- Property { name: "z"; type: "double"; isReadonly: true }
- Property { name: "calibrationLevel"; type: "double"; isReadonly: true }
- }
- Component {
- name: "QmlOrientationSensor"
- prototype: "QmlSensor"
- exports: [
- "QtSensors/OrientationSensor 5.0",
- "QtSensors/OrientationSensor 5.1",
- "QtSensors/OrientationSensor 5.2"
- ]
- exportMetaObjectRevisions: [0, 0, 0]
- }
- Component {
- name: "QmlOrientationSensorReading"
- prototype: "QmlSensorReading"
- exports: [
- "QtSensors/OrientationReading 5.0",
- "QtSensors/OrientationReading 5.1",
- "QtSensors/OrientationReading 5.2"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 0, 0]
- Property { name: "orientation"; type: "QOrientationReading::Orientation"; isReadonly: true }
- }
- Component {
- name: "QmlPressureReading"
- prototype: "QmlSensorReading"
- exports: [
- "QtSensors/PressureReading 5.1",
- "QtSensors/PressureReading 5.2"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 1]
- Property { name: "pressure"; type: "double"; isReadonly: true }
- Property { name: "temperature"; revision: 1; type: "double"; isReadonly: true }
- Signal { name: "temperatureChanged"; revision: 1 }
- }
- Component {
- name: "QmlPressureSensor"
- prototype: "QmlSensor"
- exports: [
- "QtSensors/PressureSensor 5.1",
- "QtSensors/PressureSensor 5.2"
- ]
- exportMetaObjectRevisions: [0, 0]
- }
- Component {
- name: "QmlProximitySensor"
- prototype: "QmlSensor"
- exports: [
- "QtSensors/ProximitySensor 5.0",
- "QtSensors/ProximitySensor 5.1",
- "QtSensors/ProximitySensor 5.2"
- ]
- exportMetaObjectRevisions: [0, 0, 0]
- }
- Component {
- name: "QmlProximitySensorReading"
- prototype: "QmlSensorReading"
- exports: [
- "QtSensors/ProximityReading 5.0",
- "QtSensors/ProximityReading 5.1",
- "QtSensors/ProximityReading 5.2"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 0, 0]
- Property { name: "near"; type: "bool"; isReadonly: true }
- }
- Component {
- name: "QmlRotationSensor"
- prototype: "QmlSensor"
- exports: [
- "QtSensors/RotationSensor 5.0",
- "QtSensors/RotationSensor 5.1",
- "QtSensors/RotationSensor 5.2"
- ]
- exportMetaObjectRevisions: [0, 0, 0]
- Property { name: "hasZ"; type: "bool"; isReadonly: true }
- Signal {
- name: "hasZChanged"
- Parameter { name: "hasZ"; type: "bool" }
- }
- }
- Component {
- name: "QmlRotationSensorReading"
- prototype: "QmlSensorReading"
- exports: [
- "QtSensors/RotationReading 5.0",
- "QtSensors/RotationReading 5.1",
- "QtSensors/RotationReading 5.2"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 0, 0]
- Property { name: "x"; type: "double"; isReadonly: true }
- Property { name: "y"; type: "double"; isReadonly: true }
- Property { name: "z"; type: "double"; isReadonly: true }
- }
- Component {
- name: "QmlSensor"
- prototype: "QObject"
- exports: [
- "QtSensors/Sensor 5.0",
- "QtSensors/Sensor 5.1",
- "QtSensors/Sensor 5.2"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 1, 1]
- Enum {
- name: "AxesOrientationMode"
- values: {
- "FixedOrientation": 0,
- "AutomaticOrientation": 1,
- "UserOrientation": 2
- }
- }
- Property { name: "identifier"; type: "string" }
- Property { name: "type"; type: "string"; isReadonly: true }
- Property { name: "connectedToBackend"; type: "bool"; isReadonly: true }
- Property { name: "availableDataRates"; type: "QmlSensorRange"; isList: true; isReadonly: true }
- Property { name: "dataRate"; type: "int" }
- Property { name: "reading"; type: "QmlSensorReading"; isReadonly: true; isPointer: true }
- Property { name: "busy"; type: "bool"; isReadonly: true }
- Property { name: "active"; type: "bool" }
- Property { name: "outputRanges"; type: "QmlSensorOutputRange"; isList: true; isReadonly: true }
- Property { name: "outputRange"; type: "int" }
- Property { name: "description"; type: "string"; isReadonly: true }
- Property { name: "error"; type: "int"; isReadonly: true }
- Property { name: "alwaysOn"; type: "bool" }
- Property { name: "skipDuplicates"; revision: 1; type: "bool" }
- Property { name: "axesOrientationMode"; revision: 1; type: "AxesOrientationMode" }
- Property { name: "currentOrientation"; revision: 1; type: "int"; isReadonly: true }
- Property { name: "userOrientation"; revision: 1; type: "int" }
- Property { name: "maxBufferSize"; revision: 1; type: "int"; isReadonly: true }
- Property { name: "efficientBufferSize"; revision: 1; type: "int"; isReadonly: true }
- Property { name: "bufferSize"; revision: 1; type: "int" }
- Signal {
- name: "skipDuplicatesChanged"
- revision: 1
- Parameter { name: "skipDuplicates"; type: "bool" }
- }
- Signal {
- name: "axesOrientationModeChanged"
- revision: 1
- Parameter { name: "axesOrientationMode"; type: "AxesOrientationMode" }
- }
- Signal {
- name: "currentOrientationChanged"
- revision: 1
- Parameter { name: "currentOrientation"; type: "int" }
- }
- Signal {
- name: "userOrientationChanged"
- revision: 1
- Parameter { name: "userOrientation"; type: "int" }
- }
- Signal {
- name: "maxBufferSizeChanged"
- revision: 1
- Parameter { name: "maxBufferSize"; type: "int" }
- }
- Signal {
- name: "efficientBufferSizeChanged"
- revision: 1
- Parameter { name: "efficientBufferSize"; type: "int" }
- }
- Signal {
- name: "bufferSizeChanged"
- revision: 1
- Parameter { name: "bufferSize"; type: "int" }
- }
- Method { name: "start"; type: "bool" }
- Method { name: "stop" }
- }
- Component {
- name: "QmlSensorGesture"
- prototype: "QObject"
- exports: [
- "QtSensors/SensorGesture 5.0",
- "QtSensors/SensorGesture 5.1",
- "QtSensors/SensorGesture 5.2"
- ]
- exportMetaObjectRevisions: [0, 0, 0]
- Property { name: "availableGestures"; type: "QStringList"; isReadonly: true }
- Property { name: "gestures"; type: "QStringList" }
- Property { name: "validGestures"; type: "QStringList"; isReadonly: true }
- Property { name: "invalidGestures"; type: "QStringList"; isReadonly: true }
- Property { name: "enabled"; type: "bool" }
- Signal {
- name: "detected"
- Parameter { name: "gesture"; type: "string" }
- }
- }
- Component {
- name: "QmlSensorGlobal"
- prototype: "QObject"
- exports: [
- "QtSensors/QmlSensors 5.0",
- "QtSensors/QmlSensors 5.1",
- "QtSensors/QmlSensors 5.2"
- ]
- isCreatable: false
- isSingleton: true
- exportMetaObjectRevisions: [0, 0, 0]
- Signal { name: "availableSensorsChanged" }
- Method { name: "sensorTypes"; type: "QStringList" }
- Method {
- name: "sensorsForType"
- type: "QStringList"
- Parameter { name: "type"; type: "string" }
- }
- Method {
- name: "defaultSensorForType"
- type: "string"
- Parameter { name: "type"; type: "string" }
- }
- }
- Component {
- name: "QmlSensorOutputRange"
- prototype: "QObject"
- exports: [
- "QtSensors/OutputRange 5.0",
- "QtSensors/OutputRange 5.1",
- "QtSensors/OutputRange 5.2"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 0, 0]
- Property { name: "minimum"; type: "double"; isReadonly: true }
- Property { name: "maximum"; type: "double"; isReadonly: true }
- Property { name: "accuracy"; type: "double"; isReadonly: true }
- }
- Component {
- name: "QmlSensorRange"
- prototype: "QObject"
- exports: [
- "QtSensors/Range 5.0",
- "QtSensors/Range 5.1",
- "QtSensors/Range 5.2"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 0, 0]
- Property { name: "minimum"; type: "int"; isReadonly: true }
- Property { name: "maximum"; type: "int"; isReadonly: true }
- }
- Component {
- name: "QmlSensorReading"
- prototype: "QObject"
- exports: [
- "QtSensors/SensorReading 5.0",
- "QtSensors/SensorReading 5.1",
- "QtSensors/SensorReading 5.2"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 0, 0]
- Property { name: "timestamp"; type: "qulonglong"; isReadonly: true }
- }
- Component {
- name: "QmlTapSensor"
- prototype: "QmlSensor"
- exports: [
- "QtSensors/TapSensor 5.0",
- "QtSensors/TapSensor 5.1",
- "QtSensors/TapSensor 5.2"
- ]
- exportMetaObjectRevisions: [0, 0, 0]
- Property { name: "returnDoubleTapEvents"; type: "bool" }
- Signal {
- name: "returnDoubleTapEventsChanged"
- Parameter { name: "returnDoubleTapEvents"; type: "bool" }
- }
- }
- Component {
- name: "QmlTapSensorReading"
- prototype: "QmlSensorReading"
- exports: [
- "QtSensors/TapReading 5.0",
- "QtSensors/TapReading 5.1",
- "QtSensors/TapReading 5.2"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 0, 0]
- Property { name: "tapDirection"; type: "QTapReading::TapDirection"; isReadonly: true }
- Property { name: "doubleTap"; type: "bool"; isReadonly: true }
- Signal { name: "isDoubleTapChanged" }
- }
- Component {
- name: "QmlTiltSensor"
- prototype: "QmlSensor"
- exports: [
- "QtSensors/TiltSensor 5.0",
- "QtSensors/TiltSensor 5.1",
- "QtSensors/TiltSensor 5.2"
- ]
- exportMetaObjectRevisions: [0, 0, 0]
- Method { name: "calibrate" }
- }
- Component {
- name: "QmlTiltSensorReading"
- prototype: "QmlSensorReading"
- exports: [
- "QtSensors/TiltReading 5.0",
- "QtSensors/TiltReading 5.1",
- "QtSensors/TiltReading 5.2"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 0, 0]
- Property { name: "yRotation"; type: "double"; isReadonly: true }
- Property { name: "xRotation"; type: "double"; isReadonly: true }
- }
-}
diff --git a/src/imports/sensors/qmlaccelerometer.h b/src/imports/sensors/qmlaccelerometer.h
deleted file mode 100644
index e04b9712..00000000
--- a/src/imports/sensors/qmlaccelerometer.h
+++ /dev/null
@@ -1,107 +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 QMLACCELEROMETER_H
-#define QMLACCELEROMETER_H
-
-#include "qmlsensor.h"
-
-QT_BEGIN_NAMESPACE
-
-class QAccelerometer;
-
-class QmlAccelerometer : public QmlSensor
-{
- Q_OBJECT
- Q_ENUMS(AccelerationMode)
- Q_PROPERTY(AccelerationMode accelerationMode READ accelerationMode WRITE setAccelerationMode
- NOTIFY accelerationModeChanged REVISION 1)
-public:
- explicit QmlAccelerometer(QObject *parent = 0);
- ~QmlAccelerometer();
-
- // Keep this enum in sync with QAccelerometer::AccelerationMode
- enum AccelerationMode {
- Combined,
- Gravity,
- User
- };
-
- AccelerationMode accelerationMode() const;
- void setAccelerationMode(AccelerationMode accelerationMode);
-
-signals:
- Q_REVISION(1) void accelerationModeChanged(AccelerationMode accelerationMode);
-
-private:
- QSensor *sensor() const override;
- QAccelerometer *m_sensor;
- QmlSensorReading *createReading() const override;
-};
-
-class QmlAccelerometerReading : public QmlSensorReading
-{
- Q_OBJECT
- Q_PROPERTY(qreal x READ x NOTIFY xChanged)
- Q_PROPERTY(qreal y READ y NOTIFY yChanged)
- Q_PROPERTY(qreal z READ z NOTIFY zChanged)
-public:
- explicit QmlAccelerometerReading(QAccelerometer *sensor);
- ~QmlAccelerometerReading();
-
- qreal x() const;
- qreal y() const;
- qreal z() const;
-
-Q_SIGNALS:
- void xChanged();
- void yChanged();
- void zChanged();
-
-private:
- QSensorReading *reading() const override;
- void readingUpdate() override;
- QAccelerometer *m_sensor;
- qreal m_x;
- qreal m_y;
- qreal m_z;
-};
-
-QT_END_NAMESPACE
-#endif
diff --git a/src/imports/sensors/qmlaltimeter.cpp b/src/imports/sensors/qmlaltimeter.cpp
deleted file mode 100644
index 63c979d3..00000000
--- a/src/imports/sensors/qmlaltimeter.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Research In Motion
-** 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 "qmlaltimeter.h"
-#include <QtSensors/QAltimeter>
-
-/*!
- \qmltype Altimeter
- \instantiates QmlAltimeter
- \ingroup qml-sensors_type
- \inqmlmodule QtSensors
- \since QtSensors 5.1
- \inherits Sensor
- \brief The Altimeter element reports on altitude.
-
- The Altimeter element reports on altitude.
-
- This element wraps the QAltimeter class. Please see the documentation for
- QAltimeter for details.
-
- \sa AltimeterReading
-*/
-
-QmlAltimeter::QmlAltimeter(QObject *parent)
- : QmlSensor(parent)
- , m_sensor(new QAltimeter(this))
-{
-}
-
-QmlAltimeter::~QmlAltimeter()
-{
-}
-
-QmlSensorReading *QmlAltimeter::createReading() const
-{
- return new QmlAltimeterReading(m_sensor);
-}
-
-QSensor *QmlAltimeter::sensor() const
-{
- return m_sensor;
-}
-
-/*!
- \qmltype AltimeterReading
- \instantiates QmlAltimeterReading
- \ingroup qml-sensors_reading
- \inqmlmodule QtSensors
- \since QtSensors 5.1
- \inherits SensorReading
- \brief The AltimeterReading element holds the most recent Altimeter reading.
-
- The AltimeterReading element holds the most recent Altimeter reading.
-
- This element wraps the QAltimeterReading class. Please see the documentation for
- QAltimeterReading for details.
-
- This element cannot be directly created.
-*/
-
-QmlAltimeterReading::QmlAltimeterReading(QAltimeter *sensor)
- : QmlSensorReading(sensor)
- , m_sensor(sensor)
- , m_altitude(0)
-{
-}
-
-QmlAltimeterReading::~QmlAltimeterReading()
-{
-}
-
-/*!
- \qmlproperty qreal AltimeterReading::altitude
- This property holds the altitude of the device.
-
- Please see QAltimeterReading::altitude for information about this property.
-*/
-
-qreal QmlAltimeterReading::altitude() const
-{
- return m_altitude;
-}
-
-QSensorReading *QmlAltimeterReading::reading() const
-{
- return m_sensor->reading();
-}
-
-void QmlAltimeterReading::readingUpdate()
-{
- qreal altitude = m_sensor->reading()->altitude();
- if (m_altitude != altitude) {
- m_altitude = altitude;
- Q_EMIT altitudeChanged();
- }
-}
diff --git a/src/imports/sensors/qmlaltimeter.h b/src/imports/sensors/qmlaltimeter.h
deleted file mode 100644
index 04938b53..00000000
--- a/src/imports/sensors/qmlaltimeter.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Research In Motion
-** 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 QMLALTIMETER_H
-#define QMLALTIMETER_H
-
-#include "qmlsensor.h"
-
-QT_BEGIN_NAMESPACE
-
-class QAltimeter;
-
-class QmlAltimeter : public QmlSensor
-{
- Q_OBJECT
-public:
- explicit QmlAltimeter(QObject *parent = 0);
- ~QmlAltimeter();
-
-private:
- QSensor *sensor() const override;
- QmlSensorReading *createReading() const override;
-
- QAltimeter *m_sensor;
-};
-
-class QmlAltimeterReading : public QmlSensorReading
-{
- Q_OBJECT
- Q_PROPERTY(qreal altitude READ altitude NOTIFY altitudeChanged)
-public:
- explicit QmlAltimeterReading(QAltimeter *sensor);
- ~QmlAltimeterReading();
-
- qreal altitude() const;
-
-Q_SIGNALS:
- void altitudeChanged();
-
-private:
- QSensorReading *reading() const override;
- void readingUpdate() override;
-
- QAltimeter *m_sensor;
- qreal m_altitude;
-};
-
-QT_END_NAMESPACE
-#endif
diff --git a/src/imports/sensors/qmlambientlightsensor.h b/src/imports/sensors/qmlambientlightsensor.h
deleted file mode 100644
index 4de42f31..00000000
--- a/src/imports/sensors/qmlambientlightsensor.h
+++ /dev/null
@@ -1,86 +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 QMLAMBIENTLIGHTSENSOR_H
-#define QMLAMBIENTLIGHTSENSOR_H
-
-#include "qmlsensor.h"
-#include <QtSensors/QAmbientLightSensor>
-
-QT_BEGIN_NAMESPACE
-
-class QAmbientLightSensor;
-
-class QmlAmbientLightSensor : public QmlSensor
-{
- Q_OBJECT
-public:
- explicit QmlAmbientLightSensor(QObject *parent = 0);
- ~QmlAmbientLightSensor();
-
-private:
- QSensor *sensor() const override;
- QAmbientLightSensor *m_sensor;
- QmlSensorReading *createReading() const override;
-
-};
-
-class QmlAmbientLightSensorReading : public QmlSensorReading
-{
- Q_OBJECT
- Q_PROPERTY(QAmbientLightReading::LightLevel lightLevel READ lightLevel NOTIFY lightLevelChanged)
-public:
-
- explicit QmlAmbientLightSensorReading(QAmbientLightSensor *sensor);
- ~QmlAmbientLightSensorReading();
-
- QAmbientLightReading::LightLevel lightLevel() const;
-
-Q_SIGNALS:
- void lightLevelChanged();
-
-private:
- QSensorReading *reading() const override;
- void readingUpdate() override;
- QAmbientLightSensor *m_sensor;
- QAmbientLightReading::LightLevel m_lightLevel;
-};
-
-QT_END_NAMESPACE
-#endif
diff --git a/src/imports/sensors/qmlambienttemperaturesensor.cpp b/src/imports/sensors/qmlambienttemperaturesensor.cpp
deleted file mode 100644
index 1958f6d8..00000000
--- a/src/imports/sensors/qmlambienttemperaturesensor.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Research In Motion
-** 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 "qmlambienttemperaturesensor.h"
-#include <QtSensors/QAmbientTemperatureSensor>
-
-/*!
- \qmltype AmbientTemperatureSensor
- \instantiates QmlAmbientTemperatureSensor
- \ingroup qml-sensors_type
- \inqmlmodule QtSensors
- \since QtSensors 5.1
- \inherits Sensor
- \brief The AmbientTemperatureSensor element reports on the ambient temperature.
-
- The AmbientTemperatureSensor element reports on the ambient temperature.
-
- This element wraps the QAmbientTemperatureSensor class. Please see the documentation for
- QAmbientTemperatureSensor for details.
-
- \sa AmbientTemperatureReading
-*/
-
-QmlAmbientTemperatureSensor::QmlAmbientTemperatureSensor(QObject *parent)
- : QmlSensor(parent)
- , m_sensor(new QAmbientTemperatureSensor(this))
-{
-}
-
-QmlAmbientTemperatureSensor::~QmlAmbientTemperatureSensor()
-{
-}
-
-QmlSensorReading *QmlAmbientTemperatureSensor::createReading() const
-{
- return new QmlAmbientTemperatureReading(m_sensor);
-}
-
-QSensor *QmlAmbientTemperatureSensor::sensor() const
-{
- return m_sensor;
-}
-
-/*!
- \qmltype AmbientTemperatureReading
- \instantiates QmlAmbientTemperatureReading
- \ingroup qml-sensors_reading
- \inqmlmodule QtSensors
- \since QtSensors 5.1
- \inherits SensorReading
- \brief The AmbientTemperatureReading element holds the most recent temperature reading.
-
- The AmbientTemperatureReading element holds the most recent temperature reading.
-
- This element wraps the QAmbientTemperatureReading class. Please see the documentation for
- QAmbientTemperatureReading for details.
-
- This element cannot be directly created.
-*/
-
-QmlAmbientTemperatureReading::QmlAmbientTemperatureReading(QAmbientTemperatureSensor *sensor)
- : QmlSensorReading(sensor)
- , m_sensor(sensor)
- , m_temperature(0)
-{
-}
-
-QmlAmbientTemperatureReading::~QmlAmbientTemperatureReading()
-{
-}
-
-/*!
- \qmlproperty qreal AmbientTemperatureReading::temperature
- This property holds the ambient temperature in degree Celsius.
-
- Please see QAmbientTemperatureReading::temperature for information about this property.
-*/
-
-qreal QmlAmbientTemperatureReading::temperature() const
-{
- return m_temperature;
-}
-
-QSensorReading *QmlAmbientTemperatureReading::reading() const
-{
- return m_sensor->reading();
-}
-
-void QmlAmbientTemperatureReading::readingUpdate()
-{
- const qreal temperature = m_sensor->reading()->temperature();
- if (m_temperature != temperature) {
- m_temperature = temperature;
- Q_EMIT temperatureChanged();
- }
-}
diff --git a/src/imports/sensors/qmlambienttemperaturesensor.h b/src/imports/sensors/qmlambienttemperaturesensor.h
deleted file mode 100644
index 31ec72fa..00000000
--- a/src/imports/sensors/qmlambienttemperaturesensor.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Research In Motion
-** 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 QMLAMBIENTTEMPERATURESENSOR_H
-#define QMLAMBIENTTEMPERATURESENSOR_H
-
-#include "qmlsensor.h"
-
-QT_BEGIN_NAMESPACE
-
-class QAmbientTemperatureSensor;
-
-class QmlAmbientTemperatureSensor : public QmlSensor
-{
- Q_OBJECT
-public:
- explicit QmlAmbientTemperatureSensor(QObject *parent = 0);
- ~QmlAmbientTemperatureSensor();
-
-private:
- QSensor *sensor() const override;
- QmlSensorReading *createReading() const override;
-
- QAmbientTemperatureSensor *m_sensor;
-};
-
-class QmlAmbientTemperatureReading : public QmlSensorReading
-{
- Q_OBJECT
- Q_PROPERTY(qreal temperature READ temperature NOTIFY temperatureChanged)
-public:
- explicit QmlAmbientTemperatureReading(QAmbientTemperatureSensor *sensor);
- ~QmlAmbientTemperatureReading();
-
- qreal temperature() const;
-
-Q_SIGNALS:
- void temperatureChanged();
-
-private:
- QSensorReading *reading() const override;
- void readingUpdate() override;
-
- QAmbientTemperatureSensor *m_sensor;
- qreal m_temperature;
-};
-
-QT_END_NAMESPACE
-#endif
diff --git a/src/imports/sensors/qmlcompass.cpp b/src/imports/sensors/qmlcompass.cpp
deleted file mode 100644
index 38fc388e..00000000
--- a/src/imports/sensors/qmlcompass.cpp
+++ /dev/null
@@ -1,148 +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 "qmlcompass.h"
-#include <QtSensors/QCompass>
-
-/*!
- \qmltype Compass
- \instantiates QmlCompass
- \ingroup qml-sensors_type
- \inqmlmodule QtSensors
- \since QtSensors 5.0
- \inherits Sensor
- \brief The Compass element reports on heading using magnetic north as a reference.
-
- The Compass element reports on heading using magnetic north as a reference.
-
- This element wraps the QCompass class. Please see the documentation for
- QCompass for details.
-
- \sa CompassReading
-*/
-
-QmlCompass::QmlCompass(QObject *parent)
- : QmlSensor(parent)
- , m_sensor(new QCompass(this))
-{
-}
-
-QmlCompass::~QmlCompass()
-{
-}
-
-QmlSensorReading *QmlCompass::createReading() const
-{
- return new QmlCompassReading(m_sensor);
-}
-
-QSensor *QmlCompass::sensor() const
-{
- return m_sensor;
-}
-
-/*!
- \qmltype CompassReading
- \instantiates QmlCompassReading
- \ingroup qml-sensors_reading
- \inqmlmodule QtSensors
- \since QtSensors 5.0
- \inherits SensorReading
- \brief The CompassReading element holds the most recent Compass reading.
-
- The CompassReading element holds the most recent Compass reading.
-
- This element wraps the QCompassReading class. Please see the documentation for
- QCompassReading for details.
-
- This element cannot be directly created.
-*/
-
-QmlCompassReading::QmlCompassReading(QCompass *sensor)
- : QmlSensorReading(sensor)
- , m_sensor(sensor)
-{
-}
-
-QmlCompassReading::~QmlCompassReading()
-{
-}
-
-/*!
- \qmlproperty qreal CompassReading::azimuth
- This property holds the azimuth of the device.
-
- Please see QCompassReading::azimuth for information about this property.
-*/
-
-qreal QmlCompassReading::azimuth() const
-{
- return m_azimuth;
-}
-
-/*!
- \qmlproperty qreal CompassReading::calibrationLevel
- This property holds the calibration level of the reading.
-
- Please see QCompassReading::calibrationLevel for information about this property.
-*/
-
-qreal QmlCompassReading::calibrationLevel() const
-{
- return m_calibrationLevel;
-}
-
-QSensorReading *QmlCompassReading::reading() const
-{
- return m_sensor->reading();
-}
-
-void QmlCompassReading::readingUpdate()
-{
- qreal azm = m_sensor->reading()->azimuth();
- if (m_azimuth != azm) {
- m_azimuth = azm;
- Q_EMIT azimuthChanged();
- }
- qreal calLevel = m_sensor->reading()->calibrationLevel();
- if (m_calibrationLevel != calLevel) {
- m_calibrationLevel = calLevel;
- Q_EMIT calibrationLevelChanged();
- }
-}
diff --git a/src/imports/sensors/qmlcompass.h b/src/imports/sensors/qmlcompass.h
deleted file mode 100644
index ef4fd22f..00000000
--- a/src/imports/sensors/qmlcompass.h
+++ /dev/null
@@ -1,88 +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 QMLCOMPASS_H
-#define QMLCOMPASS_H
-
-#include "qmlsensor.h"
-
-QT_BEGIN_NAMESPACE
-
-class QCompass;
-
-class QmlCompass : public QmlSensor
-{
- Q_OBJECT
-public:
- explicit QmlCompass(QObject *parent = 0);
- ~QmlCompass();
-
-
-private:
- QSensor *sensor() const override;
- QCompass *m_sensor;
- QmlSensorReading *createReading() const override;
-};
-
-class QmlCompassReading : public QmlSensorReading
-{
- Q_OBJECT
- Q_PROPERTY(qreal azimuth READ azimuth NOTIFY azimuthChanged)
- Q_PROPERTY(qreal calibrationLevel READ calibrationLevel NOTIFY calibrationLevelChanged)
-public:
- explicit QmlCompassReading(QCompass *sensor);
- ~QmlCompassReading();
-
- qreal azimuth() const;
- qreal calibrationLevel() const;
-
-Q_SIGNALS:
- void azimuthChanged();
- void calibrationLevelChanged();
-
-private:
- QSensorReading *reading() const override;
- void readingUpdate() override;
- QCompass *m_sensor;
- qreal m_azimuth;
- qreal m_calibrationLevel;
-};
-
-QT_END_NAMESPACE
-#endif
diff --git a/src/imports/sensors/qmldir b/src/imports/sensors/qmldir
deleted file mode 100644
index 8ce4a5aa..00000000
--- a/src/imports/sensors/qmldir
+++ /dev/null
@@ -1,4 +0,0 @@
-module QtSensors
-plugin declarative_sensors
-classname QtSensorsDeclarativeModule
-typeinfo plugins.qmltypes
diff --git a/src/imports/sensors/qmldistancesensor.cpp b/src/imports/sensors/qmldistancesensor.cpp
deleted file mode 100644
index f715ae0d..00000000
--- a/src/imports/sensors/qmldistancesensor.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 BlackBerry Limited. All rights reserved.
-** 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 "qmldistancesensor.h"
-#include <QDistanceSensor>
-
-/*!
- \qmltype DistanceSensor
- \instantiates QmlDistanceSensor
- \ingroup qml-sensors_type
- \inqmlmodule QtSensors
- \since QtSensors 5.4
- \inherits Sensor
- \brief The DistanceSensor element reports the distance in cm from an object to the device.
-
- The DistanceSensor element reports the distance in cm from an object to the device.
-
- This element wraps the QDistanceSensor class. Please see the documentation for
- QDistanceSensor for details.
-
- \sa DistanceReading
-*/
-
-QmlDistanceSensor::QmlDistanceSensor(QObject *parent)
- : QmlSensor(parent)
- , m_sensor(new QDistanceSensor(this))
-{
-}
-
-QmlDistanceSensor::~QmlDistanceSensor()
-{
-}
-
-QmlSensorReading *QmlDistanceSensor::createReading() const
-{
- return new QmlDistanceReading(m_sensor);
-}
-
-QSensor *QmlDistanceSensor::sensor() const
-{
- return m_sensor;
-}
-
-/*!
- \qmltype DistanceReading
- \instantiates QmlDistanceReading
- \ingroup qml-sensors_reading
- \inqmlmodule QtSensors
- \since QtSensors 5.4
- \inherits SensorReading
- \brief The DistanceReading element holds the most recent DistanceSensor reading.
-
- The DistanceReading element holds the most recent DistanceSensor reading.
-
- This element wraps the QDistanceReading class. Please see the documentation for
- QDistanceReading for details.
-
- This element cannot be directly created.
-*/
-
-QmlDistanceReading::QmlDistanceReading(QDistanceSensor *sensor)
- : QmlSensorReading(sensor)
- , m_sensor(sensor)
- , m_distance(0.0)
-{
-}
-
-QmlDistanceReading::~QmlDistanceReading()
-{
-}
-
-/*!
- \qmlproperty qreal DistanceReading::distance
- This property holds the distance measurement
-
- Please see QDistanceReading::distance for information about this property.
-*/
-
-qreal QmlDistanceReading::distance() const
-{
- return m_distance;
-}
-
-QSensorReading *QmlDistanceReading::reading() const
-{
- return m_sensor->reading();
-}
-
-void QmlDistanceReading::readingUpdate()
-{
- qreal distance = m_sensor->reading()->distance();
- if (m_distance != distance) {
- m_distance = distance;
- Q_EMIT distanceChanged();
- }
-}
diff --git a/src/imports/sensors/qmldistancesensor.h b/src/imports/sensors/qmldistancesensor.h
deleted file mode 100644
index e60e0e7e..00000000
--- a/src/imports/sensors/qmldistancesensor.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 BlackBerry Limited. All rights reserved.
-** 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 QMLDISTANCESENSOR_H
-#define QMLDISTANCESENSOR_H
-
-#include "qmlsensor.h"
-
-QT_BEGIN_NAMESPACE
-
-class QDistanceSensor;
-
-class QmlDistanceSensor : public QmlSensor
-{
- Q_OBJECT
-public:
- explicit QmlDistanceSensor(QObject *parent = 0);
- ~QmlDistanceSensor();
-
-private:
- QSensor *sensor() const override;
- QmlSensorReading *createReading() const override;
-
- QDistanceSensor *m_sensor;
-};
-
-class QmlDistanceReading : public QmlSensorReading
-{
- Q_OBJECT
- Q_PROPERTY(qreal distance READ distance NOTIFY distanceChanged)
-public:
- explicit QmlDistanceReading(QDistanceSensor *sensor);
- ~QmlDistanceReading();
-
- qreal distance() const;
-
-Q_SIGNALS:
- void distanceChanged();
-
-private:
- QSensorReading *reading() const override;
- void readingUpdate() override;
-
- QDistanceSensor *m_sensor;
- qreal m_distance;
-};
-
-QT_END_NAMESPACE
-#endif
diff --git a/src/imports/sensors/qmlgyroscope.cpp b/src/imports/sensors/qmlgyroscope.cpp
deleted file mode 100644
index 3f61b8d7..00000000
--- a/src/imports/sensors/qmlgyroscope.cpp
+++ /dev/null
@@ -1,164 +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 "qmlgyroscope.h"
-#include <QtSensors/QGyroscope>
-
-/*!
- \qmltype Gyroscope
- \instantiates QmlGyroscope
- \ingroup qml-sensors_type
- \inqmlmodule QtSensors
- \since QtSensors 5.0
- \inherits Sensor
- \brief The Gyroscope element reports on rotational acceleration
- around the X, Y and Z axes.
-
- This element wraps the QGyroscope class. Please see the documentation for
- QGyroscope for details.
-
- \sa GyroscopeReading
-*/
-
-QmlGyroscope::QmlGyroscope(QObject *parent)
- : QmlSensor(parent)
- , m_sensor(new QGyroscope(this))
-{
-}
-
-QmlGyroscope::~QmlGyroscope()
-{
-}
-
-QmlSensorReading *QmlGyroscope::createReading() const
-{
- return new QmlGyroscopeReading(m_sensor);
-}
-
-QSensor *QmlGyroscope::sensor() const
-{
- return m_sensor;
-}
-
-/*!
- \qmltype GyroscopeReading
- \instantiates QmlGyroscopeReading
- \ingroup qml-sensors_reading
- \inqmlmodule QtSensors
- \since QtSensors 5.0
- \inherits SensorReading
- \brief The GyroscopeReading element holds the most recent Gyroscope reading.
-
- The GyroscopeReading element holds the most recent Gyroscope reading.
-
- This element wraps the QGyroscopeReading class. Please see the documentation for
- QGyroscopeReading for details.
-
- This element cannot be directly created.
-*/
-
-QmlGyroscopeReading::QmlGyroscopeReading(QGyroscope *sensor)
- : QmlSensorReading(sensor)
- , m_sensor(sensor)
-{
-}
-
-QmlGyroscopeReading::~QmlGyroscopeReading()
-{
-}
-
-/*!
- \qmlproperty qreal GyroscopeReading::x
- This property holds the angular velocity around the x axis.
-
- Please see QGyroscopeReading::x for information about this property.
-*/
-
-qreal QmlGyroscopeReading::x() const
-{
- return m_x;
-}
-
-/*!
- \qmlproperty qreal GyroscopeReading::y
- This property holds the angular velocity around the y axis.
-
- Please see QGyroscopeReading::y for information about this property.
-*/
-
-qreal QmlGyroscopeReading::y() const
-{
- return m_y;
-}
-
-/*!
- \qmlproperty qreal GyroscopeReading::z
- This property holds the angular velocity around the z axis.
-
- Please see QGyroscopeReading::z for information about this property.
-*/
-
-qreal QmlGyroscopeReading::z() const
-{
- return m_z;
-}
-
-QSensorReading *QmlGyroscopeReading::reading() const
-{
- return m_sensor->reading();
-}
-
-void QmlGyroscopeReading::readingUpdate()
-{
- qreal gx = m_sensor->reading()->x();
- if (m_x != gx) {
- m_x = gx;
- Q_EMIT xChanged();
- }
- qreal gy = m_sensor->reading()->y();
- if (m_y != gy) {
- m_y = gy;
- Q_EMIT yChanged();
- }
- qreal gz = m_sensor->reading()->z();
- if (m_z != gz) {
- m_z = gz;
- Q_EMIT zChanged();
- }
-}
diff --git a/src/imports/sensors/qmlgyroscope.h b/src/imports/sensors/qmlgyroscope.h
deleted file mode 100644
index 010e4f04..00000000
--- a/src/imports/sensors/qmlgyroscope.h
+++ /dev/null
@@ -1,92 +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 QMLGYROSCOPE_H
-#define QMLGYROSCOPE_H
-
-#include "qmlsensor.h"
-
-QT_BEGIN_NAMESPACE
-
-class QGyroscope;
-
-class QmlGyroscope : public QmlSensor
-{
- Q_OBJECT
-public:
- explicit QmlGyroscope(QObject *parent = 0);
- ~QmlGyroscope();
-
-
-private:
- QSensor *sensor() const override;
- QGyroscope *m_sensor;
- QmlSensorReading *createReading() const override;
-};
-
-class QmlGyroscopeReading : public QmlSensorReading
-{
- Q_OBJECT
- Q_PROPERTY(qreal x READ x NOTIFY xChanged)
- Q_PROPERTY(qreal y READ y NOTIFY yChanged)
- Q_PROPERTY(qreal z READ z NOTIFY zChanged)
-public:
- explicit QmlGyroscopeReading(QGyroscope *sensor);
- ~QmlGyroscopeReading();
-
- qreal x() const;
- qreal y() const;
- qreal z() const;
-
-Q_SIGNALS:
- void xChanged();
- void yChanged();
- void zChanged();
-
-private:
- QSensorReading *reading() const override;
- void readingUpdate() override;
- QGyroscope *m_sensor;
- qreal m_x;
- qreal m_y;
- qreal m_z;
-};
-
-QT_END_NAMESPACE
-#endif
diff --git a/src/imports/sensors/qmlholstersensor.cpp b/src/imports/sensors/qmlholstersensor.cpp
deleted file mode 100644
index 704e2e97..00000000
--- a/src/imports/sensors/qmlholstersensor.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Research In Motion
-** 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 "qmlholstersensor.h"
-#include <QtSensors/QHolsterSensor>
-
-/*!
- \qmltype HolsterSensor
- \instantiates QmlHolsterSensor
- \ingroup qml-sensors_type
- \inqmlmodule QtSensors
- \since QtSensors 5.1
- \inherits Sensor
- \brief The HolsterSensor element reports on whether a device is holstered.
-
- The HolsterSensor element reports on whether a device is holstered.
-
- This element wraps the QHolsterSensor class. Please see the documentation for
- QHolsterSensor for details.
-
- \sa HolsterReading
-*/
-
-QmlHolsterSensor::QmlHolsterSensor(QObject *parent)
- : QmlSensor(parent)
- , m_sensor(new QHolsterSensor(this))
-{
-}
-
-QmlHolsterSensor::~QmlHolsterSensor()
-{
-}
-
-QmlSensorReading *QmlHolsterSensor::createReading() const
-{
- return new QmlHolsterReading(m_sensor);
-}
-
-QSensor *QmlHolsterSensor::sensor() const
-{
- return m_sensor;
-}
-
-/*!
- \qmltype HolsterReading
- \instantiates QmlHolsterReading
- \ingroup qml-sensors_reading
- \inqmlmodule QtSensors
- \since QtSensors 5.1
- \inherits SensorReading
- \brief The HolsterReading element holds the most recent HolsterSensor reading.
-
- The HolsterReading element holds the most recent HolsterSensor reading.
-
- This element wraps the QHolsterReading class. Please see the documentation for
- QHolsterReading for details.
-
- This element cannot be directly created.
-*/
-
-QmlHolsterReading::QmlHolsterReading(QHolsterSensor *sensor)
- : QmlSensorReading(sensor)
- , m_sensor(sensor)
- , m_holstered(false)
-{
-}
-
-QmlHolsterReading::~QmlHolsterReading()
-{
-}
-
-/*!
- \qmlproperty qreal HolsterReading::holstered
- This property holds whether the device is holstered.
-
- Please see QHolsterReading::holstered for information about this property.
-*/
-
-bool QmlHolsterReading::holstered() const
-{
- return m_holstered;
-}
-
-QSensorReading *QmlHolsterReading::reading() const
-{
- return m_sensor->reading();
-}
-
-void QmlHolsterReading::readingUpdate()
-{
- const bool holstered = m_sensor->reading()->holstered();
- if (m_holstered != holstered) {
- m_holstered = holstered;
- Q_EMIT holsteredChanged();
- }
-}
diff --git a/src/imports/sensors/qmlholstersensor.h b/src/imports/sensors/qmlholstersensor.h
deleted file mode 100644
index 630d1d85..00000000
--- a/src/imports/sensors/qmlholstersensor.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Research In Motion
-** 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 QMLHOLSTERSENSOR_H
-#define QMLHOLSTERSENSOR_H
-
-#include "qmlsensor.h"
-
-QT_BEGIN_NAMESPACE
-
-class QHolsterSensor;
-
-class QmlHolsterSensor : public QmlSensor
-{
- Q_OBJECT
-public:
- explicit QmlHolsterSensor(QObject *parent = 0);
- ~QmlHolsterSensor();
-
-private:
- QSensor *sensor() const override;
- QmlSensorReading *createReading() const override;
-
- QHolsterSensor *m_sensor;
-};
-
-class QmlHolsterReading : public QmlSensorReading
-{
- Q_OBJECT
- Q_PROPERTY(bool holstered READ holstered NOTIFY holsteredChanged)
-public:
- explicit QmlHolsterReading(QHolsterSensor *sensor);
- ~QmlHolsterReading();
-
- bool holstered() const;
-
-Q_SIGNALS:
- void holsteredChanged();
-
-private:
- QSensorReading *reading() const override;
- void readingUpdate() override;
-
- QHolsterSensor *m_sensor;
- bool m_holstered;
-};
-
-QT_END_NAMESPACE
-#endif
diff --git a/src/imports/sensors/qmlhumiditysensor.cpp b/src/imports/sensors/qmlhumiditysensor.cpp
deleted file mode 100644
index 3b30e972..00000000
--- a/src/imports/sensors/qmlhumiditysensor.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Canonical 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 "qmlhumiditysensor.h"
-#include <QtSensors/QHumiditySensor>
-
-/*!
- \qmltype HumiditySensor
- \instantiates QmlHumiditySensor
- \ingroup qml-sensors_type
- \inqmlmodule QtSensors
- \since QtSensors 5.9
- \inherits Sensor
- \brief The HumiditySensor element reports on humidity.
-
- The HumiditySensor element reports on humidity.
-
- This element wraps the QHumiditySensor class. Please see the documentation for
- QHumiditySensor for details.
-
- \sa HumidityReading
-*/
-
-QmlHumiditySensor::QmlHumiditySensor(QObject *parent)
- : QmlSensor(parent)
- , m_sensor(new QHumiditySensor(this))
-{
-}
-
-QmlHumiditySensor::~QmlHumiditySensor()
-{
-}
-
-QmlSensorReading *QmlHumiditySensor::createReading() const
-{
- return new QmlHumidityReading(m_sensor);
-}
-
-QSensor *QmlHumiditySensor::sensor() const
-{
- return m_sensor;
-}
-
-/*!
- \qmltype HumidityReading
- \instantiates QmlHumidityReading
- \ingroup qml-sensors_reading
- \inqmlmodule QtSensors
- \since QtSensors 5.9
- \inherits SensorReading
- \brief The HumidityReading element holds the most recent HumiditySensor reading.
-
- The HumidityReading element holds the most recent HumiditySensor reading.
-
- This element wraps the QHumidityReading class. Please see the documentation for
- QHumidityReading for details.
-
- This element cannot be directly created.
-*/
-
-QmlHumidityReading::QmlHumidityReading(QHumiditySensor *sensor)
- : QmlSensorReading(sensor)
- , m_sensor(sensor)
- , m_relativeHumidity(0)
- , m_absoluteHumidity(0)
-{
-}
-
-QmlHumidityReading::~QmlHumidityReading()
-{
-}
-
-/*!
- \qmlproperty qreal HumidityReading::relativeHumidity
- This property holds the relative humidity as a percentage.
-
- Please see QHumidityReading::relativeHumidity for information about this property.
-*/
-
-qreal QmlHumidityReading::relativeHumidity() const
-{
- return m_relativeHumidity;
-}
-
-/*!
- \qmlproperty qreal HumidityReading::absoluteHumidity
- This property holds the absolute humidity in grams per cubic meter (g/m3).
-
- Please see QHumidityReading::absoluteHumidity for information about this property.
-*/
-
-qreal QmlHumidityReading::absoluteHumidity() const
-{
- return m_absoluteHumidity;
-}
-
-QSensorReading *QmlHumidityReading::reading() const
-{
- return m_sensor->reading();
-}
-
-void QmlHumidityReading::readingUpdate()
-{
- qreal humidity = m_sensor->reading()->relativeHumidity();
- if (m_relativeHumidity != humidity) {
- m_relativeHumidity = humidity;
- Q_EMIT relativeHumidityChanged();
- }
- qreal abs = m_sensor->reading()->absoluteHumidity();
- if (m_absoluteHumidity != abs) {
- m_absoluteHumidity = abs;
- Q_EMIT absoluteHumidityChanged();
- }
-}
diff --git a/src/imports/sensors/qmlhumiditysensor.h b/src/imports/sensors/qmlhumiditysensor.h
deleted file mode 100644
index a84a428e..00000000
--- a/src/imports/sensors/qmlhumiditysensor.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Canonical 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 QMLHUMIDITYSENSOR_H
-#define QMLHUMIDITYSENSOR_H
-
-#include "qmlsensor.h"
-
-QT_BEGIN_NAMESPACE
-
-class QHumiditySensor;
-
-class QmlHumiditySensor : public QmlSensor
-{
- Q_OBJECT
-
-public:
- explicit QmlHumiditySensor(QObject *parent = Q_NULLPTR);
- ~QmlHumiditySensor();
-
-private:
- QSensor *sensor() const override;
- QmlSensorReading *createReading() const override;
-
- QHumiditySensor *m_sensor;
-};
-
-class QmlHumidityReading : public QmlSensorReading
-{
- Q_OBJECT
- Q_PROPERTY(qreal relativeHumidity READ relativeHumidity NOTIFY relativeHumidityChanged)
- Q_PROPERTY(qreal absoluteHumidity READ absoluteHumidity NOTIFY absoluteHumidityChanged)
-public:
- explicit QmlHumidityReading(QHumiditySensor *sensor);
- ~QmlHumidityReading();
-
- qreal relativeHumidity() const;
- qreal absoluteHumidity() const;
-
-Q_SIGNALS:
- void relativeHumidityChanged();
- void absoluteHumidityChanged();
-
-private:
- QSensorReading *reading() const override;
- void readingUpdate() override;
-
- QHumiditySensor *m_sensor;
- qreal m_relativeHumidity;
- qreal m_absoluteHumidity;
-};
-
-QT_END_NAMESPACE
-#endif
diff --git a/src/imports/sensors/qmlirproximitysensor.cpp b/src/imports/sensors/qmlirproximitysensor.cpp
deleted file mode 100644
index 9b1e72ac..00000000
--- a/src/imports/sensors/qmlirproximitysensor.cpp
+++ /dev/null
@@ -1,129 +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 "qmlirproximitysensor.h"
-#include <QtSensors/QIRProximitySensor>
-
-/*!
- \qmltype IRProximitySensor
- \instantiates QmlIRProximitySensor
- \ingroup qml-sensors_type
- \inqmlmodule QtSensors
- \since QtSensors 5.0
- \inherits Sensor
- \brief The IRProximitySensor element reports on infra-red reflectance values.
-
- This element wraps the QIRProximitySensor class. Please see the documentation for
- QIRProximitySensor for details.
-
- \sa IRProximityReading
-*/
-
-QmlIRProximitySensor::QmlIRProximitySensor(QObject *parent)
- : QmlSensor(parent)
- , m_sensor(new QIRProximitySensor(this))
-{
-}
-
-QmlIRProximitySensor::~QmlIRProximitySensor()
-{
-}
-
-QmlSensorReading *QmlIRProximitySensor::createReading() const
-{
- return new QmlIRProximitySensorReading(m_sensor);
-}
-
-QSensor *QmlIRProximitySensor::sensor() const
-{
- return m_sensor;
-}
-
-/*!
- \qmltype IRProximityReading
- \instantiates QmlIRProximitySensorReading
- \ingroup qml-sensors_reading
- \inqmlmodule QtSensors
- \since QtSensors 5.0
- \inherits SensorReading
- \brief The IRProximityReading element holds the most recent IR proximity reading.
-
- The IRProximityReading element holds the most recent IR proximity reading.
-
- This element wraps the QIRProximityReading class. Please see the documentation for
- QIRProximityReading for details.
-
- This element cannot be directly created.
-*/
-
-QmlIRProximitySensorReading::QmlIRProximitySensorReading(QIRProximitySensor *sensor)
- : QmlSensorReading(sensor)
- , m_sensor(sensor)
-{
-}
-
-QmlIRProximitySensorReading::~QmlIRProximitySensorReading()
-{
-}
-
-/*!
- \qmlproperty qreal IRProximityReading::reflectance
- This property holds the reflectance value.
-
- Please see QIRProximityReading::reflectance for information about this property.
-*/
-
-qreal QmlIRProximitySensorReading::reflectance() const
-{
- return m_reflectance;
-}
-
-QSensorReading *QmlIRProximitySensorReading::reading() const
-{
- return m_sensor->reading();
-}
-
-void QmlIRProximitySensorReading::readingUpdate()
-{
- qreal fl = m_sensor->reading()->reflectance();
- if (m_reflectance != fl) {
- m_reflectance = fl;
- Q_EMIT reflectanceChanged();
- }
-}
diff --git a/src/imports/sensors/qmlirproximitysensor.h b/src/imports/sensors/qmlirproximitysensor.h
deleted file mode 100644
index 8ba1d489..00000000
--- a/src/imports/sensors/qmlirproximitysensor.h
+++ /dev/null
@@ -1,83 +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 QMLIRPROXIMITYSENSOR_H
-#define QMLIRPROXIMITYSENSOR_H
-
-#include "qmlsensor.h"
-
-QT_BEGIN_NAMESPACE
-
-class QIRProximitySensor;
-
-class QmlIRProximitySensor : public QmlSensor
-{
- Q_OBJECT
-public:
- explicit QmlIRProximitySensor(QObject *parent = 0);
- ~QmlIRProximitySensor();
-
-private:
- QSensor *sensor() const override;
- QIRProximitySensor *m_sensor;
- QmlSensorReading *createReading() const override;
-};
-
-class QmlIRProximitySensorReading : public QmlSensorReading
-{
- Q_OBJECT
- Q_PROPERTY(qreal reflectance READ reflectance NOTIFY reflectanceChanged)
-public:
- explicit QmlIRProximitySensorReading(QIRProximitySensor *sensor);
- ~QmlIRProximitySensorReading();
-
- qreal reflectance() const;
-
-Q_SIGNALS:
- void reflectanceChanged();
-
-private:
- QSensorReading *reading() const override;
- void readingUpdate() override;
- QIRProximitySensor *m_sensor;
- qreal m_reflectance;
-};
-
-QT_END_NAMESPACE
-#endif
diff --git a/src/imports/sensors/qmllidsensor.cpp b/src/imports/sensors/qmllidsensor.cpp
deleted file mode 100644
index e6dfa4cb..00000000
--- a/src/imports/sensors/qmllidsensor.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Canonical, 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 "qmllidsensor.h"
-#include <QtSensors/QLidSensor>
-
-/*!
- \qmltype LidSensor
- \instantiates QmlLidSensor
- \ingroup qml-sensors_type
- \inqmlmodule QtSensors
- \since QtSensors 5.9
- \inherits Sensor
- \brief The LidSensor element reports on whether a device is closed.
-
- The LidSensor element reports on whether a device is closed.
-
- This element wraps the QLidSensor class. Please see the documentation for
- QLidSensor for details.
-
- \sa LidReading
-*/
-
-QmlLidSensor::QmlLidSensor(QObject *parent)
- : QmlSensor(parent)
- , m_sensor(new QLidSensor(this))
-{
-}
-
-QmlLidSensor::~QmlLidSensor()
-{
-}
-
-QmlSensorReading *QmlLidSensor::createReading() const
-{
- return new QmlLidReading(m_sensor);
-}
-
-QSensor *QmlLidSensor::sensor() const
-{
- return m_sensor;
-}
-
-/*!
- \qmltype LidReading
- \instantiates QmlLidReading
- \ingroup qml-sensors_reading
- \inqmlmodule QtSensors
- \since QtSensors 5.9
- \inherits SensorReading
- \brief The LidReading element holds the most recent LidSensor reading.
-
- The LidReading element holds the most recent LidSensor reading.
-
- This element wraps the QLidReading class. Please see the documentation for
- QLidReading for details.
-
- This element cannot be directly created.
-*/
-
-QmlLidReading::QmlLidReading(QLidSensor *sensor)
- : QmlSensorReading(sensor)
- , m_sensor(sensor)
- , m_backClosed(false)
- , m_frontClosed(true)
-{
-}
-
-QmlLidReading::~QmlLidReading()
-{
-}
-
-/*!
- \qmlproperty qreal LidReading::backLidClosed
- This property holds whether the back lid is closed.
-
- Please see QLidReading::backLidClosed for information about this property.
-*/
-
-bool QmlLidReading::backLidChanged() const
-{
- return m_backClosed;
-}
-
-/*!
- \qmlproperty qreal LidReading::frontLidClosed
- This property holds whether the front lid is closed.
-
- Please see QLidReading::frontLidClosed for information about this property.
-*/
-
-bool QmlLidReading::frontLidClosed() const
-{
- return m_frontClosed;
-}
-
-QSensorReading *QmlLidReading::reading() const
-{
- return m_sensor->reading();
-}
-
-void QmlLidReading::readingUpdate()
-{
- const bool backClosed = m_sensor->reading()->backLidClosed();
- if (m_backClosed != backClosed) {
- m_backClosed = backClosed;
- Q_EMIT backLidChanged(m_backClosed);
- }
- const bool frontClosed = m_sensor->reading()->frontLidClosed();
- if (m_frontClosed != frontClosed) {
- m_frontClosed = frontClosed;
- Q_EMIT frontLidChanged(m_frontClosed);
- }
-}
diff --git a/src/imports/sensors/qmllidsensor.h b/src/imports/sensors/qmllidsensor.h
deleted file mode 100644
index 37c2faeb..00000000
--- a/src/imports/sensors/qmllidsensor.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Canonical, 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 QMLLIDSENSOR_H
-#define QMLLIDSENSOR_H
-
-#include "qmlsensor.h"
-
-QT_BEGIN_NAMESPACE
-
-class QLidSensor;
-
-class QmlLidSensor : public QmlSensor
-{
- Q_OBJECT
-public:
- explicit QmlLidSensor(QObject *parent = 0);
- ~QmlLidSensor();
-
-private:
- QSensor *sensor() const override;
- QmlSensorReading *createReading() const override;
-
- QLidSensor *m_sensor;
-};
-
-class QmlLidReading : public QmlSensorReading
-{
- Q_OBJECT
- Q_PROPERTY(bool backLidChanged READ backLidChanged NOTIFY backLidChanged)
- Q_PROPERTY(bool frontLidClosed READ frontLidClosed NOTIFY frontLidChanged)
-public:
- explicit QmlLidReading(QLidSensor *sensor);
- ~QmlLidReading();
-
- bool backLidChanged() const;
- bool frontLidClosed() const;
-
-Q_SIGNALS:
- void backLidChanged(bool closed);
- bool frontLidChanged(bool closed);
-
-private:
- QSensorReading *reading() const override;
- void readingUpdate() override;
-
- QLidSensor *m_sensor;
- bool m_backClosed;
- bool m_frontClosed;
-};
-
-QT_END_NAMESPACE
-#endif
diff --git a/src/imports/sensors/qmllightsensor.cpp b/src/imports/sensors/qmllightsensor.cpp
deleted file mode 100644
index 2c1eb860..00000000
--- a/src/imports/sensors/qmllightsensor.cpp
+++ /dev/null
@@ -1,145 +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 "qmllightsensor.h"
-#include <QtSensors/QLightSensor>
-
-/*!
- \qmltype LightSensor
- \instantiates QmlLightSensor
- \ingroup qml-sensors_type
- \inqmlmodule QtSensors
- \since QtSensors 5.0
- \inherits Sensor
- \brief The LightSensor element reports on light levels using LUX.
-
- The LightSensor element reports on light levels using LUX.
-
- This element wraps the QLightSensor class. Please see the documentation for
- QLightSensor for details.
-
- \sa LightReading
-*/
-
-QmlLightSensor::QmlLightSensor(QObject *parent)
- : QmlSensor(parent)
- , m_sensor(new QLightSensor(this))
-{
- connect(m_sensor, SIGNAL(fieldOfViewChanged(qreal)),
- this, SIGNAL(fieldOfViewChanged(qreal)));
-}
-
-QmlLightSensor::~QmlLightSensor()
-{
-}
-
-QmlSensorReading *QmlLightSensor::createReading() const
-{
- return new QmlLightSensorReading(m_sensor);
-}
-
-QSensor *QmlLightSensor::sensor() const
-{
- return m_sensor;
-}
-
-/*!
- \qmlproperty qreal LightSensor::fieldOfView
- This property holds a value indicating the field of view.
-
- Please see QLightSensor::fieldOfView for information about this property.
-*/
-
-qreal QmlLightSensor::fieldOfView() const
-{
- return m_sensor->fieldOfView();
-}
-
-/*!
- \qmltype LightReading
- \instantiates QmlLightSensorReading
- \ingroup qml-sensors_reading
- \inqmlmodule QtSensors
- \since QtSensors 5.0
- \inherits SensorReading
- \brief The LightReading element holds the most recent LightSensor reading.
-
- The LightReading element holds the most recent LightSensor reading.
-
- This element wraps the QLightReading class. Please see the documentation for
- QLightReading for details.
-
- This element cannot be directly created.
-*/
-
-QmlLightSensorReading::QmlLightSensorReading(QLightSensor *sensor)
- : QmlSensorReading(sensor)
- , m_sensor(sensor)
-{
-}
-
-QmlLightSensorReading::~QmlLightSensorReading()
-{
-}
-
-/*!
- \qmlproperty qreal LightReading::illuminance
- This property holds the light level.
-
- Please see QLightReading::illuminance for information about this property.
-*/
-
-qreal QmlLightSensorReading::illuminance() const
-{
- return m_illuminance;
-}
-
-QSensorReading *QmlLightSensorReading::reading() const
-{
- return m_sensor->reading();
-}
-
-void QmlLightSensorReading::readingUpdate()
-{
- qreal ill = m_sensor->reading()->lux();
- if (m_illuminance != ill) {
- m_illuminance = ill;
- Q_EMIT illuminanceChanged();
- }
-}
diff --git a/src/imports/sensors/qmllightsensor.h b/src/imports/sensors/qmllightsensor.h
deleted file mode 100644
index c77b4bfe..00000000
--- a/src/imports/sensors/qmllightsensor.h
+++ /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$
-**
-****************************************************************************/
-
-#ifndef QMLLightSensor_H
-#define QMLLightSensor_H
-
-#include "qmlsensor.h"
-
-QT_BEGIN_NAMESPACE
-
-class QLightSensor;
-
-class QmlLightSensor : public QmlSensor
-{
- Q_OBJECT
- Q_PROPERTY(qreal fieldOfView READ fieldOfView NOTIFY fieldOfViewChanged)
-public:
- explicit QmlLightSensor(QObject *parent = 0);
- ~QmlLightSensor();
-
- qreal fieldOfView() const;
-
-Q_SIGNALS:
- void fieldOfViewChanged(qreal fieldOfView);
-
-private:
- QSensor *sensor() const override;
- QLightSensor *m_sensor;
- QmlSensorReading *createReading() const override;
-};
-
-class QmlLightSensorReading : public QmlSensorReading
-{
- Q_OBJECT
- Q_PROPERTY(qreal illuminance READ illuminance NOTIFY illuminanceChanged)
-public:
- explicit QmlLightSensorReading(QLightSensor *sensor);
- ~QmlLightSensorReading();
-
- qreal illuminance() const;
-
-Q_SIGNALS:
- void illuminanceChanged();
-
-private:
- QSensorReading *reading() const override;
- void readingUpdate() override;
- QLightSensor *m_sensor;
- qreal m_illuminance;
-};
-
-QT_END_NAMESPACE
-#endif
diff --git a/src/imports/sensors/qmlmagnetometer.h b/src/imports/sensors/qmlmagnetometer.h
deleted file mode 100644
index 3c3c2bae..00000000
--- a/src/imports/sensors/qmlmagnetometer.h
+++ /dev/null
@@ -1,102 +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 QMLMAGNETOMETER_H
-#define QMLMAGNETOMETER_H
-
-#include "qmlsensor.h"
-
-QT_BEGIN_NAMESPACE
-
-class QMagnetometer;
-
-class QmlMagnetometer : public QmlSensor
-{
- Q_OBJECT
- Q_PROPERTY(bool returnGeoValues READ returnGeoValues WRITE setReturnGeoValues NOTIFY returnGeoValuesChanged)
-public:
- explicit QmlMagnetometer(QObject *parent = 0);
- ~QmlMagnetometer();
-
- bool returnGeoValues() const;
- void setReturnGeoValues(bool geo);
-
-Q_SIGNALS:
- void returnGeoValuesChanged(bool returnGeoValues);
-
-private:
- QSensor *sensor() const override;
- QMagnetometer *m_sensor;
- QmlSensorReading *createReading() const override;
-};
-
-class QmlMagnetometerReading : public QmlSensorReading
-{
- Q_OBJECT
- Q_PROPERTY(qreal x READ x NOTIFY xChanged)
- Q_PROPERTY(qreal y READ y NOTIFY yChanged)
- Q_PROPERTY(qreal z READ z NOTIFY zChanged)
- Q_PROPERTY(qreal calibrationLevel READ calibrationLevel NOTIFY calibrationLevelChanged)
-public:
- explicit QmlMagnetometerReading(QMagnetometer *sensor);
- ~QmlMagnetometerReading();
-
- qreal x() const;
- qreal y() const;
- qreal z() const;
- qreal calibrationLevel() const;
-
-Q_SIGNALS:
- void xChanged();
- void yChanged();
- void zChanged();
- void calibrationLevelChanged();
-
-private:
- QSensorReading *reading() const override;
- void readingUpdate() override;
- QMagnetometer *m_sensor;
- qreal m_x;
- qreal m_y;
- qreal m_z;
- qreal m_calibrationLevel;
-};
-
-QT_END_NAMESPACE
-#endif
diff --git a/src/imports/sensors/qmlorientationsensor.h b/src/imports/sensors/qmlorientationsensor.h
deleted file mode 100644
index bdb1b1e4..00000000
--- a/src/imports/sensors/qmlorientationsensor.h
+++ /dev/null
@@ -1,86 +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 QMLORIENTATIONSENSOR_H
-#define QMLORIENTATIONSENSOR_H
-
-#include "qmlsensor.h"
-#include <QtSensors/QOrientationSensor>
-
-QT_BEGIN_NAMESPACE
-
-class QOrientationSensor;
-
-class QmlOrientationSensor : public QmlSensor
-{
- Q_OBJECT
-public:
- explicit QmlOrientationSensor(QObject *parent = 0);
- ~QmlOrientationSensor();
-
-
-private:
- QSensor *sensor() const override;
- QOrientationSensor *m_sensor;
- QmlSensorReading *createReading() const override;
-};
-
-class QmlOrientationSensorReading : public QmlSensorReading
-{
- Q_OBJECT
- Q_PROPERTY(QOrientationReading::Orientation orientation READ orientation NOTIFY orientationChanged)
-public:
-
- explicit QmlOrientationSensorReading(QOrientationSensor *sensor);
- ~QmlOrientationSensorReading();
-
- QOrientationReading::Orientation orientation() const;
-
-Q_SIGNALS:
- void orientationChanged();
-
-private:
- QSensorReading *reading() const override;
- void readingUpdate() override;
- QOrientationSensor *m_sensor;
- QOrientationReading::Orientation m_orientation;
-};
-
-QT_END_NAMESPACE
-#endif
diff --git a/src/imports/sensors/qmlpressuresensor.cpp b/src/imports/sensors/qmlpressuresensor.cpp
deleted file mode 100644
index 4ef27ba7..00000000
--- a/src/imports/sensors/qmlpressuresensor.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Research In Motion
-** 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 "qmlpressuresensor.h"
-#include <QtSensors/QPressureSensor>
-
-/*!
- \qmltype PressureSensor
- \instantiates QmlPressureSensor
- \ingroup qml-sensors_type
- \inqmlmodule QtSensors
- \since QtSensors 5.1
- \inherits Sensor
- \brief The PressureSensor element reports on atmospheric pressure values.
-
- The PressureSensor element reports on atmospheric pressure values.
-
- This element wraps the QPressureSensor class. Please see the documentation for
- QPressureSensor for details.
-
- \sa PressureReading
-*/
-
-QmlPressureSensor::QmlPressureSensor(QObject *parent)
- : QmlSensor(parent)
- , m_sensor(new QPressureSensor(this))
-{
-}
-
-QmlPressureSensor::~QmlPressureSensor()
-{
-}
-
-QmlSensorReading *QmlPressureSensor::createReading() const
-{
- return new QmlPressureReading(m_sensor);
-}
-
-QSensor *QmlPressureSensor::sensor() const
-{
- return m_sensor;
-}
-
-/*!
- \qmltype PressureReading
- \instantiates QmlPressureReading
- \ingroup qml-sensors_reading
- \inqmlmodule QtSensors
- \since QtSensors 5.1
- \inherits SensorReading
- \brief The PressureReading element holds the most recent PressureSensor reading.
-
- The PressureReading element holds the most recent PressureSensor reading.
-
- This element wraps the QPressureReading class. Please see the documentation for
- QPressureReading for details.
-
- This element cannot be directly created.
-*/
-
-QmlPressureReading::QmlPressureReading(QPressureSensor *sensor)
- : QmlSensorReading(sensor)
- , m_sensor(sensor)
- , m_pressure(0)
- , m_temperature(0)
-{
-}
-
-QmlPressureReading::~QmlPressureReading()
-{
-}
-
-/*!
- \qmlproperty qreal PressureReading::pressure
- This property holds the atmospheric pressure value in Pascals.
-
- Please see QPressureReading::pressure for information about this property.
-*/
-
-qreal QmlPressureReading::pressure() const
-{
- return m_pressure;
-}
-
-/*!
- \qmlproperty qreal PressureReading::temperature
- This property holds the pressure sensor's temperature value in degrees Celsius.
-
- Please see QPressureReading::temperature for information about this property.
- \since QtSensors 5.2
-*/
-
-qreal QmlPressureReading::temperature() const
-{
- return m_temperature;
-}
-
-QSensorReading *QmlPressureReading::reading() const
-{
- return m_sensor->reading();
-}
-
-void QmlPressureReading::readingUpdate()
-{
- qreal pressure = m_sensor->reading()->pressure();
- if (m_pressure != pressure) {
- m_pressure = pressure;
- Q_EMIT pressureChanged();
- }
-
- qreal temperature = m_sensor->reading()->temperature();
- if (m_temperature != temperature) {
- m_temperature = temperature;
- Q_EMIT temperatureChanged();
- }
-}
diff --git a/src/imports/sensors/qmlpressuresensor.h b/src/imports/sensors/qmlpressuresensor.h
deleted file mode 100644
index 6304d69c..00000000
--- a/src/imports/sensors/qmlpressuresensor.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Research In Motion
-** 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 QMLPRESSURESENSOR_H
-#define QMLPRESSURESENSOR_H
-
-#include "qmlsensor.h"
-
-QT_BEGIN_NAMESPACE
-
-class QPressureSensor;
-
-class QmlPressureSensor : public QmlSensor
-{
- Q_OBJECT
-public:
- explicit QmlPressureSensor(QObject *parent = 0);
- ~QmlPressureSensor();
-
-private:
- QSensor *sensor() const override;
- QmlSensorReading *createReading() const override;
-
- QPressureSensor *m_sensor;
-};
-
-class QmlPressureReading : public QmlSensorReading
-{
- Q_OBJECT
- Q_PROPERTY(qreal pressure READ pressure NOTIFY pressureChanged)
- Q_PROPERTY(qreal temperature READ temperature NOTIFY temperatureChanged REVISION 1)
-public:
- explicit QmlPressureReading(QPressureSensor *sensor);
- ~QmlPressureReading();
-
- qreal pressure() const;
- qreal temperature() const;
-
-Q_SIGNALS:
- void pressureChanged();
- Q_REVISION(1) void temperatureChanged();
-
-private:
- QSensorReading *reading() const override;
- void readingUpdate() override;
-
- QPressureSensor *m_sensor;
- qreal m_pressure;
- qreal m_temperature;
-};
-
-QT_END_NAMESPACE
-#endif
diff --git a/src/imports/sensors/qmlproximitysensor.cpp b/src/imports/sensors/qmlproximitysensor.cpp
deleted file mode 100644
index 84993574..00000000
--- a/src/imports/sensors/qmlproximitysensor.cpp
+++ /dev/null
@@ -1,131 +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 "qmlproximitysensor.h"
-#include <QtSensors/QProximitySensor>
-
-/*!
- \qmltype ProximitySensor
- \instantiates QmlProximitySensor
- \ingroup qml-sensors_type
- \inqmlmodule QtSensors
- \since QtSensors 5.0
- \inherits Sensor
- \brief The ProximitySensor element reports on object proximity.
-
- The ProximitySensor element reports on object proximity.
-
- This element wraps the QProximitySensor class. Please see the documentation for
- QProximitySensor for details.
-
- \sa ProximityReading
-*/
-
-QmlProximitySensor::QmlProximitySensor(QObject *parent)
- : QmlSensor(parent)
- , m_sensor(new QProximitySensor(this))
-{
-}
-
-QmlProximitySensor::~QmlProximitySensor()
-{
-}
-
-QmlSensorReading *QmlProximitySensor::createReading() const
-{
- return new QmlProximitySensorReading(m_sensor);
-}
-
-QSensor *QmlProximitySensor::sensor() const
-{
- return m_sensor;
-}
-
-/*!
- \qmltype ProximityReading
- \instantiates QmlProximitySensorReading
- \ingroup qml-sensors_reading
- \inqmlmodule QtSensors
- \since QtSensors 5.0
- \inherits SensorReading
- \brief The ProximityReading element holds the most recent ProximitySensor reading.
-
- The ProximityReading element holds the most recent ProximitySensor reading.
-
- This element wraps the QProximityReading class. Please see the documentation for
- QProximityReading for details.
-
- This element cannot be directly created.
-*/
-
-QmlProximitySensorReading::QmlProximitySensorReading(QProximitySensor *sensor)
- : QmlSensorReading(sensor)
- , m_sensor(sensor)
-{
-}
-
-QmlProximitySensorReading::~QmlProximitySensorReading()
-{
-}
-
-/*!
- \qmlproperty bool ProximityReading::near
- This property holds a value indicating if something is near.
-
- Please see QProximityReading::near for information about this property.
-*/
-
-bool QmlProximitySensorReading::near() const
-{
- return m_near;
-}
-
-QSensorReading *QmlProximitySensorReading::reading() const
-{
- return m_sensor->reading();
-}
-
-void QmlProximitySensorReading::readingUpdate()
-{
- bool pNear = m_sensor->reading()->close();
- if (m_near != pNear) {
- m_near = pNear;
- Q_EMIT nearChanged();
- }
-}
diff --git a/src/imports/sensors/qmlproximitysensor.h b/src/imports/sensors/qmlproximitysensor.h
deleted file mode 100644
index 8bab8cfa..00000000
--- a/src/imports/sensors/qmlproximitysensor.h
+++ /dev/null
@@ -1,86 +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 QMLPROXIMITYSENSOR_H
-#define QMLPROXIMITYSENSOR_H
-
-#include "qmlsensor.h"
-#ifdef near
-#undef near
-#endif
-QT_BEGIN_NAMESPACE
-
-class QProximitySensor;
-
-class QmlProximitySensor : public QmlSensor
-{
- Q_OBJECT
-public:
- explicit QmlProximitySensor(QObject *parent = 0);
- ~QmlProximitySensor();
-
-
-private:
- QSensor *sensor() const override;
- QProximitySensor *m_sensor;
- QmlSensorReading *createReading() const override;
-};
-
-class QmlProximitySensorReading : public QmlSensorReading
-{
- Q_OBJECT
- Q_PROPERTY(bool near READ near NOTIFY nearChanged)
-public:
- explicit QmlProximitySensorReading(QProximitySensor *sensor);
- ~QmlProximitySensorReading();
-
- bool near() const;
-
-Q_SIGNALS:
- void nearChanged();
-
-private:
- QSensorReading *reading() const override;
- void readingUpdate() override;
- QProximitySensor *m_sensor;
- bool m_near;
-};
-
-QT_END_NAMESPACE
-#endif
diff --git a/src/imports/sensors/qmlrotationsensor.h b/src/imports/sensors/qmlrotationsensor.h
deleted file mode 100644
index c0760ac9..00000000
--- a/src/imports/sensors/qmlrotationsensor.h
+++ /dev/null
@@ -1,98 +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 QMLROTATIONSENSOR_H
-#define QMLROTATIONSENSOR_H
-
-#include "qmlsensor.h"
-
-QT_BEGIN_NAMESPACE
-
-class QRotationSensor;
-
-class QmlRotationSensor : public QmlSensor
-{
- Q_OBJECT
- Q_PROPERTY(bool hasZ READ hasZ NOTIFY hasZChanged)
-public:
- explicit QmlRotationSensor(QObject *parent = 0);
- ~QmlRotationSensor();
-
- bool hasZ() const;
-
-Q_SIGNALS:
- void hasZChanged(bool hasZ);
-
-private:
- QSensor *sensor() const override;
- void _update() override;
- QRotationSensor *m_sensor;
- QmlSensorReading *createReading() const override;
-};
-
-class QmlRotationSensorReading : public QmlSensorReading
-{
- Q_OBJECT
- Q_PROPERTY(qreal x READ x NOTIFY xChanged)
- Q_PROPERTY(qreal y READ y NOTIFY yChanged)
- Q_PROPERTY(qreal z READ z NOTIFY zChanged)
-public:
- explicit QmlRotationSensorReading(QRotationSensor *sensor);
- ~QmlRotationSensorReading();
-
- qreal x() const;
- qreal y() const;
- qreal z() const;
-
-Q_SIGNALS:
- void xChanged();
- void yChanged();
- void zChanged();
-
-private:
- QSensorReading *reading() const override;
- void readingUpdate() override;
- QRotationSensor *m_sensor;
- qreal m_x;
- qreal m_y;
- qreal m_z;
-};
-
-QT_END_NAMESPACE
-#endif
diff --git a/src/imports/sensors/qmlsensorgesture.cpp b/src/imports/sensors/qmlsensorgesture.cpp
deleted file mode 100644
index 2e7f104c..00000000
--- a/src/imports/sensors/qmlsensorgesture.cpp
+++ /dev/null
@@ -1,262 +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 "qmlsensorgesture.h"
-#include <QtSensors/qsensorgesture.h>
-#include <QtSensors/qsensorgesturemanager.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype SensorGesture
- \instantiates QmlSensorGesture
- \inqmlmodule QtSensors
- \since QtSensors 5.0
- \brief Provides notifications when sensor-based gestures are detected.
-
- This type provides notification when sensor gestures are triggered.
-
- The following QML code creates a "shake" and "SecondCounter" SensorGesture QML type, and
- displays the detected gesture in a text type.
-
- QtSensors.shake gesture is available with the Qt Sensors API, but the QtSensors.SecondCounter
- sensor gesture is provided as example code for the \l {Qt Sensors - SensorGesture QML Type example}
-
- \qml
- Item {
- SensorGesture {
- id: sensorGesture
- enabled: false
- gestures : ["QtSensors.shake", "QtSensors.SecondCounter"]
- onDetected:{
- detectedText.text = gesture
- }
- }
- Text {
- id: detectedText
- x:5
- y:160
- }
- }
- \endqml
-
- \l {Qt Sensor Gestures} contains a list of currently supported sensor gestures and their
- descriptions.
-
-
-*/
-QmlSensorGesture::QmlSensorGesture(QObject* parent)
- : QObject(parent)
- , isEnabled(false)
- , initDone(false)
- , sensorGesture(0)
- , sensorGestureManager(new QSensorGestureManager(this))
-{
- connect(sensorGestureManager, SIGNAL(newSensorGestureAvailable()), SIGNAL(availableGesturesChanged()));
-}
-
-QmlSensorGesture::~QmlSensorGesture()
-{
-}
-
-/*
- QQmlParserStatus interface implementation
-*/
-void QmlSensorGesture::classBegin()
-{
-}
-
-void QmlSensorGesture::componentComplete()
-{
- /*
- this is needed in the case the customer defines the type(s) and set it enabled = true
- */
- initDone = true;
- setEnabled(isEnabled);
-}
-/*
- End of QQmlParserStatus interface implementation
-*/
-
-/*!
- \qmlproperty stringlist SensorGesture::availableGestures
- This property can be used to determine all available gestures on the system.
-*/
-QStringList QmlSensorGesture::availableGestures()
-{
- return sensorGestureManager->gestureIds();
-}
-
-/*!
- \qmlproperty stringlist SensorGesture::gestures
- Set this property to a list of the gestures that the application is interested in detecting.
- This property cannot be changed while the type is enabled.
-
- The properties validGestures and invalidGestures will be set as appropriate immediately.
- To determine all available getures on the system please use the
- \l {SensorGesture::availableGestures} {availableGestures} property.
-
- \sa {QtSensorGestures Plugins}
-*/
-QStringList QmlSensorGesture::gestures() const
-{
- return gestureList;
-}
-
-void QmlSensorGesture::setGestures(const QStringList& value)
-{
- if (gestureList == value)
- return;
-
- if (initDone && enabled()) {
- qWarning() << "Cannot change gestures while running.";
- return;
- }
- gestureList = value;
- createGesture();
- Q_EMIT gesturesChanged();
-}
-
-
-/*!
- \qmlproperty stringlist SensorGesture::validGestures
- This property holds the requested gestures that were found on the system.
-*/
-QStringList QmlSensorGesture::validGestures() const
-{
- if (sensorGesture)
- return sensorGesture->validIds();
- return QStringList();
-}
-
-/*!
- \qmlproperty stringlist SensorGesture::invalidGestures
- This property holds the requested gestures that were not found on the system.
-*/
-QStringList QmlSensorGesture::invalidGestures() const
-{
- if (sensorGesture)
- return sensorGesture->invalidIds();
- return QStringList();
-}
-
-/*!
- \qmlproperty bool SensorGesture::enabled
- This property can be used to activate or deactivate the sensor gesture.
- Default value is false;
- \sa {SensorGesture::detected}, {detected}
-*/
-bool QmlSensorGesture::enabled() const
-{
- return isEnabled;
-}
-
-void QmlSensorGesture::setEnabled(bool value)
-{
- bool hasChanged = false;
- if (isEnabled != value) {
- isEnabled = value;
- hasChanged = true;
- }
- if (!initDone)
- return;
-
- if (sensorGesture) {
- if (value) {
- sensorGesture->startDetection();
- } else {
- sensorGesture->stopDetection();
- }
- }
- if (hasChanged)
- Q_EMIT enabledChanged();
-}
-
-/*!
- \qmlsignal SensorGesture::detected(string gesture)
- This signal is emitted whenever a gesture is detected.
- The \a gesture parameter contains the gesture that was detected.
-
- The corresponding handler is \c onDetected.
-*/
-
-/*
- private function implementation
-*/
-void QmlSensorGesture::deleteGesture()
-{
- if (sensorGesture) {
- bool emitInvalidChange = !invalidGestures().isEmpty();
- bool emitValidChange = !validGestures().isEmpty();
-
- if (sensorGesture->isActive()) {
- sensorGesture->stopDetection();
- }
- delete sensorGesture;
- sensorGesture = 0;
-
- if (emitInvalidChange) {
- Q_EMIT invalidGesturesChanged();
- }
- if (emitValidChange) {
- Q_EMIT validGesturesChanged();
- }
- }
-}
-
-void QmlSensorGesture::createGesture()
-{
- deleteGesture();
- sensorGesture = new QSensorGesture(gestureList, this);
- if (!validGestures().isEmpty()) {
- QObject::connect(sensorGesture
- , SIGNAL(detected(QString))
- , this
- , SIGNAL(detected(QString)));
- Q_EMIT validGesturesChanged();
- }
- if (!invalidGestures().isEmpty())
- Q_EMIT invalidGesturesChanged();
-}
-
-/*
- End of private function implementation
-*/
-
-QT_END_NAMESPACE
diff --git a/src/imports/sensors/qmlsensorgesture.h b/src/imports/sensors/qmlsensorgesture.h
deleted file mode 100644
index 7cd4acaa..00000000
--- a/src/imports/sensors/qmlsensorgesture.h
+++ /dev/null
@@ -1,100 +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 QMLSENSORGESTURE_H
-#define QMLSENSORGESTURE_H
-
-#include <QQmlParserStatus>
-#include <QStringList>
-
-QT_BEGIN_NAMESPACE
-
-class QSensorGesture;
-class QSensorGestureManager;
-
-class QmlSensorGesture : public QObject, public QQmlParserStatus
-{
- Q_OBJECT
- Q_PROPERTY(QStringList availableGestures READ availableGestures NOTIFY availableGesturesChanged)
- Q_PROPERTY(QStringList gestures READ gestures WRITE setGestures NOTIFY gesturesChanged)
- Q_PROPERTY(QStringList validGestures READ validGestures NOTIFY validGesturesChanged)
- Q_PROPERTY(QStringList invalidGestures READ invalidGestures NOTIFY invalidGesturesChanged)
- Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
- Q_INTERFACES(QQmlParserStatus)
-
-public:
- explicit QmlSensorGesture(QObject* parent = 0);
- ~QmlSensorGesture();
- void classBegin() override;
- void componentComplete() override;
-
-Q_SIGNALS:
- void detected(const QString &gesture);
- void availableGesturesChanged();
- void gesturesChanged();
- void validGesturesChanged();
- void invalidGesturesChanged();
- void enabledChanged();
-
-public:
- QStringList availableGestures();
- QStringList gestures() const;
- void setGestures(const QStringList& value);
- bool enabled() const;
- void setEnabled(bool value);
- QStringList validGestures() const;
- QStringList invalidGestures() const;
-
-private:
- void deleteGesture();
- void createGesture();
-
-private:
- QStringList gestureIds;
- bool isEnabled;
- bool initDone;
- QStringList gestureList;
-
- QSensorGesture* sensorGesture;
- QSensorGestureManager* sensorGestureManager;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/imports/sensors/qmlsensorglobal.cpp b/src/imports/sensors/qmlsensorglobal.cpp
deleted file mode 100644
index c2a67e85..00000000
--- a/src/imports/sensors/qmlsensorglobal.cpp
+++ /dev/null
@@ -1,121 +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 "qmlsensorglobal.h"
-#include <QtSensors/QSensor>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype QmlSensors
- \instantiates QmlSensorGlobal
- \inqmlmodule QtSensors
- \since QtSensors 5.0
- \brief The QmlSensors singleton provides the module API.
-
- The QmlSensors singleton provides the module API.
-
- This element cannot be directly created. It can only be accessed via a namespace import.
-
- \code
- import QtSensors 5.11
- import QtSensors 5.11 as Sensors
- ...
- Component.onCompleted: {
- var types = Sensors.QmlSensors.sensorTypes();
- console.log(types.join(", "));
- }
- \endcode
-*/
-
-QmlSensorGlobal::QmlSensorGlobal(QObject *parent)
- : QObject(parent)
- , m_sensor(new QSensor(QByteArray(), this))
-{
- connect(m_sensor, SIGNAL(availableSensorsChanged()), this, SIGNAL(availableSensorsChanged()));
-}
-
-QmlSensorGlobal::~QmlSensorGlobal()
-{
-}
-
-/*!
- \qmlmethod list<string> QmlSensors::sensorTypes()
- Returns a list of the sensor types that have been registered.
-
- Please see QSensor::sensorTypes() for information.
-*/
-QStringList QmlSensorGlobal::sensorTypes() const
-{
- QStringList ret;
- const QList<QByteArray> sensorTypes = QSensor::sensorTypes();
- ret.reserve(sensorTypes.count());
- foreach (const QByteArray &type, sensorTypes)
- ret << QString::fromLocal8Bit(type);
- return ret;
-}
-
-/*!
- \qmlmethod list<string> QmlSensors::sensorsForType(type)
- Returns a list of the sensor identifiers that have been registered for \a type.
-
- Please see QSensor::sensorsForType() for information.
-*/
-QStringList QmlSensorGlobal::sensorsForType(const QString &type) const
-{
- QStringList ret;
- const QList<QByteArray> sensors = QSensor::sensorsForType(type.toLocal8Bit());
- ret.reserve(sensors.count());
- foreach (const QByteArray &identifier, sensors)
- ret << QString::fromLocal8Bit(identifier);
- return ret;
-}
-
-/*!
- \qmlmethod string QmlSensors::defaultSensorForType(type)
- Returns the default sensor identifier that has been registered for \a type.
-
- Please see QSensor::defaultSensorForType() for information.
-*/
-QString QmlSensorGlobal::defaultSensorForType(const QString &type) const
-{
- return QString::fromLocal8Bit(QSensor::defaultSensorForType(type.toLocal8Bit()));
-}
-
-QT_END_NAMESPACE
diff --git a/src/imports/sensors/qmlsensorglobal.h b/src/imports/sensors/qmlsensorglobal.h
deleted file mode 100644
index b6524cd2..00000000
--- a/src/imports/sensors/qmlsensorglobal.h
+++ /dev/null
@@ -1,70 +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 QMLSENSORGLOBAL_H
-#define QMLSENSORGLOBAL_H
-
-#include <QObject>
-#include <QStringList>
-
-QT_BEGIN_NAMESPACE
-
-class QSensor;
-
-class QmlSensorGlobal : public QObject
-{
- Q_OBJECT
-public:
- explicit QmlSensorGlobal(QObject *parent = 0);
- ~QmlSensorGlobal();
-
- Q_INVOKABLE QStringList sensorTypes() const;
- Q_INVOKABLE QStringList sensorsForType(const QString &type) const;
- Q_INVOKABLE QString defaultSensorForType(const QString &type) const;
-
-Q_SIGNALS:
- void availableSensorsChanged();
-
-private:
- QSensor *m_sensor;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/imports/sensors/qmlsensorrange.cpp b/src/imports/sensors/qmlsensorrange.cpp
deleted file mode 100644
index 128f4a65..00000000
--- a/src/imports/sensors/qmlsensorrange.cpp
+++ /dev/null
@@ -1,88 +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 "qmlsensorrange.h"
-
-QmlSensorRange::QmlSensorRange(QObject *parent)
- : QObject(parent),
- min(0),
- max(0)
-{
-}
-
-QmlSensorRange::~QmlSensorRange()
-{
-}
-
-int QmlSensorRange::minimum() const
-{
- return min;
-}
-
-int QmlSensorRange::maximum() const
-{
- return max;
-}
-
-QmlSensorOutputRange::QmlSensorOutputRange(QObject *parent)
- : QObject(parent),
- min(0),
- max(0),
- acc(0)
-{
-}
-
-QmlSensorOutputRange::~QmlSensorOutputRange()
-{
-}
-
-qreal QmlSensorOutputRange::minimum() const
-{
- return min;
-}
-
-qreal QmlSensorOutputRange::maximum() const
-{
- return max;
-}
-
-qreal QmlSensorOutputRange::accuracy() const
-{
- return acc;
-}
diff --git a/src/imports/sensors/qmlsensorrange.h b/src/imports/sensors/qmlsensorrange.h
deleted file mode 100644
index 4c638f6f..00000000
--- a/src/imports/sensors/qmlsensorrange.h
+++ /dev/null
@@ -1,94 +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 QMLSENSORRANGE_H
-#define QMLSENSORRANGE_H
-
-#include <QObject>
-
-QT_BEGIN_NAMESPACE
-
-class QmlSensorRange : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(int minimum READ minimum)
- Q_PROPERTY(int maximum READ maximum)
-public:
- explicit QmlSensorRange(QObject *parent = 0);
- ~QmlSensorRange();
-
- int minimum() const;
- void setMinumum(int mini) { min = mini; }
-
- int maximum() const;
- void setMaximum(int maxi) { max = maxi; }
-
-private:
-
- int min;
- int max;
-};
-
-class QmlSensorOutputRange : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(qreal minimum READ minimum)
- Q_PROPERTY(qreal maximum READ maximum)
- Q_PROPERTY(qreal accuracy READ accuracy)
-public:
- explicit QmlSensorOutputRange(QObject *parent = 0);
- ~QmlSensorOutputRange();
-
- qreal minimum() const;
- void setMinimum(int mini) { min = mini; }
-
- qreal maximum() const;
- void setMaximum(int maxi) { max = maxi; }
-
- qreal accuracy() const;
- void setAccuracy(int accu) { acc = accu; }
-
-private:
- qreal min;
- qreal max;
- qreal acc;
-};
-
-QT_END_NAMESPACE
-#endif
diff --git a/src/imports/sensors/qmltapsensor.h b/src/imports/sensors/qmltapsensor.h
deleted file mode 100644
index 260cb2c2..00000000
--- a/src/imports/sensors/qmltapsensor.h
+++ /dev/null
@@ -1,96 +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 QMLTAPSENSOR_H
-#define QMLTAPSENSOR_H
-
-#include "qmlsensor.h"
-#include <QtSensors/QTapSensor>
-
-QT_BEGIN_NAMESPACE
-
-class QTapSensor;
-
-class QmlTapSensor : public QmlSensor
-{
- Q_OBJECT
- Q_PROPERTY(bool returnDoubleTapEvents READ returnDoubleTapEvents WRITE setReturnDoubleTapEvents NOTIFY returnDoubleTapEventsChanged)
-public:
- explicit QmlTapSensor(QObject *parent = 0);
- ~QmlTapSensor();
-
- bool returnDoubleTapEvents() const;
- void setReturnDoubleTapEvents(bool ret);
-
-Q_SIGNALS:
- void returnDoubleTapEventsChanged(bool returnDoubleTapEvents);
-
-private:
- QSensor *sensor() const override;
- QTapSensor *m_sensor;
- QmlSensorReading *createReading() const override;
-};
-
-class QmlTapSensorReading : public QmlSensorReading
-{
- Q_OBJECT
- Q_PROPERTY(QTapReading::TapDirection tapDirection READ tapDirection NOTIFY tapDirectionChanged)
- Q_PROPERTY(bool doubleTap READ isDoubleTap NOTIFY isDoubleTapChanged)
-public:
-
- explicit QmlTapSensorReading(QTapSensor *sensor);
- ~QmlTapSensorReading();
-
- QTapReading::TapDirection tapDirection() const;
- bool isDoubleTap() const;
-
-Q_SIGNALS:
- void tapDirectionChanged();
- void isDoubleTapChanged();
-
-private:
- QSensorReading *reading() const override;
- void readingUpdate() override;
- QTapSensor *m_sensor;
- QTapReading::TapDirection m_tapDirection;
- bool m_isDoubleTap;
-};
-
-QT_END_NAMESPACE
-#endif
diff --git a/src/imports/sensors/qmltiltsensor.cpp b/src/imports/sensors/qmltiltsensor.cpp
deleted file mode 100644
index 6129a5c9..00000000
--- a/src/imports/sensors/qmltiltsensor.cpp
+++ /dev/null
@@ -1,163 +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 "qmltiltsensor.h"
-#include <QtSensors/qtiltsensor.h>
-
-QT_BEGIN_NAMESPACE
-QT_END_NAMESPACE
-
-/*!
- \qmltype TiltSensor
- \instantiates QmlTiltSensor
- \ingroup qml-sensors_type
- \inqmlmodule QtSensors
- \since QtSensors 5.0
- \inherits Sensor
- \brief The TiltSensor element reports tilt events
- along the X and Y axes.
-
- The TiltSensor element reports tilt events along the X and Y axes.
-
- This element wraps the QTiltSensor class. Please see the documentation for
- QTiltSensor for details.
-
- \sa TiltReading
-*/
-
-QmlTiltSensor::QmlTiltSensor(QObject *parent)
- : QmlSensor(parent)
- , m_sensor(new QTiltSensor(this))
-{
-}
-
-QmlTiltSensor::~QmlTiltSensor()
-{
-}
-
-QmlSensorReading *QmlTiltSensor::createReading() const
-{
- return new QmlTiltSensorReading(m_sensor);
-}
-
-QSensor *QmlTiltSensor::sensor() const
-{
- return m_sensor;
-}
-
-/*!
- \qmlmethod TiltSensor::calibrate()
- Calibrate the tilt sensor.
-
- Please see QTiltSensor::calibrate() for information about this property.
-*/
-void QmlTiltSensor::calibrate()
-{
- m_sensor->calibrate();
-}
-
-/*!
- \qmltype TiltReading
- \instantiates QmlTiltSensorReading
- \ingroup qml-sensors_reading
- \inqmlmodule QtSensors
- \since QtSensors 5.0
- \inherits SensorReading
- \brief The TiltReading element holds the most recent TiltSensor reading.
-
- The TiltReading element holds the most recent TiltSensor reading.
-
- This element wraps the QTiltReading class. Please see the documentation for
- QTiltReading for details.
-
- This element cannot be directly created.
-*/
-
-QmlTiltSensorReading::QmlTiltSensorReading(QTiltSensor *sensor)
- : QmlSensorReading(sensor)
- , m_sensor(sensor)
-{
-}
-
-QmlTiltSensorReading::~QmlTiltSensorReading()
-{
-}
-
-/*!
- \qmlproperty qreal TiltReading::yRotation
- This property holds the amount of tilt on the Y axis.
-
- Please see QTiltReading::yRotation for information about this property.
-*/
-
-qreal QmlTiltSensorReading::yRotation() const
-{
- return m_yRotation;
-}
-
-/*!
- \qmlproperty qreal TiltReading::xRotation
- This property holds the amount of tilt on the X axis.
-
- Please see QTiltReading::xRotation for information about this property.
-*/
-
-qreal QmlTiltSensorReading::xRotation() const
-{
- return m_xRotation;
-}
-
-QSensorReading *QmlTiltSensorReading::reading() const
-{
- return m_sensor->reading();
-}
-
-void QmlTiltSensorReading::readingUpdate()
-{
- qreal tiltY = m_sensor->reading()->yRotation();
- if (m_yRotation != tiltY) {
- m_yRotation = tiltY;
- Q_EMIT yRotationChanged();
- }
- qreal tiltX = m_sensor->reading()->xRotation();
- if (m_xRotation != tiltX) {
- m_xRotation = tiltX;
- Q_EMIT xRotationChanged();
- }
-}
diff --git a/src/imports/sensors/qmltiltsensor.h b/src/imports/sensors/qmltiltsensor.h
deleted file mode 100644
index c922cb8c..00000000
--- a/src/imports/sensors/qmltiltsensor.h
+++ /dev/null
@@ -1,90 +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 QMLTILTSENSOR_H
-#define QMLTILTSENSOR_H
-
-#include "qmlsensor.h"
-#include <QtSensors/QTiltSensor>
-
-QT_BEGIN_NAMESPACE
-
-class QTiltSensor;
-
-class QmlTiltSensor : public QmlSensor
-{
- Q_OBJECT
-public:
-
- explicit QmlTiltSensor(QObject *parent = 0);
- ~QmlTiltSensor();
- Q_INVOKABLE void calibrate();
-
-private:
- QSensor *sensor() const override;
- QTiltSensor *m_sensor;
- QmlSensorReading *createReading() const override;
-};
-
-class QmlTiltSensorReading : public QmlSensorReading
-{
- Q_OBJECT
- Q_PROPERTY(qreal yRotation READ yRotation NOTIFY yRotationChanged)
- Q_PROPERTY(qreal xRotation READ xRotation NOTIFY xRotationChanged)
-public:
- explicit QmlTiltSensorReading(QTiltSensor *sensor);
- ~QmlTiltSensorReading();
-
- qreal yRotation() const;
- qreal xRotation() const;
-
-Q_SIGNALS:
- void yRotationChanged();
- void xRotationChanged();
-
-private:
- QSensorReading *reading() const override;
- void readingUpdate() override;
- QTiltSensor *m_sensor;
- qreal m_yRotation;
- qreal m_xRotation;
-};
-
-QT_END_NAMESPACE
-#endif
diff --git a/src/imports/sensors/sensors.cpp b/src/imports/sensors/sensors.cpp
deleted file mode 100644
index ce80a45c..00000000
--- a/src/imports/sensors/sensors.cpp
+++ /dev/null
@@ -1,244 +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 <QtQml/qqmlextensionplugin.h>
-#include <QtQml/qqml.h>
-#include <QtSensors/QSensorManager>
-
-#include <QtSensors/qaccelerometer.h>
-#include <QtSensors/qaltimeter.h>
-#include <QtSensors/qambientlightsensor.h>
-#include <QtSensors/qambienttemperaturesensor.h>
-#include <QtSensors/qcompass.h>
-#include <QtSensors/qdistancesensor.h>
-#include <QtSensors/qhumiditysensor.h>
-#include <QtSensors/qmagnetometer.h>
-#include <QtSensors/qorientationsensor.h>
-#include <QtSensors/qproximitysensor.h>
-#include <QtSensors/qrotationsensor.h>
-#include <QtSensors/qtapsensor.h>
-#include <QtSensors/qlightsensor.h>
-#include <QtSensors/qgyroscope.h>
-#include <QtSensors/qirproximitysensor.h>
-#include <QtSensors/qtiltsensor.h>
-#include <QtSensors/qlidsensor.h>
-
-#include "qmlsensorglobal.h"
-#include "qmlsensor.h"
-#include "qmlaccelerometer.h"
-#include "qmlaltimeter.h"
-#include "qmlambientlightsensor.h"
-#include "qmlambienttemperaturesensor.h"
-#include "qmlcompass.h"
-#include "qmldistancesensor.h"
-#include "qmlgyroscope.h"
-#include "qmlholstersensor.h"
-#include "qmlhumiditysensor.h"
-#include "qmlirproximitysensor.h"
-#include "qmllightsensor.h"
-#include "qmlmagnetometer.h"
-#include "qmlorientationsensor.h"
-#include "qmlpressuresensor.h"
-#include "qmlproximitysensor.h"
-#include "qmlrotationsensor.h"
-#include "qmltapsensor.h"
-#include "qmltiltsensor.h"
-#include "qmlsensorgesture.h"
-#include "qmllidsensor.h"
-
-QT_BEGIN_NAMESPACE
-
-static QObject *global_object_50(QQmlEngine *, QJSEngine *)
-{
- return new QmlSensorGlobal;
-}
-
-class QtSensorsDeclarativeModule : public QQmlExtensionPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid FILE "plugin.json")
-public:
- QtSensorsDeclarativeModule(QObject *parent = 0) : QQmlExtensionPlugin(parent) { }
- void registerTypes(const char *uri) override
- {
- char const * const package = "QtSensors";
- if (QLatin1String(uri) != QLatin1String(package)) return;
- int major;
- int minor;
-
- // Register the 5.0 interfaces
- major = 5;
- minor = 0;
- qmlRegisterSingletonType <QmlSensorGlobal >(package, major, minor, "QmlSensors", global_object_50);
- qmlRegisterUncreatableType<QmlSensorRange >(package, major, minor, "Range", QLatin1String("Cannot create Range"));
- qmlRegisterUncreatableType<QmlSensorOutputRange >(package, major, minor, "OutputRange", QLatin1String("Cannot create OutputRange"));
- qmlRegisterUncreatableType<QmlSensor >(package, major, minor, "Sensor", QLatin1String("Cannot create Sensor"));
- qmlRegisterUncreatableType<QmlSensorReading >(package, major, minor, "SensorReading", QLatin1String("Cannot create SensorReading"));
- qmlRegisterType <QmlAccelerometer >(package, major, minor, "Accelerometer");
- qmlRegisterUncreatableType<QmlAccelerometerReading >(package, major, minor, "AccelerometerReading", QLatin1String("Cannot create AccelerometerReading"));
- qmlRegisterType <QmlAmbientLightSensor >(package, major, minor, "AmbientLightSensor");
- qmlRegisterUncreatableType<QmlAmbientLightSensorReading>(package, major, minor, "AmbientLightReading", QLatin1String("Cannot create AmbientLightReading"));
- qmlRegisterType <QmlCompass >(package, major, minor, "Compass");
- qmlRegisterUncreatableType<QmlCompassReading >(package, major, minor, "CompassReading", QLatin1String("Cannot create CompassReading"));
- qmlRegisterType <QmlGyroscope >(package, major, minor, "Gyroscope");
- qmlRegisterUncreatableType<QmlGyroscopeReading >(package, major, minor, "GyroscopeReading", QLatin1String("Cannot create GyroscopeReading"));
- qmlRegisterType <QmlIRProximitySensor >(package, major, minor, "IRProximitySensor");
- qmlRegisterUncreatableType<QmlIRProximitySensorReading >(package, major, minor, "IRProximityReading", QLatin1String("Cannot create IRProximityReading"));
- qmlRegisterType <QmlLightSensor >(package, major, minor, "LightSensor");
- qmlRegisterUncreatableType<QmlLightSensorReading >(package, major, minor, "LightReading", QLatin1String("Cannot create LightReading"));
- qmlRegisterType <QmlMagnetometer >(package, major, minor, "Magnetometer");
- qmlRegisterUncreatableType<QmlMagnetometerReading >(package, major, minor, "MagnetometerReading", QLatin1String("Cannot create MagnetometerReading"));
- qmlRegisterType <QmlOrientationSensor >(package, major, minor, "OrientationSensor");
- qmlRegisterUncreatableType<QmlOrientationSensorReading >(package, major, minor, "OrientationReading", QLatin1String("Cannot create OrientationReading"));
- qmlRegisterType <QmlProximitySensor >(package, major, minor, "ProximitySensor");
- qmlRegisterUncreatableType<QmlProximitySensorReading >(package, major, minor, "ProximityReading", QLatin1String("Cannot create ProximityReading"));
- qmlRegisterType <QmlRotationSensor >(package, major, minor, "RotationSensor");
- qmlRegisterUncreatableType<QmlRotationSensorReading >(package, major, minor, "RotationReading", QLatin1String("Cannot create RotationReading"));
- qmlRegisterType <QmlTapSensor >(package, major, minor, "TapSensor");
- qmlRegisterUncreatableType<QmlTapSensorReading >(package, major, minor, "TapReading", QLatin1String("Cannot create TapReading"));
- qmlRegisterType <QmlTiltSensor >(package, major, minor, "TiltSensor");
- qmlRegisterUncreatableType<QmlTiltSensorReading >(package, major, minor, "TiltReading", QLatin1String("Cannot create TiltReading"));
-
- qmlRegisterType <QmlSensorGesture >(package, major, minor, "SensorGesture");
-
- // Register the 5.1 interfaces
- minor = 1;
- qmlRegisterSingletonType <QmlSensorGlobal >(package, major, minor, "QmlSensors", global_object_50);
- qmlRegisterUncreatableType<QmlSensorRange >(package, major, minor, "Range", QLatin1String("Cannot create Range"));
- qmlRegisterUncreatableType<QmlSensorOutputRange >(package, major, minor, "OutputRange", QLatin1String("Cannot create OutputRange"));
- qmlRegisterUncreatableType<QmlSensor,1 >(package, major, minor, "Sensor", QLatin1String("Cannot create Sensor"));
- qmlRegisterUncreatableType<QmlSensorReading >(package, major, minor, "SensorReading", QLatin1String("Cannot create SensorReading"));
- qmlRegisterType <QmlAccelerometer,1 >(package, major, minor, "Accelerometer");
- qmlRegisterUncreatableType<QmlAccelerometerReading >(package, major, minor, "AccelerometerReading", QLatin1String("Cannot create AccelerometerReading"));
- qmlRegisterType <QmlAltimeter >(package, major, minor, "Altimeter");
- qmlRegisterUncreatableType<QmlAltimeterReading >(package, major, minor, "AltimeterReading", QLatin1String("Cannot create AltimeterReading"));
- qmlRegisterType <QmlAmbientLightSensor >(package, major, minor, "AmbientLightSensor");
- qmlRegisterUncreatableType<QmlAmbientLightSensorReading>(package, major, minor, "AmbientLightReading", QLatin1String("Cannot create AmbientLightReading"));
- qmlRegisterType <QmlAmbientTemperatureSensor >(package, major, minor, "AmbientTemperatureSensor");
- qmlRegisterUncreatableType<QmlAmbientTemperatureReading>(package, major, minor, "AmbientTemperatureReading", QLatin1String("Cannot create AmbientTemperatureReading"));
- qmlRegisterType <QmlCompass >(package, major, minor, "Compass");
- qmlRegisterUncreatableType<QmlCompassReading >(package, major, minor, "CompassReading", QLatin1String("Cannot create CompassReading"));
- qmlRegisterType <QmlGyroscope >(package, major, minor, "Gyroscope");
- qmlRegisterUncreatableType<QmlGyroscopeReading >(package, major, minor, "GyroscopeReading", QLatin1String("Cannot create GyroscopeReading"));
- qmlRegisterType <QmlHolsterSensor >(package, major, minor, "HolsterSensor");
- qmlRegisterUncreatableType<QmlHolsterReading >(package, major, minor, "HolsterReading", QLatin1String("Cannot create HolsterReading"));
- qmlRegisterType <QmlIRProximitySensor >(package, major, minor, "IRProximitySensor");
- qmlRegisterUncreatableType<QmlIRProximitySensorReading >(package, major, minor, "IRProximityReading", QLatin1String("Cannot create IRProximityReading"));
- qmlRegisterType <QmlLightSensor >(package, major, minor, "LightSensor");
- qmlRegisterUncreatableType<QmlLightSensorReading >(package, major, minor, "LightReading", QLatin1String("Cannot create LightReading"));
- qmlRegisterType <QmlMagnetometer >(package, major, minor, "Magnetometer");
- qmlRegisterUncreatableType<QmlMagnetometerReading >(package, major, minor, "MagnetometerReading", QLatin1String("Cannot create MagnetometerReading"));
- qmlRegisterType <QmlOrientationSensor >(package, major, minor, "OrientationSensor");
- qmlRegisterUncreatableType<QmlOrientationSensorReading >(package, major, minor, "OrientationReading", QLatin1String("Cannot create OrientationReading"));
- qmlRegisterType <QmlPressureSensor >(package, major, minor, "PressureSensor");
- qmlRegisterUncreatableType<QmlPressureReading >(package, major, minor, "PressureReading", QLatin1String("Cannot create PressureReading"));
- qmlRegisterType <QmlProximitySensor >(package, major, minor, "ProximitySensor");
- qmlRegisterUncreatableType<QmlProximitySensorReading >(package, major, minor, "ProximityReading", QLatin1String("Cannot create ProximityReading"));
- qmlRegisterType <QmlRotationSensor >(package, major, minor, "RotationSensor");
- qmlRegisterUncreatableType<QmlRotationSensorReading >(package, major, minor, "RotationReading", QLatin1String("Cannot create RotationReading"));
- qmlRegisterType <QmlTapSensor >(package, major, minor, "TapSensor");
- qmlRegisterUncreatableType<QmlTapSensorReading >(package, major, minor, "TapReading", QLatin1String("Cannot create TapReading"));
- qmlRegisterType <QmlTiltSensor >(package, major, minor, "TiltSensor");
- qmlRegisterUncreatableType<QmlTiltSensorReading >(package, major, minor, "TiltReading", QLatin1String("Cannot create TiltReading"));
-
- qmlRegisterType <QmlSensorGesture >(package, major, minor, "SensorGesture");
-
- // Register the 5.2 interfaces
- minor = 2;
- qmlRegisterSingletonType <QmlSensorGlobal >(package, major, minor, "QmlSensors", global_object_50);
- qmlRegisterUncreatableType<QmlSensorRange >(package, major, minor, "Range", QLatin1String("Cannot create Range"));
- qmlRegisterUncreatableType<QmlSensorOutputRange >(package, major, minor, "OutputRange", QLatin1String("Cannot create OutputRange"));
- qmlRegisterUncreatableType<QmlSensor,1 >(package, major, minor, "Sensor", QLatin1String("Cannot create Sensor"));
- qmlRegisterUncreatableType<QmlSensorReading >(package, major, minor, "SensorReading", QLatin1String("Cannot create SensorReading"));
- qmlRegisterType <QmlAccelerometer,1 >(package, major, minor, "Accelerometer");
- qmlRegisterUncreatableType<QmlAccelerometerReading >(package, major, minor, "AccelerometerReading", QLatin1String("Cannot create AccelerometerReading"));
- qmlRegisterType <QmlAltimeter >(package, major, minor, "Altimeter");
- qmlRegisterUncreatableType<QmlAltimeterReading >(package, major, minor, "AltimeterReading", QLatin1String("Cannot create AltimeterReading"));
- qmlRegisterType <QmlAmbientLightSensor >(package, major, minor, "AmbientLightSensor");
- qmlRegisterUncreatableType<QmlAmbientLightSensorReading>(package, major, minor, "AmbientLightReading", QLatin1String("Cannot create AmbientLightReading"));
- qmlRegisterType <QmlAmbientTemperatureSensor >(package, major, minor, "AmbientTemperatureSensor");
- qmlRegisterUncreatableType<QmlAmbientTemperatureReading>(package, major, minor, "AmbientTemperatureReading", QLatin1String("Cannot create AmbientTemperatureReading"));
- qmlRegisterType <QmlCompass >(package, major, minor, "Compass");
- qmlRegisterUncreatableType<QmlCompassReading >(package, major, minor, "CompassReading", QLatin1String("Cannot create CompassReading"));
- qmlRegisterType <QmlGyroscope >(package, major, minor, "Gyroscope");
- qmlRegisterUncreatableType<QmlGyroscopeReading >(package, major, minor, "GyroscopeReading", QLatin1String("Cannot create GyroscopeReading"));
- qmlRegisterType <QmlHolsterSensor >(package, major, minor, "HolsterSensor");
- qmlRegisterUncreatableType<QmlHolsterReading >(package, major, minor, "HolsterReading", QLatin1String("Cannot create HolsterReading"));
- qmlRegisterType <QmlIRProximitySensor >(package, major, minor, "IRProximitySensor");
- qmlRegisterUncreatableType<QmlIRProximitySensorReading >(package, major, minor, "IRProximityReading", QLatin1String("Cannot create IRProximityReading"));
- qmlRegisterType <QmlLightSensor >(package, major, minor, "LightSensor");
- qmlRegisterUncreatableType<QmlLightSensorReading >(package, major, minor, "LightReading", QLatin1String("Cannot create LightReading"));
- qmlRegisterType <QmlMagnetometer >(package, major, minor, "Magnetometer");
- qmlRegisterUncreatableType<QmlMagnetometerReading >(package, major, minor, "MagnetometerReading", QLatin1String("Cannot create MagnetometerReading"));
- qmlRegisterType <QmlOrientationSensor >(package, major, minor, "OrientationSensor");
- qmlRegisterUncreatableType<QmlOrientationSensorReading >(package, major, minor, "OrientationReading", QLatin1String("Cannot create OrientationReading"));
- qmlRegisterType <QmlPressureSensor >(package, major, minor, "PressureSensor");
- qmlRegisterUncreatableType<QmlPressureReading,1 >(package, major, minor, "PressureReading", QLatin1String("Cannot create PressureReading"));
- qmlRegisterType <QmlProximitySensor >(package, major, minor, "ProximitySensor");
- qmlRegisterUncreatableType<QmlProximitySensorReading >(package, major, minor, "ProximityReading", QLatin1String("Cannot create ProximityReading"));
- qmlRegisterType <QmlRotationSensor >(package, major, minor, "RotationSensor");
- qmlRegisterUncreatableType<QmlRotationSensorReading >(package, major, minor, "RotationReading", QLatin1String("Cannot create RotationReading"));
- qmlRegisterType <QmlTapSensor >(package, major, minor, "TapSensor");
- qmlRegisterUncreatableType<QmlTapSensorReading >(package, major, minor, "TapReading", QLatin1String("Cannot create TapReading"));
- qmlRegisterType <QmlTiltSensor >(package, major, minor, "TiltSensor");
- qmlRegisterUncreatableType<QmlTiltSensorReading >(package, major, minor, "TiltReading", QLatin1String("Cannot create TiltReading"));
-
- qmlRegisterType <QmlSensorGesture >(package, major, minor, "SensorGesture");
-
- // Register the 5.4 interfaces
- minor = 4;
- qmlRegisterType <QmlDistanceSensor >(package, major, minor, "DistanceSensor");
- qmlRegisterUncreatableType<QmlDistanceReading >(package, major, minor, "DistanceReading", QLatin1String("Cannot create DistanceReading"));
-
- // Register the new 5.9 interfaces
- // Implicitly registers 5.3 - 5.8 too
- minor = 9;
- qmlRegisterType <QmlLidSensor >(package, major, minor, "LidSensor");
- qmlRegisterUncreatableType<QmlLidReading >(package, major, minor, "LidReading", QLatin1String("Cannot create LidReading"));
- qmlRegisterType <QmlHumiditySensor >(package, major, minor, "HumiditySensor");
- qmlRegisterUncreatableType<QmlHumidityReading >(package, major, minor, "HumidityReading", QLatin1String("Cannot create HumidityReading"));
-
- // Register the latest Qt version as QML type version
- qmlRegisterModule(package, QT_VERSION_MAJOR, QT_VERSION_MINOR);
- }
-};
-
-QT_END_NAMESPACE
-
-#include "sensors.moc"
diff --git a/src/imports/sensors/sensors.pro b/src/imports/sensors/sensors.pro
deleted file mode 100644
index 7d15ec9f..00000000
--- a/src/imports/sensors/sensors.pro
+++ /dev/null
@@ -1,56 +0,0 @@
-QT += core-private qml sensors sensors-private
-
-HEADERS += \
- qmlsensor.h \
- qmlsensorrange.h \
- qmlaccelerometer.h \
- qmlaltimeter.h \
- qmlambientlightsensor.h \
- qmlambienttemperaturesensor.h \
- qmlcompass.h \
- qmldistancesensor.h \
- qmlgyroscope.h \
- qmlholstersensor.h \
- qmlirproximitysensor.h \
- qmllightsensor.h \
- qmlmagnetometer.h \
- qmlorientationsensor.h \
- qmlpressuresensor.h\
- qmlproximitysensor.h \
- qmltapsensor.h \
- qmlrotationsensor.h \
- qmlsensorglobal.h \
- qmltiltsensor.h \
- qmlsensorgesture.h \
- qmlhumiditysensor.h \
- qmllidsensor.h
-
-SOURCES += sensors.cpp \
- qmlsensor.cpp \
- qmlsensorrange.cpp \
- qmlaccelerometer.cpp \
- qmlaltimeter.cpp \
- qmlambientlightsensor.cpp \
- qmlambienttemperaturesensor.cpp \
- qmlcompass.cpp \
- qmldistancesensor.cpp \
- qmlgyroscope.cpp \
- qmlholstersensor.cpp \
- qmlirproximitysensor.cpp \
- qmllightsensor.cpp \
- qmlmagnetometer.cpp \
- qmlorientationsensor.cpp \
- qmlpressuresensor.cpp\
- qmlproximitysensor.cpp \
- qmltapsensor.cpp \
- qmlrotationsensor.cpp \
- qmlsensorglobal.cpp \
- qmltiltsensor.cpp \
- qmlsensorgesture.cpp \
- qmlhumiditysensor.cpp \
- qmllidsensor.cpp
-
-load(qml_plugin)
-
-OTHER_FILES += \
- plugin.json qmldir plugins.qmltypes
diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt
new file mode 100644
index 00000000..64b9584e
--- /dev/null
+++ b/src/plugins/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(sensors)
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/qtsensors/qcoversensorgesturerecognizer.cpp b/src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.cpp
deleted file mode 100644
index 6bb65e9f..00000000
--- a/src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.cpp
+++ /dev/null
@@ -1,144 +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 "qcoversensorgesturerecognizer.h"
-#include "qtsensorgesturesensorhandler.h"
-
-QT_BEGIN_NAMESPACE
-
-QCoverSensorGestureRecognizer::QCoverSensorGestureRecognizer(QObject *parent)
- : QSensorGestureRecognizer(parent),
- orientationReading(0),
- proximityReading(0),
- timer(0),
- active(0),
- detecting(0)
-{
-}
-
-QCoverSensorGestureRecognizer::~QCoverSensorGestureRecognizer()
-{
-}
-
-void QCoverSensorGestureRecognizer::create()
-{
- timer = new QTimer(this);
- connect(timer,SIGNAL(timeout()),this,SLOT(timeout()));
- timer->setSingleShot(true);
- timer->setInterval(750);
-}
-
-QString QCoverSensorGestureRecognizer::id() const
-{
- return QString("QtSensors.cover");
-}
-
-bool QCoverSensorGestureRecognizer::start()
-{
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Proximity)) {
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Orientation)) {
- active = true;
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(proximityReadingChanged(QProximityReading*)),
- this,SLOT(proximityChanged(QProximityReading*)));
-
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(orientationReadingChanged(QOrientationReading*)),
- this,SLOT(orientationReadingChanged(QOrientationReading*)));
- } else {
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Proximity);
- active = false;
- }
- } else {
- active = false;
- }
- return active;
-}
-
-bool QCoverSensorGestureRecognizer::stop()
-{
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Proximity);
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Orientation);
-
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(proximityReadingChanged(QProximityReading*)),
- this,SLOT(proximityChanged(QProximityReading*)));
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(orientationReadingChanged(QOrientationReading*)),
- this,SLOT(orientationReadingChanged(QOrientationReading*)));
-
- active = false;
- timer->stop();
- return active;
-}
-
-bool QCoverSensorGestureRecognizer::isActive()
-{
- return active;
-}
-
-void QCoverSensorGestureRecognizer::proximityChanged(QProximityReading *reading)
-{
- if (orientationReading == 0)
- return;
-
- proximityReading = reading->close();
-
- // look at case of face up->face down->face up.
- if (orientationReading->orientation() == QOrientationReading::FaceUp
- && proximityReading) {
- if (!timer->isActive()) {
- timer->start();
- detecting = true;
- }
- }
-}
-
-void QCoverSensorGestureRecognizer::orientationReadingChanged(QOrientationReading *reading)
-{
- orientationReading = reading;
-}
-
-void QCoverSensorGestureRecognizer::timeout()
-{
- if ((orientationReading->orientation() == QOrientationReading::FaceUp)
- && proximityReading) {
- Q_EMIT cover();
- Q_EMIT detected("cover");
- detecting = false;
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.h b/src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.h
deleted file mode 100644
index d9c57e80..00000000
--- a/src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.h
+++ /dev/null
@@ -1,84 +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 QCOVERSENSORGESTURERECOGNIZER_H
-#define QCOVERSENSORGESTURERECOGNIZER_H
-
-#include <QtSensors/qsensorgesturerecognizer.h>
-#include <QTimer>
-
-#include "qtsensorgesturesensorhandler.h"
-
-QT_BEGIN_NAMESPACE
-
-class QCoverSensorGestureRecognizer : public QSensorGestureRecognizer
-{
- Q_OBJECT
-public:
- explicit QCoverSensorGestureRecognizer(QObject *parent = 0);
- ~QCoverSensorGestureRecognizer();
-
- void create() override;
-
- QString id() const override;
- bool start() override;
- bool stop() override;
- bool isActive() override;
-
-Q_SIGNALS:
- void cover();
-
-private slots:
- void proximityChanged(QProximityReading *reading);
- void orientationReadingChanged(QOrientationReading *reading);
- void timeout();
-
-private:
-
- QOrientationReading *orientationReading;
- bool proximityReading;
-
- QTimer *timer;
- bool active;
- bool detecting;
-};
-
-QT_END_NAMESPACE
-#endif // QCOVERSENSORGESTURERECOGNIZER_H
diff --git a/src/plugins/sensorgestures/qtsensors/qdoubletapsensorgesturerecognizer.cpp b/src/plugins/sensorgestures/qtsensors/qdoubletapsensorgesturerecognizer.cpp
deleted file mode 100644
index 6d765a1a..00000000
--- a/src/plugins/sensorgestures/qtsensors/qdoubletapsensorgesturerecognizer.cpp
+++ /dev/null
@@ -1,99 +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 <QtSensors/QTapSensor>
-#include "qdoubletapsensorgesturerecognizer.h"
-QT_BEGIN_NAMESPACE
-
-QDoubleTapSensorGestureRecognizer::QDoubleTapSensorGestureRecognizer(QObject *parent) :
- QSensorGestureRecognizer(parent)
- , active(0)
-{
-}
-
-QDoubleTapSensorGestureRecognizer::~QDoubleTapSensorGestureRecognizer()
-{
-}
-
-void QDoubleTapSensorGestureRecognizer::create()
-{
-}
-
-
-QString QDoubleTapSensorGestureRecognizer::id() const
-{
- return QString("QtSensors.doubletap");
-}
-
-bool QDoubleTapSensorGestureRecognizer::start()
-{
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Tap)) {
- active = true;
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(dTabReadingChanged(QTapReading*)),
- this,SLOT(tapChanged(QTapReading*)));
- } else {
- active = false;
- }
- return active;
-}
-
-bool QDoubleTapSensorGestureRecognizer::stop()
-{
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Tap);
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(dTabReadingChanged(QTapReading*)),
- this,SLOT(tapChanged(QTapReading*)));
- active = false;
- return active;
-}
-
-bool QDoubleTapSensorGestureRecognizer::isActive()
-{
- return active;
-}
-
-void QDoubleTapSensorGestureRecognizer::tapChanged(QTapReading *reading)
-{
- if (reading->isDoubleTap()) {
- Q_EMIT doubletap();
- Q_EMIT detected("doubletap");
- }
-}
-
-
-QT_END_NAMESPACE
diff --git a/src/plugins/sensorgestures/qtsensors/qdoubletapsensorgesturerecognizer.h b/src/plugins/sensorgestures/qtsensors/qdoubletapsensorgesturerecognizer.h
deleted file mode 100644
index 73d7db56..00000000
--- a/src/plugins/sensorgestures/qtsensors/qdoubletapsensorgesturerecognizer.h
+++ /dev/null
@@ -1,78 +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 QDOUBLETAPSENSORGESTURERECOGNIZER_H
-#define QDOUBLETAPSENSORGESTURERECOGNIZER_H
-
-#include <QtSensors/QSensor>
-
-#include <QtSensors/qsensorgesturerecognizer.h>
-#include <QtSensors/QTapSensor>
-
-#include "qtsensorgesturesensorhandler.h"
-
-QT_BEGIN_NAMESPACE
-
-class QDoubleTapSensorGestureRecognizer : public QSensorGestureRecognizer
-{
- Q_OBJECT
-public:
- explicit QDoubleTapSensorGestureRecognizer(QObject *parent = 0);
- ~QDoubleTapSensorGestureRecognizer();
-
- void create() override;
-
- QString id() const override;
- bool start() override;
- bool stop() override;
- bool isActive() override;
-
-Q_SIGNALS:
- void doubletap();
-
-private slots:
- void tapChanged(QTapReading *reading);
-
-private:
- QTapSensor *tapSensor;
- bool active;
-
-};
-QT_END_NAMESPACE
-#endif // QDOUBLETAPSENSORGESTURERECOGNIZER_H
diff --git a/src/plugins/sensorgestures/qtsensors/qfreefallsensorgesturerecognizer.cpp b/src/plugins/sensorgestures/qtsensors/qfreefallsensorgesturerecognizer.cpp
deleted file mode 100644
index d158e1f0..00000000
--- a/src/plugins/sensorgestures/qtsensors/qfreefallsensorgesturerecognizer.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Lorn Potter
-** 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 <qmath.h>
-
-#include "qfreefallsensorgesturerecognizer.h"
-
-QT_BEGIN_NAMESPACE
-
-QFreefallSensorGestureRecognizer::QFreefallSensorGestureRecognizer(QObject *parent)
- : QSensorGestureRecognizer(parent)
- , active(0)
- , detecting(0)
-{
-}
-
-QFreefallSensorGestureRecognizer::~QFreefallSensorGestureRecognizer()
-{
-}
-
-void QFreefallSensorGestureRecognizer::create()
-{
-}
-
-QString QFreefallSensorGestureRecognizer::id() const
-{
- return QString("QtSensors.freefall");
-}
-
-bool QFreefallSensorGestureRecognizer::start()
-{
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Accel)) {
- active = true;
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(accelReadingChanged(QAccelerometerReading*)),
- this,SLOT(accelChanged(QAccelerometerReading*)));
- } else {
- active = false;
- }
- return active;
-
-}
-
-bool QFreefallSensorGestureRecognizer::stop()
-{
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Accel);
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(accelReadingChanged(QAccelerometerReading*)),
- this,SLOT(accelChanged(QAccelerometerReading*)));
- active = false;
-
- return active;
-}
-
-bool QFreefallSensorGestureRecognizer::isActive()
-{
- return active;
-}
-
-#define FREEFALL_THRESHOLD 1.0
-#define LANDED_THRESHOLD 20.0
-#define FREEFALL_MAX 4
-
-void QFreefallSensorGestureRecognizer::accelChanged(QAccelerometerReading *reading)
-{
- const qreal x = reading->x();
- const qreal y = reading->y();
- const qreal z = reading->z();
- qreal sum = qSqrt(x * x + y * y + z * z);
-
- if (qAbs(sum) < FREEFALL_THRESHOLD) {
- detecting = true;
- freefallList.append(sum);
- } else {
- if (detecting && qAbs(sum) > LANDED_THRESHOLD) {
- Q_EMIT landed();
- Q_EMIT detected("landed");
- freefallList.clear();
- }
- }
-
- if (freefallList.count() > FREEFALL_MAX) {
- Q_EMIT freefall();
- Q_EMIT detected("freefall");
- }
-}
-
-
-QT_END_NAMESPACE
-
diff --git a/src/plugins/sensorgestures/qtsensors/qfreefallsensorgesturerecognizer.h b/src/plugins/sensorgestures/qtsensors/qfreefallsensorgesturerecognizer.h
deleted file mode 100644
index 124475ad..00000000
--- a/src/plugins/sensorgestures/qtsensors/qfreefallsensorgesturerecognizer.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Lorn Potter
-** 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 QFREEFALLSENSORGESTURERECOGNIZER_H
-#define QFREEFALLSENSORGESTURERECOGNIZER_H
-
-#include <QtSensors/qsensorgesturerecognizer.h>
-
-#include "qtsensorgesturesensorhandler.h"
-
-QT_BEGIN_NAMESPACE
-
-class QFreefallSensorGestureRecognizer : public QSensorGestureRecognizer
-{
- Q_OBJECT
-public:
- explicit QFreefallSensorGestureRecognizer(QObject *parent = 0);
- ~QFreefallSensorGestureRecognizer();
-
- void create() override;
-
- QString id() const override;
- bool start() override;
- bool stop() override;
- bool isActive() override;
-
-Q_SIGNALS:
- void freefall();
- void landed();
-
-private slots:
- void accelChanged(QAccelerometerReading *reading);
-
-private:
-
- bool active;
- bool detecting;
- QList <qreal> freefallList;
-
-};
-QT_END_NAMESPACE
-#endif // QPICKUPSENSORGESTURERECOGNIZER_H
diff --git a/src/plugins/sensorgestures/qtsensors/qhoversensorgesturerecognizer.cpp b/src/plugins/sensorgestures/qtsensors/qhoversensorgesturerecognizer.cpp
deleted file mode 100644
index 9a1fa1c5..00000000
--- a/src/plugins/sensorgestures/qtsensors/qhoversensorgesturerecognizer.cpp
+++ /dev/null
@@ -1,222 +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 "qhoversensorgesturerecognizer.h"
-#include <math.h>
-
-#define TIMER2_TIMEOUT 5000
-
-QT_BEGIN_NAMESPACE
-
-QHoverSensorGestureRecognizer::QHoverSensorGestureRecognizer(QObject *parent) :
- QSensorGestureRecognizer(parent),
- orientationReading(0),reflectance(0),
- hoverOk(0), detecting(0), active(0), initialReflectance(0), useHack(0),
- lastTimestamp(0), timer2Active(0), lapsedTime2(0)
-{
-}
-
-QHoverSensorGestureRecognizer::~QHoverSensorGestureRecognizer()
-{
-}
-
-void QHoverSensorGestureRecognizer::create()
-{
-
-}
-
-QString QHoverSensorGestureRecognizer::id() const
-{
- return QString("QtSensors.hover");
-}
-
-bool QHoverSensorGestureRecognizer::start()
-{
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::IrProximity)) {
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Orientation)) {
- active = true;
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(irProximityReadingChanged(QIRProximityReading*)),
- this,SLOT(irProximityReadingChanged(QIRProximityReading*)));
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(orientationReadingChanged(QOrientationReading*)),
- this,SLOT(orientationReadingChanged(QOrientationReading*)));
- } else {
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::IrProximity);
- active = false;
- }
- } else {
- active = false;
- }
-
- detecting = false;
- detectedHigh = 0;
- initialReflectance = 0;
- useHack = false;
- timer2Active = false;
- lapsedTime2 = 0;
- return active;
-}
-
-bool QHoverSensorGestureRecognizer::stop()
-{
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::IrProximity);
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Orientation);
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(irProximityReadingChanged(QIRProximityReading*)),
- this,SLOT(irProximityReadingChanged(QIRProximityReading*)));
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(orientationReadingChanged(QOrientationReading*)),
- this,SLOT(orientationReadingChanged(QOrientationReading*)));
- active = false;
- timer2Active = false;
- initialReflectance = 0;
- return active;
-}
-
-bool QHoverSensorGestureRecognizer::isActive()
-{
- return active;
-}
-
-
-void QHoverSensorGestureRecognizer::orientationReadingChanged(QOrientationReading *reading)
-{
- orientationReading = reading;
-}
-
-void QHoverSensorGestureRecognizer::irProximityReadingChanged(QIRProximityReading *reading)
-{
- reflectance = reading->reflectance();
- if (reflectance == 0)
- return;
-
- if (initialReflectance == 0) {
- initialReflectance = reflectance;
- }
-
- if (initialReflectance > .2) {
- useHack = true;
- initialReflectance -= .1;
- }
- if (useHack)
- reflectance -= .1;
-
- if (detecting && !hoverOk) {
- detectedHigh = qMax(detectedHigh, reflectance);
- }
-
- if (reflectance > 0.4) {
- // if close stop detecting
- hoverOk = false;
- detecting = false;
- detectedHigh = 0;
- }
-
- qreal detectedPercent = 100 - (detectedHigh / reflectance * 100);
-
- qint16 percentCheck;
- if (useHack)
- percentCheck = -60;
- else
- percentCheck = -101;
-
- quint64 timestamp = reading->timestamp();
-
- if (!detecting
- && checkForHovering()) {
- detecting = true;
- detecting = true;
- timer2Active = true;
- detectedHigh = reflectance;
- } else if (detecting
- && detectedPercent < percentCheck
- && !checkForHovering()) {
- // went light again after 1 seconds
- Q_EMIT hover();
- Q_EMIT detected("hover");
- hoverOk = false;
- detecting = false;
- detectedHigh = 0;
- timer2Active = false;;
- }
- if (detecting && reflectance < 0.2) {
- timeout();
- }
- if (timer2Active && lastTimestamp > 0)
- lapsedTime2 += (timestamp - lastTimestamp )/1000;
-
- if (timer2Active && lapsedTime2 >= TIMER2_TIMEOUT) {
- timeout2();
- }
-
- lastTimestamp = reading->timestamp();
-}
-
-bool QHoverSensorGestureRecognizer::checkForHovering()
-{
- if (orientationReading == 0) {
- return false;
- }
- if (orientationReading->orientation() != QOrientationReading::FaceUp)
- return false;
- if ( (reflectance > 0.2 && reflectance < 0.4)
- && (initialReflectance - reflectance) < -0.1)
- return true;
-
- return false;
-}
-
-
-void QHoverSensorGestureRecognizer::timeout()
-{
- if (checkForHovering()) {
- hoverOk = true;
- timer2Active = true;
- } else {
- detecting = false;
- detectedHigh = 0;
- }
-}
-
-void QHoverSensorGestureRecognizer::timeout2()
-{
- detecting = false;
- hoverOk = false;
- detectedHigh = 0;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/sensorgestures/qtsensors/qhoversensorgesturerecognizer.h b/src/plugins/sensorgestures/qtsensors/qhoversensorgesturerecognizer.h
deleted file mode 100644
index d0c8f706..00000000
--- a/src/plugins/sensorgestures/qtsensors/qhoversensorgesturerecognizer.h
+++ /dev/null
@@ -1,92 +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 QHOVERSENSORGESTURERECOGNIZER_H
-#define QHOVERSENSORGESTURERECOGNIZER_H
-
-#include <QtSensors/QSensorGestureRecognizer>
-
-#include "qtsensorgesturesensorhandler.h"
-
-
-QT_BEGIN_NAMESPACE
-
-class QHoverSensorGestureRecognizer : public QSensorGestureRecognizer
-{
- Q_OBJECT
-public:
- explicit QHoverSensorGestureRecognizer(QObject *parent = 0);
- ~QHoverSensorGestureRecognizer();
-
- void create() override;
-
- QString id() const override;
- bool start() override;
- bool stop() override;
- bool isActive() override;
-
-Q_SIGNALS:
- void hover();
-
-private slots:
- void orientationReadingChanged(QOrientationReading *reading);
- void irProximityReadingChanged(QIRProximityReading *reading);
- void timeout();
- void timeout2();
-private:
- QOrientationReading *orientationReading;
- qreal reflectance;
- bool hoverOk;
- bool detecting;
-
- qreal detectedHigh;
- bool active;
- qreal initialReflectance;
- bool checkForHovering();
- bool useHack;
-
- quint64 lastTimestamp;
-
- bool timer2Active;
- quint64 lapsedTime2;
-
-};
-QT_END_NAMESPACE
-#endif // QHOVERSENSORGESTURERECOGNIZER_H
diff --git a/src/plugins/sensorgestures/qtsensors/qpickupsensorgesturerecognizer.cpp b/src/plugins/sensorgestures/qtsensors/qpickupsensorgesturerecognizer.cpp
deleted file mode 100644
index 33688706..00000000
--- a/src/plugins/sensorgestures/qtsensors/qpickupsensorgesturerecognizer.cpp
+++ /dev/null
@@ -1,213 +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 "qpickupsensorgesturerecognizer.h"
-
-#include <QtCore/qmath.h>
-
-#define TIMER_TIMEOUT 250
-
-QT_BEGIN_NAMESPACE
-
-QPickupSensorGestureRecognizer::QPickupSensorGestureRecognizer(QObject *parent)
- : QSensorGestureRecognizer(parent)
- , accelReading(0)
- , active(0)
- , pXaxis(0)
- , pYaxis(0)
- , pZaxis(0)
- , lastpitch(0)
- , detecting(0)
-{
-}
-
-QPickupSensorGestureRecognizer::~QPickupSensorGestureRecognizer()
-{
-}
-
-void QPickupSensorGestureRecognizer::create()
-{
-}
-
-QString QPickupSensorGestureRecognizer::id() const
-{
- return QString("QtSensors.pickup");
-}
-
-bool QPickupSensorGestureRecognizer::start()
-{
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Accel)) {
- active = true;
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(accelReadingChanged(QAccelerometerReading*)),
- this,SLOT(accelChanged(QAccelerometerReading*)));
- } else {
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Accel);
- active = false;
- }
- clear();
-
- return active;
-
-}
-
-bool QPickupSensorGestureRecognizer::stop()
-{
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Accel);
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(accelReadingChanged(QAccelerometerReading*)),
- this,SLOT(accelChanged(QAccelerometerReading*)));
- active = false;
-
- return active;
-}
-
-bool QPickupSensorGestureRecognizer::isActive()
-{
- return active;
-}
-
-#define PICKUP_BOTTOM_THRESHOLD 25
-#define PICKUP_TOP_THRESHOLD 80
-#define PICKUP_ANGLE_THRESHOLD 25
-#define PICKUP_ROLL_THRESHOLD 13
-
-void QPickupSensorGestureRecognizer::accelChanged(QAccelerometerReading *reading)
-{
- accelReading = reading;
- const qreal x = reading->x();
- const qreal y = reading->y();
- const qreal z = reading->z();
- const qreal xdiff = pXaxis - x;
- const qreal ydiff = pYaxis - y;
- const qreal zdiff = pZaxis - z;
-
- qreal pitch = qRadiansToDegrees(qAtan(y / qSqrt(x * x + z * z)));
- qreal roll = qRadiansToDegrees(qAtan(x / qSqrt(y * y + z * z)));
-
- if ((qAbs(xdiff) < 0.7 && qAbs(ydiff) < .7 && qAbs(zdiff) < .7)
- || z < 0) {
- detecting = false;
- } else if (pitch > PICKUP_BOTTOM_THRESHOLD && pitch < PICKUP_TOP_THRESHOLD) {
- detecting = true;
- }
-
- if ( pitchList.count() > 21) {
- pitchList.removeFirst();
- }
- if ( rollList.count() > 21) {
- rollList.removeFirst();
- }
-
- if (pitch > 1) {
- pitchList.append(pitch);
- }
- if (roll > 1) {
- rollList.append(roll);
- }
-
- if (detecting && pitchList.count() > 5 ) {
- timeout();
- }
-
- lastpitch = pitch;
- pXaxis = x;
- pYaxis = y;
- pZaxis = z;
-}
-
-void QPickupSensorGestureRecognizer::timeout()
-{
- qreal averageRoll = 0;
- for (int r = 0; r < rollList.count(); r++) {
- averageRoll += rollList.at(r);
- }
- averageRoll /= rollList.count();
-
- if (averageRoll > PICKUP_ROLL_THRESHOLD) {
- clear();
- return;
- }
- if (pitchList.isEmpty()
- || pitchList.at(0) > PICKUP_BOTTOM_THRESHOLD) {
- clear();
- return;
- }
-
- qreal previousPitch = 0;
- qreal startPitch = -1.0;
- int goodCount = 0;
-
- qreal averagePitch = 0;
- for (int i = 0; i < pitchList.count(); i++) {
- averagePitch += pitchList.at(i);
- if (previousPitch < pitchList.at(i)
- && qAbs(pitchList.at(i)) - qAbs(previousPitch) < 20) {
- if (goodCount == 1 && previousPitch != 0) {
- startPitch = previousPitch;
- }
- goodCount++;
- }
-
- previousPitch = pitchList.at(i);
- }
- averagePitch /= pitchList.count();
-
- if (averagePitch < 5) {
- clear();
- return;
- }
-
- if (goodCount >= 3 &&
- (pitchList.last() < PICKUP_TOP_THRESHOLD
- && pitchList.last() > PICKUP_BOTTOM_THRESHOLD)
- && startPitch > 0
- && (pitchList.last() - startPitch) > PICKUP_ANGLE_THRESHOLD) {
- Q_EMIT pickup();
- Q_EMIT detected("pickup");
- }
- clear();
-}
-
-void QPickupSensorGestureRecognizer::clear()
-{
- pitchList.clear();
- detecting = false;
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/plugins/sensorgestures/qtsensors/qpickupsensorgesturerecognizer.h b/src/plugins/sensorgestures/qtsensors/qpickupsensorgesturerecognizer.h
deleted file mode 100644
index fdc0a6fe..00000000
--- a/src/plugins/sensorgestures/qtsensors/qpickupsensorgesturerecognizer.h
+++ /dev/null
@@ -1,87 +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 QPICKUPSENSORGESTURERECOGNIZER_H
-#define QPICKUPSENSORGESTURERECOGNIZER_H
-
-#include <QtSensors/qsensorgesturerecognizer.h>
-#include "qtsensorgesturesensorhandler.h"
-
-QT_BEGIN_NAMESPACE
-
-class QPickupSensorGestureRecognizer : public QSensorGestureRecognizer
-{
- Q_OBJECT
-public:
- explicit QPickupSensorGestureRecognizer(QObject *parent = 0);
- ~QPickupSensorGestureRecognizer();
-
- void create() override;
-
- QString id() const override;
- bool start() override;
- bool stop() override;
- bool isActive() override;
-
-Q_SIGNALS:
- void pickup();
-
-private slots:
- void accelChanged(QAccelerometerReading *reading);
-
- void timeout();
-private:
- QAccelerometerReading *accelReading;
-
- bool active;
- qreal pXaxis;
- qreal pYaxis;
- qreal pZaxis;
-
- qreal lastpitch;
- bool detecting;
-
- QList <qreal> pitchList;
- QList <qreal> rollList;
-
- void clear();
-};
-QT_END_NAMESPACE
-#endif // QPICKUPSENSORGESTURERECOGNIZER_H
diff --git a/src/plugins/sensorgestures/qtsensors/qshake2recognizer.cpp b/src/plugins/sensorgestures/qtsensors/qshake2recognizer.cpp
deleted file mode 100644
index 16313b41..00000000
--- a/src/plugins/sensorgestures/qtsensors/qshake2recognizer.cpp
+++ /dev/null
@@ -1,231 +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 <QDebug>
-
-#include "qshake2recognizer.h"
-#include <math.h>
-
-
-QT_BEGIN_NAMESPACE
-
-QShake2SensorGestureRecognizer::QShake2SensorGestureRecognizer(QObject *parent)
- : QSensorGestureRecognizer(parent)
- , active(0)
- , shakeDirection(QShake2SensorGestureRecognizer::ShakeUndefined)
- , shaking(0)
- , shakeCount(0)
- , lapsedTime(0)
- , lastTimestamp(0),
- timerActive(0)
-{
- timerTimeout = 250;
-}
-
-QShake2SensorGestureRecognizer::~QShake2SensorGestureRecognizer()
-{
-}
-
-void QShake2SensorGestureRecognizer::create()
-{
-}
-
-bool QShake2SensorGestureRecognizer::start()
-{
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Accel)) {
- active = true;
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(accelReadingChanged(QAccelerometerReading*)),
- this,SLOT(accelChanged(QAccelerometerReading*)));
- } else {
- active = false;
- }
- prevData.x = 0;
- prevData.y = 0;
- prevData.z = 0;
- shakeCount = 0;
- shaking = false;
- shakeDirection = QShake2SensorGestureRecognizer::ShakeUndefined;
-
- return active;
-}
-
-bool QShake2SensorGestureRecognizer::stop()
-{
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Accel);
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(accelReadingChanged(QAccelerometerReading*)),
- this,SLOT(accelChanged(QAccelerometerReading*)));
- active = false;
- return active;
-}
-
-bool QShake2SensorGestureRecognizer::isActive()
-{
- return active;
-}
-
-QString QShake2SensorGestureRecognizer::id() const
-{
- return QString("QtSensors.shake2");
-}
-
-#define NUMBER_SHAKES 3
-#define THRESHOLD 25
-
-void QShake2SensorGestureRecognizer::accelChanged(QAccelerometerReading *reading)
-{
- const qreal x = reading->x();
- const qreal y = reading->y();
- const qreal z = reading->z();
-
- const quint64 timestamp = reading->timestamp();
-
- currentData.x = x;
- currentData.y = y;
- currentData.z = z;
-
- if (qAbs(prevData.x - currentData.x) < 1
- && qAbs(prevData.y - currentData.y) < 1
- && qAbs(prevData.z - currentData.z) < 1) {
-
- prevData.x = currentData.x;
- prevData.y = currentData.y;
- prevData.z = currentData.z;
- return;
- }
-
- bool wasShake;
- wasShake = checkForShake(prevData, currentData, THRESHOLD);
-
- if (!shaking && wasShake &&
- shakeCount == NUMBER_SHAKES) {
- shaking = true;
- shakeCount = 0;
- lapsedTime = 0;
- timerActive = false;
- switch (shakeDirection) {
- case QShake2SensorGestureRecognizer::ShakeLeft:
- Q_EMIT shakeLeft();
- Q_EMIT detected("shakeLeft");
- break;
- case QShake2SensorGestureRecognizer::ShakeRight:
- Q_EMIT shakeRight();
- Q_EMIT detected("shakeRight");
- break;
- case QShake2SensorGestureRecognizer::ShakeUp:
- Q_EMIT shakeUp();
- Q_EMIT detected("shakeUp");
- break;
- case QShake2SensorGestureRecognizer::ShakeDown:
- Q_EMIT shakeDown();
- Q_EMIT detected("shakeDown");
- break;
- default:
- break;
- };
-
- } else if (wasShake) {
-
- if (shakeCount == 0 && shakeDirection == QShake2SensorGestureRecognizer::ShakeUndefined) {
-
- const int xdiff = prevData.x - currentData.x;
- const int ydiff = prevData.x - currentData.y;
-
- const int max = qMax(qAbs(ydiff), qAbs(xdiff));
- if (max == qAbs(xdiff)) {
- if (isNegative(xdiff))
- shakeDirection = QShake2SensorGestureRecognizer::ShakeLeft;
- else
- shakeDirection = QShake2SensorGestureRecognizer::ShakeRight;
-
- } else if (max == qAbs(ydiff)) {
- if (isNegative(ydiff))
- shakeDirection = QShake2SensorGestureRecognizer::ShakeDown;
- else
- shakeDirection = QShake2SensorGestureRecognizer::ShakeUp;
- }
- }
- shakeCount++;
- if (shakeCount == NUMBER_SHAKES) {
- timerActive = true;
- }
- }
-
- if (timerActive && lastTimestamp > 0)
- lapsedTime += (timestamp - lastTimestamp )/1000;
-
- if (timerActive && lapsedTime >= timerTimeout) {
- timeout();
- }
- prevData.x = currentData.x;
- prevData.y = currentData.y;
- prevData.z = currentData.z;
- lastTimestamp = timestamp;
-}
-
-void QShake2SensorGestureRecognizer::timeout()
-{
- shakeCount = 0;
- shaking = false;
- shakeDirection = QShake2SensorGestureRecognizer::ShakeUndefined;
- timerActive = false;
- lapsedTime = 0;
- lastTimestamp = 0;
-}
-
-bool QShake2SensorGestureRecognizer::checkForShake(ShakeData prevSensorData, ShakeData currentSensorData, qreal threshold)
-{
- const double deltaX = qAbs(prevSensorData.x - currentSensorData.x);
- const double deltaY = qAbs(prevSensorData.y - currentSensorData.y);
- const double deltaZ = qAbs(prevSensorData.z - currentSensorData.z);
-
- return (deltaX > threshold
- || deltaY > threshold
- || deltaZ > threshold);
-}
-
-bool QShake2SensorGestureRecognizer::isNegative(qreal num)
-{
- if (num < 0)
- return true;
- return false;
-}
-
-
-
-QT_END_NAMESPACE
diff --git a/src/plugins/sensorgestures/qtsensors/qshake2recognizer.h b/src/plugins/sensorgestures/qtsensors/qshake2recognizer.h
deleted file mode 100644
index 9e402cf6..00000000
--- a/src/plugins/sensorgestures/qtsensors/qshake2recognizer.h
+++ /dev/null
@@ -1,116 +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 QSHAKERECOGNIZER_H
-#define QSHAKERECOGNIZER_H
-
-#include <QDebug>
-
-#include <QtSensors/qsensorgesturerecognizer.h>
-
-#include "qtsensorgesturesensorhandler.h"
-
-QT_BEGIN_NAMESPACE
-
-struct ShakeData {
- qreal x;
- qreal y;
- qreal z;
-};
-
-class QShake2SensorGestureRecognizer : public QSensorGestureRecognizer
-{
- Q_OBJECT
-
-public:
-
- enum ShakeDirection {
- ShakeUndefined = 0,
- ShakeLeft,
- ShakeRight,
- ShakeUp,
- ShakeDown
- };
-
- QShake2SensorGestureRecognizer(QObject *parent = 0);
- ~QShake2SensorGestureRecognizer();
-
- void create() override;
-
- QString id() const override;
- bool start() override;
- bool stop() override;
- bool isActive() override;
-
- int timerTimeout;
-
-
-Q_SIGNALS:
- void shakeLeft();
- void shakeRight();
- void shakeUp();
- void shakeDown();
-
-private slots:
- void accelChanged(QAccelerometerReading *reading);
- void timeout();
-
-
-private:
- QAccelerometerReading *accelReading;
-
- bool active;
-
- ShakeDirection shakeDirection;
-
- ShakeData prevData;
- ShakeData currentData;
-
- bool checkForShake(ShakeData prevSensorData, ShakeData currentSensorData, qreal threshold);
- bool shaking;
- int shakeCount;
- int threshold;
-
- bool isNegative(qreal num);
- qreal lapsedTime;
- quint64 lastTimestamp;
- bool timerActive;
-};
-QT_END_NAMESPACE
-#endif // QSHAKERECOGNIZER_H
diff --git a/src/plugins/sensorgestures/qtsensors/qslamgesturerecognizer.cpp b/src/plugins/sensorgestures/qtsensors/qslamgesturerecognizer.cpp
deleted file mode 100644
index 658f81eb..00000000
--- a/src/plugins/sensorgestures/qtsensors/qslamgesturerecognizer.cpp
+++ /dev/null
@@ -1,215 +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 "qslamgesturerecognizer.h"
-#include "qtsensorgesturesensorhandler.h"
-
-
-#include <QtCore/qmath.h>
-
-QT_BEGIN_NAMESPACE
-
-QSlamSensorGestureRecognizer::QSlamSensorGestureRecognizer(QObject *parent) :
- QSensorGestureRecognizer(parent),
- orientationReading(0),
- accelRange(0),
- active(0),
- lastX(0),
- lastY(0),
- lastZ(0),
- detectedX(0),
- detecting(0),
- accelX(0),
- roll(0),
- resting(0),
- lastTimestamp(0),
- lapsedTime(0),
- timerActive(0)
-{
-}
-
-QSlamSensorGestureRecognizer::~QSlamSensorGestureRecognizer()
-{
-}
-
-void QSlamSensorGestureRecognizer::create()
-{
-}
-
-
-QString QSlamSensorGestureRecognizer::id() const
-{
- return QString("QtSensors.slam");
-}
-
-bool QSlamSensorGestureRecognizer::start()
-{
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Accel)) {
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Orientation)) {
- active = true;
- accelRange = QtSensorGestureSensorHandler::instance()->accelRange;
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(orientationReadingChanged(QOrientationReading*)),
- this,SLOT(orientationReadingChanged(QOrientationReading*)));
-
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(accelReadingChanged(QAccelerometerReading*)),
- this,SLOT(accelChanged(QAccelerometerReading*)));
- } else {
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Accel);
- active = false;
- }
- } else {
- active = false;
- }
- return active;
-}
-
-bool QSlamSensorGestureRecognizer::stop()
-{
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Accel);
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Orientation);
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(orientationReadingChanged(QOrientationReading*)),
- this,SLOT(orientationReadingChanged(QOrientationReading*)));
-
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(accelReadingChanged(QAccelerometerReading*)),
- this,SLOT(accelChanged(QAccelerometerReading*)));
- detecting = false;
- restingList.clear();
- active = false;
- return active;
-}
-
-bool QSlamSensorGestureRecognizer::isActive()
-{
- return active;
-}
-
-void QSlamSensorGestureRecognizer::orientationReadingChanged(QOrientationReading *reading)
-{
- orientationReading = reading;
-}
-
-#define SLAM_DETECTION_FACTOR 0.3 // 11.7
-#define SLAM_RESTING_FACTOR 2.5
-#define SLAM_RESTING_COUNT 5
-#define SLAM_ZERO_FACTOR .02
-
-void QSlamSensorGestureRecognizer::accelChanged(QAccelerometerReading *reading)
-{
- const qreal x = reading->x();
- const qreal y = reading->y();
- const qreal z = reading->z();
- quint64 timestamp = reading->timestamp();
-
- if (qAbs(lastX - x) < SLAM_RESTING_FACTOR
- && qAbs(lastY - y) < SLAM_RESTING_FACTOR
- && qAbs(lastZ - z) < SLAM_RESTING_FACTOR) {
- resting = true;
- } else {
- resting = false;
- }
-
- if (restingList.count() > SLAM_RESTING_COUNT)
- restingList.removeLast();
- restingList.insert(0, resting);
-
-
- if (timerActive && lastTimestamp > 0)
- lapsedTime += (timestamp - lastTimestamp )/1000;
-
- if (timerActive && lapsedTime >= 250) {
- doSlam();
- }
- lastTimestamp = timestamp;
-
- if (orientationReading == 0) {
- return;
- }
-
- const qreal difference = lastX - x;
-
- if (!detecting
- && orientationReading->orientation() == QOrientationReading::TopUp
- && resting
- && hasBeenResting()) {
- detectedX = x;
- // start of gesture
- detecting = true;
- if (difference > 0)
- wasNegative = false;
- else
- wasNegative = true;
- restingList.clear();
- }
- if (detecting
- && qAbs(difference) > (accelRange * SLAM_DETECTION_FACTOR)) {
- timerActive = true;
- }
- if (detecting &&
- (qAbs(difference) < SLAM_ZERO_FACTOR && qAbs(difference) > 0)) {
- detecting = false;
- }
- lastX = x;
- lastY = y;
- lastZ = z;
-}
-
-bool QSlamSensorGestureRecognizer::hasBeenResting()
-{
- for (int i = 0; i < restingList.count() - 1; i++) {
- if (!restingList.at(i)) {
- return false;
- }
- }
- return true;
-}
-
-void QSlamSensorGestureRecognizer::doSlam()
-{
- if (detecting && (orientationReading->orientation() == QOrientationReading::RightUp
- || orientationReading->orientation() == QOrientationReading::LeftUp)) {
- Q_EMIT slam();
- Q_EMIT detected("slam");
- restingList.clear();
- detecting = false;
- }
- timerActive = false;
- lapsedTime = 0;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/sensorgestures/qtsensors/qslamgesturerecognizer.h b/src/plugins/sensorgestures/qtsensors/qslamgesturerecognizer.h
deleted file mode 100644
index 4217eec3..00000000
--- a/src/plugins/sensorgestures/qtsensors/qslamgesturerecognizer.h
+++ /dev/null
@@ -1,100 +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 QSLAMSENSORGESTURERECOGNIZER_H
-#define QSLAMSENSORGESTURERECOGNIZER_H
-
-#include <QtSensors/qsensorgesturerecognizer.h>
-#include <QtSensors/QOrientationSensor>
-#include <QtSensors/QAccelerometer>
-#include <QtSensors/QAccelerometerReading>
-#include <QtSensors/QOrientationReading>
-QT_BEGIN_NAMESPACE
-
-class QSlamSensorGestureRecognizer : public QSensorGestureRecognizer
-{
- Q_OBJECT
-public:
- explicit QSlamSensorGestureRecognizer(QObject *parent = 0);
- ~QSlamSensorGestureRecognizer();
-
- void create() override;
-
- QString id() const override;
- bool start() override;
- bool stop() override;
- bool isActive() override;
-
-Q_SIGNALS:
- void slam();
-
-private slots:
- void accelChanged(QAccelerometerReading *reading);
- void orientationReadingChanged(QOrientationReading *reading);
- void doSlam();
-
-private:
-
- QAccelerometer *accel;
- QOrientationReading *orientationReading;
- int accelRange;
- bool active;
-
- bool wasNegative;
- qreal lastX;
- qreal lastY;
- qreal lastZ;
- qreal detectedX;
-
- bool detecting;
-
- qreal accelX;
- qreal roll;
- QList<qreal> restingList;
- bool resting;
-
- bool hasBeenResting();
- quint64 lastTimestamp;
- quint64 lapsedTime;
- bool timerActive;
-};
-
-QT_END_NAMESPACE
-#endif // QSLAMSENSORGESTURERECOGNIZER_H
diff --git a/src/plugins/sensorgestures/qtsensors/qtsensorgestureplugin.cpp b/src/plugins/sensorgestures/qtsensors/qtsensorgestureplugin.cpp
deleted file mode 100644
index 7e091479..00000000
--- a/src/plugins/sensorgestures/qtsensors/qtsensorgestureplugin.cpp
+++ /dev/null
@@ -1,113 +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 <QtPlugin>
-#include <QStringList>
-#include <QObject>
-
-#include "qtsensorgestureplugin.h"
-
-#include <QtSensors/qsensorgestureplugininterface.h>
-
-#include "qcoversensorgesturerecognizer.h"
-#include "qtwistsensorgesturerecognizer.h"
-#include "qdoubletapsensorgesturerecognizer.h"
-#include "qhoversensorgesturerecognizer.h"
-#include "qpickupsensorgesturerecognizer.h"
-#include "qshake2recognizer.h"
-#include "qslamgesturerecognizer.h"
-#include "qturnoversensorgesturerecognizer.h"
-#include "qwhipsensorgesturerecognizer.h"
-#include "qfreefallsensorgesturerecognizer.h"
-
-
-QT_BEGIN_NAMESPACE
-
-
-QtSensorGesturePlugin::QtSensorGesturePlugin()
-{
-}
-
-QtSensorGesturePlugin::~QtSensorGesturePlugin()
-{
-}
-
-QStringList QtSensorGesturePlugin::supportedIds() const
-{
- QStringList list;
- list << "QtSensors.cover";
- list << "QtSensors.doubletap";
- list << "QtSensors.hover";
- list << "QtSensors.freefall";
- list << "QtSensors.pickup";
- list << "QtSensors.shake2";
- list << "QtSensors.slam";
- list << "QtSensors.turnover";
- list << "QtSensors.twist";
- list << "QtSensors.whip";
- return list;
-}
-
-QList <QSensorGestureRecognizer *> QtSensorGesturePlugin::createRecognizers()
-{
- QList <QSensorGestureRecognizer *> recognizers;
-
- recognizers.append(new QCoverSensorGestureRecognizer(this));
-
- recognizers.append(new QDoubleTapSensorGestureRecognizer(this));
-
- recognizers.append(new QHoverSensorGestureRecognizer(this));
-
- recognizers.append(new QPickupSensorGestureRecognizer(this));
-
- recognizers.append(new QShake2SensorGestureRecognizer(this));
-
- recognizers.append(new QSlamSensorGestureRecognizer(this));
-
- recognizers.append(new QTurnoverSensorGestureRecognizer(this));
-
- recognizers.append(new QWhipSensorGestureRecognizer(this));
-
- recognizers.append(new QTwistSensorGestureRecognizer(this));
-
- recognizers.append(new QFreefallSensorGestureRecognizer(this));
- return recognizers;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/sensorgestures/qtsensors/qtsensorgestureplugin.h b/src/plugins/sensorgestures/qtsensors/qtsensorgestureplugin.h
deleted file mode 100644
index 87a93f16..00000000
--- a/src/plugins/sensorgestures/qtsensors/qtsensorgestureplugin.h
+++ /dev/null
@@ -1,68 +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 QTSENSORGESTURESPLUGIN_H
-#define QTSENSORGESTURESPLUGIN_H
-
-#include <QObject>
-#include <QStringList>
-
-#include <QtSensors/qsensorgestureplugininterface.h>
-
-QT_BEGIN_NAMESPACE
-
-class QtSensorGesturePlugin : public QObject, public QSensorGesturePluginInterface
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.QSensorGesturePluginInterface")
- Q_INTERFACES(QSensorGesturePluginInterface)
-
-public:
- explicit QtSensorGesturePlugin();
- ~QtSensorGesturePlugin();
- QList <QSensorGestureRecognizer *> createRecognizers() override;
-
- QStringList gestureSignals() const;
- QStringList supportedIds() const override;
- QString name() const override { return "QtSensorGestures"; }
-
-};
-
-QT_END_NAMESPACE
-#endif // QTSENSORGESTURESPLUGIN_H
diff --git a/src/plugins/sensorgestures/qtsensors/qtsensorgesturesensorhandler.cpp b/src/plugins/sensorgestures/qtsensors/qtsensorgesturesensorhandler.cpp
deleted file mode 100644
index 84d9203f..00000000
--- a/src/plugins/sensorgestures/qtsensors/qtsensorgesturesensorhandler.cpp
+++ /dev/null
@@ -1,193 +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 <QDebug>
-
-#include "qtsensorgesturesensorhandler.h"
-
-QtSensorGestureSensorHandler::QtSensorGestureSensorHandler(QObject *parent) :
- QObject(parent),
- accel(0), orientation(0), proximity(0), irProx(0),tapSensor(0)
-{
-}
-
-QtSensorGestureSensorHandler* QtSensorGestureSensorHandler::instance()
-{
- static QtSensorGestureSensorHandler *instance = 0;
- if (!instance) {
- instance = new QtSensorGestureSensorHandler;
- }
- return instance;
-}
-
-void QtSensorGestureSensorHandler::accelChanged()
-{
- Q_EMIT accelReadingChanged(accel->reading());
-}
-
-void QtSensorGestureSensorHandler::orientationChanged()
-{
- Q_EMIT orientationReadingChanged(orientation->reading());
-}
-
-void QtSensorGestureSensorHandler::proximityChanged()
-{
- Q_EMIT proximityReadingChanged(proximity->reading());
-}
-
-void QtSensorGestureSensorHandler::irProximityChanged()
-{
- Q_EMIT irProximityReadingChanged(irProx->reading());
-}
-
-void QtSensorGestureSensorHandler::doubletap()
-{
- Q_EMIT dTabReadingChanged(tapSensor->reading());
-}
-
-bool QtSensorGestureSensorHandler::startSensor(SensorGestureSensors sensor)
-{
- bool ok = true;
- switch (sensor) {
- case Accel:
- //accel
- if (accel == 0x0) {
- accel = new QAccelerometer(this);
- ok = accel->connectToBackend();
- accel->setDataRate(100);
- qoutputrangelist outputranges = accel->outputRanges();
-
- if (outputranges.count() > 0)
- accelRange = (int)(outputranges.at(0).maximum);//39
- else
- accelRange = 39; //this should never happen
- connect(accel,SIGNAL(readingChanged()),this,SLOT(accelChanged()));
- }
- if (ok && !accel->isActive())
- accel->start();
- break;
- case Orientation:
- //orientation
- if (orientation == 0x0) {
- orientation = new QOrientationSensor(this);
- ok = orientation->connectToBackend();
- orientation->setDataRate(50);
- connect(orientation,SIGNAL(readingChanged()),this,SLOT(orientationChanged()));
- }
- if (ok && !orientation->isActive())
- orientation->start();
- break;
- case Proximity:
- //proximity
- if (proximity == 0x0) {
- proximity = new QProximitySensor(this);
- ok = proximity->connectToBackend();
- connect(proximity,SIGNAL(readingChanged()),this,SLOT(proximityChanged()));
- }
- if (ok && !proximity->isActive())
- proximity->start();
- break;
- case IrProximity:
- //irproximity
- if (irProx == 0x0) {
- irProx = new QIRProximitySensor(this);
- irProx->setDataRate(50);
- ok = irProx->connectToBackend();
- connect(irProx,SIGNAL(readingChanged()),this,SLOT(irProximityChanged()));
- }
- if (ok && !irProx->isActive())
- irProx->start();
- break;
- case Tap:
- //dtap
- if (tapSensor == 0x0) {
- tapSensor = new QTapSensor(this);
- ok = tapSensor->connectToBackend();
- connect(tapSensor,SIGNAL(readingChanged()),this,SLOT(doubletap()));
- }
- if (ok && !tapSensor->isActive())
- tapSensor->start();
- break;
- };
- int val = usedSensorsMap.value(sensor);
- usedSensorsMap.insert(sensor,++val);
-
- return ok;
-}
-
-void QtSensorGestureSensorHandler::stopSensor(SensorGestureSensors sensor)
-{
- // qDebug() << __FUNCTION__ << sensor;
- if (usedSensorsMap.value(sensor) == 0)
- return;
- int val = usedSensorsMap.value(sensor);
- usedSensorsMap.insert(sensor,--val);
- switch (sensor) {
- case Accel:
- //accel
- if (usedSensorsMap.value(sensor) == 0) {
- accel->stop();
- }
- break;
- case Orientation:
- if (usedSensorsMap.value(sensor) == 0) {
- orientation->stop();
- }
- //orientation
- break;
- case Proximity:
- if (usedSensorsMap.value(sensor) == 0) {
- proximity->stop();
- }
- //proximity
- break;
- case IrProximity:
- if (usedSensorsMap.value(sensor) == 0) {
- irProx->stop();
- }
- //irproximity
- break;
- case Tap:
- if (usedSensorsMap.value(sensor) == 0) {
- tapSensor->stop();
- }
- //dtap
- break;
- };
-}
diff --git a/src/plugins/sensorgestures/qtsensors/qtsensorgesturesensorhandler.h b/src/plugins/sensorgestures/qtsensors/qtsensorgesturesensorhandler.h
deleted file mode 100644
index e3f4960b..00000000
--- a/src/plugins/sensorgestures/qtsensors/qtsensorgesturesensorhandler.h
+++ /dev/null
@@ -1,98 +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 QTSENSORGESTURESENSORHANDLER_H
-#define QTSENSORGESTURESENSORHANDLER_H
-
-#include <QObject>
-
-#include <QtSensors/QAccelerometer>
-#include <QtSensors/QAccelerometerFilter>
-#include <QtSensors/QSensor>
-#include <QtSensors/QOrientationSensor>
-#include <QtSensors/QProximitySensor>
-#include <QtSensors/QIRProximitySensor>
-#include <QtSensors/QTapSensor>
-
-class QtSensorGestureSensorHandler : public QObject
-{
- Q_OBJECT
- Q_ENUMS(SensorGestureSensors)
-public:
- explicit QtSensorGestureSensorHandler(QObject *parent = 0);
-
- enum SensorGestureSensors {
- Accel = 0,
- Orientation,
- Proximity,
- IrProximity,
- Tap
- };
- static QtSensorGestureSensorHandler *instance();
- qreal accelRange;
-
-public slots:
- void accelChanged();
- void orientationChanged();
- void proximityChanged();
- void irProximityChanged();
- void doubletap();
-
- bool startSensor(SensorGestureSensors sensor);
- void stopSensor(SensorGestureSensors sensor);
-
-Q_SIGNALS:
- void accelReadingChanged(QAccelerometerReading *reading);
- void orientationReadingChanged(QOrientationReading *reading);
- void proximityReadingChanged(QProximityReading *reading);
- void irProximityReadingChanged(QIRProximityReading *reading);
- void dTabReadingChanged(QTapReading *reading);
-
-private:
- QAccelerometer *accel;
- QOrientationSensor *orientation;
- QProximitySensor *proximity;
- QIRProximitySensor *irProx;
- QTapSensor *tapSensor;
-
- QMap<SensorGestureSensors, int> usedSensorsMap;
-
-};
-
-#endif // QTSENSORGESTURESENSORHANDLER_H
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/qtsensors/qturnoversensorgesturerecognizer.cpp b/src/plugins/sensorgestures/qtsensors/qturnoversensorgesturerecognizer.cpp
deleted file mode 100644
index e2d9bea8..00000000
--- a/src/plugins/sensorgestures/qtsensors/qturnoversensorgesturerecognizer.cpp
+++ /dev/null
@@ -1,139 +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 <QtSensors/QSensor>
-
-#include "qturnoversensorgesturerecognizer.h"
-#include "qtsensorgesturesensorhandler.h"
-
-QT_BEGIN_NAMESPACE
-
-// turnover and put down i.e. facedown
-
-QTurnoverSensorGestureRecognizer::QTurnoverSensorGestureRecognizer(QObject *parent) :
- QSensorGestureRecognizer(parent),
- isClose(0)
- , isFaceDown(0), active(0)
-{
-}
-
-QTurnoverSensorGestureRecognizer::~QTurnoverSensorGestureRecognizer()
-{
-}
-
-void QTurnoverSensorGestureRecognizer::create()
-{
-}
-
-bool QTurnoverSensorGestureRecognizer::start()
-{
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Proximity)) {
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Orientation)) {
- active = true;
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(proximityReadingChanged(QProximityReading*)),
- this,SLOT(proximityChanged(QProximityReading*)));
-
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(orientationReadingChanged(QOrientationReading*)),
- this,SLOT(orientationReadingChanged(QOrientationReading*)));
- } else {
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Proximity);
- active = false;
- }
- } else {
- active = false;
- }
- return active;
-}
-
-bool QTurnoverSensorGestureRecognizer::stop()
-{
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Proximity);
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Orientation);
-
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(proximityReadingChanged(QProximityReading*)),
- this,SLOT(proximityChanged(QProximityReading*)));
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(orientationReadingChanged(QOrientationReading*)),
- this,SLOT(orientationReadingChanged(QOrientationReading*)));
-
- active = false;
-
- return active;
-}
-
-bool QTurnoverSensorGestureRecognizer::isActive()
-{
- return active;
-}
-
-QString QTurnoverSensorGestureRecognizer::id() const
-{
- return QString("QtSensors.turnover");
-}
-
-void QTurnoverSensorGestureRecognizer::proximityChanged(QProximityReading *reading)
-{
- isClose = reading->close();
- if (isClose)
- isRecognized();
-}
-
-void QTurnoverSensorGestureRecognizer::orientationReadingChanged(QOrientationReading *reading)
-{
- switch (reading->orientation()) {
- case QOrientationReading::FaceDown:
- {
- isFaceDown = true;
- isRecognized();
- }
- break;
- default:
- isFaceDown = false;
- break;
- };
-}
-
-void QTurnoverSensorGestureRecognizer::isRecognized()
-{
- if (isClose && isFaceDown) {
- Q_EMIT turnover();
- Q_EMIT detected("turnover");
- }
-}
-QT_END_NAMESPACE
-
diff --git a/src/plugins/sensorgestures/qtsensors/qturnoversensorgesturerecognizer.h b/src/plugins/sensorgestures/qtsensors/qturnoversensorgesturerecognizer.h
deleted file mode 100644
index 295cb5f7..00000000
--- a/src/plugins/sensorgestures/qtsensors/qturnoversensorgesturerecognizer.h
+++ /dev/null
@@ -1,80 +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 QTURNOVERSENSORGESTURERECOGNIZER_H
-#define QTURNOVERSENSORGESTURERECOGNIZER_H
-
-#include <QtSensors/qsensorgesturerecognizer.h>
-#include "qtsensorgesturesensorhandler.h"
-
-QT_BEGIN_NAMESPACE
-
-class QTurnoverSensorGestureRecognizer : public QSensorGestureRecognizer
-{
- Q_OBJECT
-public:
- explicit QTurnoverSensorGestureRecognizer(QObject *parent = 0);
- ~QTurnoverSensorGestureRecognizer();
-
- void create() override;
-
- QString id() const override;
- bool start() override;
- bool stop() override;
- bool isActive() override;
-
-Q_SIGNALS:
- void turnover();
-
-private slots:
- void orientationReadingChanged(QOrientationReading *reading);
- void proximityChanged(QProximityReading *reading);
- void isRecognized();
-
-private:
-
- bool isClose;
- bool isFaceDown;
- bool active;
-
- QList<qreal> zList;
-
-};
-QT_END_NAMESPACE
-#endif // QTURNOVERSENSORGESTURERECOGNIZER_H
diff --git a/src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.cpp b/src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.cpp
deleted file mode 100644
index 6a1f1706..00000000
--- a/src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.cpp
+++ /dev/null
@@ -1,291 +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 "qtwistsensorgesturerecognizer.h"
-
-#include <QtCore/qmath.h>
-
-QT_BEGIN_NAMESPACE
-
-#define TIMER_TIMEOUT 750
-QTwistSensorGestureRecognizer::QTwistSensorGestureRecognizer(QObject *parent)
- : QSensorGestureRecognizer(parent)
- , orientationReading(0)
- , active(0)
- , detecting(0)
- , checking(0)
- , increaseCount(0)
- , decreaseCount(0)
- , lastAngle(0)
- , detectedAngle(0)
-{
-}
-
-QTwistSensorGestureRecognizer::~QTwistSensorGestureRecognizer()
-{
-}
-
-void QTwistSensorGestureRecognizer::create()
-{
-}
-
-QString QTwistSensorGestureRecognizer::id() const
-{
- return QString("QtSensors.twist");
-}
-
-bool QTwistSensorGestureRecognizer::start()
-{
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Accel)) {
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Orientation)) {
- active = true;
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(orientationReadingChanged(QOrientationReading*)),
- this,SLOT(orientationReadingChanged(QOrientationReading*)));
-
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(accelReadingChanged(QAccelerometerReading*)),
- this,SLOT(accelChanged(QAccelerometerReading*)));
- } else {
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Accel);
- active = false;
- }
- } else {
-
- active = false;
- }
-
- return active;
-}
-
-bool QTwistSensorGestureRecognizer::stop()
-{
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Accel);
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Orientation);
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(orientationReadingChanged(QOrientationReading*)),
- this,SLOT(orientationReadingChanged(QOrientationReading*)));
-
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(accelReadingChanged(QAccelerometerReading*)),
- this,SLOT(accelChanged(QAccelerometerReading*)));
-
- reset();
- orientationList.clear();
- active = false;
- return active;
-}
-
-bool QTwistSensorGestureRecognizer::isActive()
-{
- return active;
-}
-
-void QTwistSensorGestureRecognizer::orientationReadingChanged(QOrientationReading *reading)
-{
- orientationReading = reading;
- if (orientationList.count() == 3)
- orientationList.removeFirst();
-
- orientationList.append(reading->orientation());
-
- if (orientationList.count() == 3
- && orientationList.at(2) == QOrientationReading::FaceUp
- && (orientationList.at(1) == QOrientationReading::RightUp
- || orientationList.at(1) == QOrientationReading::LeftUp)) {
- checkTwist();
- }
-
- checkOrientation();
-}
-
-bool QTwistSensorGestureRecognizer::checkOrientation()
-{
- if (orientationReading->orientation() == QOrientationReading::TopDown
- || orientationReading->orientation() == QOrientationReading::FaceDown) {
- reset();
- return false;
- }
- return true;
-}
-
-void QTwistSensorGestureRecognizer::accelChanged(QAccelerometerReading *reading)
-{
- if (orientationReading == 0)
- return;
-
- const qreal x = reading->x();
- const qreal y = reading->y();
- const qreal z = reading->z();
-
- if (!detecting && !checking&& dataList.count() > 21)
- dataList.removeFirst();
-
- qreal angle = qRadiansToDegrees(qAtan(x / qSqrt(y * y + z * z)));
-
- if (qAbs(angle) > 2) {
- if (detecting) {
- if ((angle > 0 && angle < lastAngle)
- || (angle < 0 && angle > lastAngle)) {
- decreaseCount++;
- } else {
- if (decreaseCount > 0)
- decreaseCount--;
- }
- }
-
- if (!detecting && ((angle > 0 && angle > lastAngle)
- || (angle < 0 && angle < lastAngle))
- && ((angle > 0 && lastAngle > 0)
- || (angle < 0 && lastAngle < 0))) {
- increaseCount++;
- } else
- if (!detecting && increaseCount > 3 && qAbs(angle) > 30) {
- decreaseCount = 0;
- detecting = true;
- detectedAngle = qRadiansToDegrees(qAtan(y / qSqrt(x * x + z * z)));
- }
- } else {
- increaseCount = 0;
- increaseCount = 0;
- }
-
- lastAngle = angle;
- if (detecting && decreaseCount >= 4 && qAbs(angle) < 25) {
- checkTwist();
- }
-
- twistAccelData data;
- data.x = x;
- data.y = y;
- data.z = z;
-
- if (qAbs(x) > 1)
- dataList.append(data);
-
- if (qAbs(z) > 15.0) {
- reset();
- }
-
-}
-
-void QTwistSensorGestureRecognizer::checkTwist()
-{
- checking = true;
- int lastx = 0;
- bool ok = false;
- bool spinpoint = false;
-
- if (detectedAngle < 0) {
- reset();
- return;
- }
-
- //// check for orientation changes first
- if (orientationList.count() < 2)
- return;
-
- if (orientationList.count() > 2)
- if (orientationList.at(0) == orientationList.at(2)
- && (orientationList.at(1) == QOrientationReading::LeftUp
- || orientationList.at(1) == QOrientationReading::RightUp)) {
- ok = true;
- if (orientationList.at(1) == QOrientationReading::RightUp)
- detectedAngle = 1;
- else
- detectedAngle = -1;
- }
-
- // now the manual increase/decrease count
- if (!ok) {
- if (increaseCount < 1 || decreaseCount < 3)
- return;
-
- if (increaseCount > 6 && decreaseCount > 4) {
- ok = true;
- if (orientationList.at(1) == QOrientationReading::RightUp)
- detectedAngle = 1;
- else
- detectedAngle = -1;
- }
- }
- // now we're really grasping for anything
- if (!ok)
- for (int i = 0; i < dataList.count(); i++) {
- twistAccelData curData = dataList.at(i);
- if (!spinpoint && qAbs(curData.x) < 1)
- continue;
- if (curData.z >= 0 ) {
- if (!spinpoint && (curData.x > lastx || curData.x < lastx) && curData.x - lastx > 1) {
- ok = true;
- } else if (spinpoint && (curData.x < lastx || curData.x > lastx)&& lastx - curData.x > 1) {
- ok = true;
- } else {
- ok = false;
- }
- } else if (!spinpoint && curData.z < 0) {
- spinpoint = true;
- } else if (spinpoint && curData.z > 9) {
- break;
- }
-
- lastx = curData.x;
- }
- if (ok) {
- if (detectedAngle > 0) {
- Q_EMIT twistLeft();
- Q_EMIT detected("twistLeft");
- } else {
- Q_EMIT twistRight();
- Q_EMIT detected("twistRight");
- }
- }
- reset();
-}
-
-void QTwistSensorGestureRecognizer::reset()
-{
- detecting = false;
- checking = false;
- dataList.clear();
- increaseCount = 0;
- decreaseCount = 0;
- lastAngle = 0;
-}
-
-
-
-QT_END_NAMESPACE
diff --git a/src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.h b/src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.h
deleted file mode 100644
index 3080e2a6..00000000
--- a/src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.h
+++ /dev/null
@@ -1,96 +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 QWFLICKSENSORGESTURERECOGNIZER_H
-#define QWFLICKSENSORGESTURERECOGNIZER_H
-
-#include <QtSensors/qsensorgesturerecognizer.h>
-#include <QtSensors/QAccelerometer>
-#include <QtSensors/QOrientationSensor>
-#include "qtsensorgesturesensorhandler.h"
-
-QT_BEGIN_NAMESPACE
-
-struct twistAccelData {
- qreal x;
- qreal y;
- qreal z;
-};
-
-class QTwistSensorGestureRecognizer : public QSensorGestureRecognizer
-{
- Q_OBJECT
-public:
- explicit QTwistSensorGestureRecognizer(QObject *parent = 0);
- ~QTwistSensorGestureRecognizer();
-
- void create() override;
-
- QString id() const override;
- bool start() override;
- bool stop() override;
- bool isActive() override;
-
-Q_SIGNALS:
- void twistLeft();
- void twistRight();
-
-private slots:
- void accelChanged(QAccelerometerReading *reading);
- void orientationReadingChanged(QOrientationReading *reading);
- void checkTwist();
-
-private:
-
- QOrientationReading *orientationReading;
- bool active;
- bool detecting;
- QList <twistAccelData> dataList;
- bool checking;
- void reset();
- bool checkOrientation();
- int increaseCount;
- int decreaseCount;
- qreal lastAngle;
- QList <QOrientationReading::Orientation> orientationList;
- qreal detectedAngle;
-};
-QT_END_NAMESPACE
-#endif // QWFLICKSENSORGESTURERECOGNIZER_H
diff --git a/src/plugins/sensorgestures/qtsensors/qwhipsensorgesturerecognizer.cpp b/src/plugins/sensorgestures/qtsensors/qwhipsensorgesturerecognizer.cpp
deleted file mode 100644
index 4d9edb25..00000000
--- a/src/plugins/sensorgestures/qtsensors/qwhipsensorgesturerecognizer.cpp
+++ /dev/null
@@ -1,241 +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 "qwhipsensorgesturerecognizer.h"
-#include "qtsensorgesturesensorhandler.h"
-
-#include <QtCore/qmath.h>
-
-#define TIMER_TIMEOUT 850
-
-QT_BEGIN_NAMESPACE
-
-QWhipSensorGestureRecognizer::QWhipSensorGestureRecognizer(QObject *parent)
- : QSensorGestureRecognizer(parent),
- orientationReading(0),
- accelRange(0),
- active(0),
- lastX(0),
- lastY(0),
- lastZ(0),
- detecting(0),
- whipOk(0)
- , lastTimestamp(0)
- , timerActive(0)
- , lapsedTime(0)
-{
-}
-
-QWhipSensorGestureRecognizer::~QWhipSensorGestureRecognizer()
-{
-}
-
-void QWhipSensorGestureRecognizer::create()
-{
-}
-
-QString QWhipSensorGestureRecognizer::id() const
-{
- return QString("QtSensors.whip");
-}
-
-bool QWhipSensorGestureRecognizer::start()
-{
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Accel)) {
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Orientation)) {
- accelRange = QtSensorGestureSensorHandler::instance()->accelRange;
- active = true;
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(orientationReadingChanged(QOrientationReading*)),
- this,SLOT(orientationReadingChanged(QOrientationReading*)));
-
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(accelReadingChanged(QAccelerometerReading*)),
- this,SLOT(accelChanged(QAccelerometerReading*)));
- } else {
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Accel);
- active = false;
- }
- } else {
- active = false;
- }
- lastTimestamp = 0;
- timerActive = false;
- lapsedTime = 0;
- return active;
-}
-
-bool QWhipSensorGestureRecognizer::stop()
-{
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Accel);
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Orientation);
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(orientationReadingChanged(QOrientationReading*)),
- this,SLOT(orientationReadingChanged(QOrientationReading*)));
-
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(accelReadingChanged(QAccelerometerReading*)),
- this,SLOT(accelChanged(QAccelerometerReading*)));
- active = false;
- return active;
-}
-
-bool QWhipSensorGestureRecognizer::isActive()
-{
- return active;
-}
-
-void QWhipSensorGestureRecognizer::orientationReadingChanged(QOrientationReading *reading)
-{
- orientationReading = reading;
-}
-
-#define WHIP_FACTOR -11.0
-#define WHIP_WIGGLE_FACTOR 0.35
-
-void QWhipSensorGestureRecognizer::accelChanged(QAccelerometerReading *reading)
-{
- const qreal x = reading->x();
- const qreal y = reading->y();
- qreal z = reading->z();
-
- quint64 timestamp = reading->timestamp();
-
- if (zList.count() > 4)
- zList.removeLast();
-
- qreal averageZ = 0;
- Q_FOREACH (qreal az, zList) {
- averageZ += az;
- }
-// averageZ += z;
- averageZ /= zList.count();
-
- zList.insert(0,z);
-
- if (orientationReading == 0)
- return;
- //// very hacky
- if (orientationReading->orientation() == QOrientationReading::FaceUp) {
- z = z - 9.8;
- }
-
- const qreal diffX = lastX - x;
- const qreal diffY = lastY - y;
-
- if (detecting && whipMap.count() > 5 && whipMap.at(5) == true) {
- checkForWhip();
- }
-
- if (whipMap.count() > 5)
- whipMap.removeLast();
-
- if (negativeList.count() > 5)
- negativeList.removeLast();
-
- if (z < WHIP_FACTOR
- && qAbs(diffX) > -(accelRange * .1285)//-5.0115
- && qAbs(lastX) < 7
- && qAbs(x) < 7) {
- whipMap.insert(0,true);
- if (!detecting && !timerActive) {
- timerActive = true;
- detecting = true;
- }
- } else {
- whipMap.insert(0,false);
- }
-
- // check if shaking
- if ((((x < 0 && lastX > 0) || (x > 0 && lastX < 0))
- && qAbs(diffX) > (accelRange * 0.7)) //27.3
- || (((y < 0 && lastY > 0) || (y > 0 && lastY < 0))
- && qAbs(diffY) > (accelRange * 0.7))) {
- negativeList.insert(0,true);
- } else {
- negativeList.insert(0,false);
- }
-
- lastX = x;
- lastY = y;
- lastZ = z;
-
- if (timerActive && lastTimestamp > 0)
- lapsedTime += (timestamp - lastTimestamp )/1000;
-
- if (timerActive && lapsedTime >= TIMER_TIMEOUT) {
- timeout();
- }
-}
-
-void QWhipSensorGestureRecognizer::timeout()
-{
- detecting = false;
-}
-
-
-void QWhipSensorGestureRecognizer::checkForWhip()
-{
- whipOk = false;
-
- int check = 0;
- Q_FOREACH (qreal az, zList) {
- if (az < -10)
- check++;
- }
- if (check >= 4)
- whipOk = true;
- else
- return;
-
- if (whipOk) {
- bool ok = true;
- for (int i = 0; i < negativeList.count() - 1; i++) {
- if (negativeList.at(i)) {
- ok = false;
- }
- }
- if (ok) {
- Q_EMIT whip();
- Q_EMIT detected("whip");
- }
- detecting = false;
- whipMap.clear();
- timerActive = false;
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/sensorgestures/qtsensors/qwhipsensorgesturerecognizer.h b/src/plugins/sensorgestures/qtsensors/qwhipsensorgesturerecognizer.h
deleted file mode 100644
index 6d674ab5..00000000
--- a/src/plugins/sensorgestures/qtsensors/qwhipsensorgesturerecognizer.h
+++ /dev/null
@@ -1,100 +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 QWHIPSENSORGESTURERECOGNIZER_H
-#define QWHIPSENSORGESTURERECOGNIZER_H
-
-#include <QtSensors/qsensorgesturerecognizer.h>
-
-#include "qtsensorgesturesensorhandler.h"
-
-QT_BEGIN_NAMESPACE
-
-class QWhipSensorGestureRecognizer : public QSensorGestureRecognizer
-{
- Q_OBJECT
-public:
- explicit QWhipSensorGestureRecognizer(QObject *parent = 0);
- ~QWhipSensorGestureRecognizer();
-
- void create() override;
-
- QString id() const override;
- bool start() override;
- bool stop() override;
- bool isActive() override;
-
-Q_SIGNALS:
- void whip();
-
-private slots:
- void accelChanged(QAccelerometerReading *reading);
- void orientationReadingChanged(QOrientationReading *reading);
- void timeout();
-
-private:
- QOrientationReading *orientationReading;
- qreal accelRange;
- bool active;
-
- qreal lastX;
- qreal lastY;
- qreal lastZ;
-
- bool detecting;
- bool whipOk;
-
- QList<bool> whipMap;
-
- void checkForWhip();
-
- QList <bool> negativeList;
-
- QList<qreal> zList;
-
- quint64 lastTimestamp;
-
- bool timerActive;
- quint64 lapsedTime;
-
-};
-
-QT_END_NAMESPACE
-#endif // QWHIPSENSORGESTURERECOGNIZER_H
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/qshakerecognizer.cpp b/src/plugins/sensorgestures/shake/qshakerecognizer.cpp
deleted file mode 100644
index b9ccbdbb..00000000
--- a/src/plugins/sensorgestures/shake/qshakerecognizer.cpp
+++ /dev/null
@@ -1,160 +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 <QDebug>
-#include <QTimer>
-
-#include "qshakerecognizer.h"
-
-QShakeSensorGestureRecognizer::QShakeSensorGestureRecognizer(QObject *parent)
- : QSensorGestureRecognizer(parent)
- , timerTimeout(450)
- , active(0)
- , shaking(0)
- , shakeCount(0)
-{
-}
-
-QShakeSensorGestureRecognizer::~QShakeSensorGestureRecognizer()
-{
-}
-
-void QShakeSensorGestureRecognizer::create()
-{
- accel = new QAccelerometer(this);
- accel->connectToBackend();
- accel->setDataRate(50);
-
- qoutputrangelist outputranges = accel->outputRanges();
-
- if (outputranges.count() > 0)
- accelRange = (int)(outputranges.at(0).maximum *2) / 9.8; //approx range in g's
- else
- accelRange = 4; //this should never happen
-
- connect(accel,SIGNAL(readingChanged()),this,SLOT(accelChanged()));
- timer = new QTimer(this);
- connect(timer,SIGNAL(timeout()),this,SLOT(timeout()));
- timer->setSingleShot(true);
- timer->setInterval(timerTimeout);
-}
-
-bool QShakeSensorGestureRecognizer::start()
-{
- active = accel->start();
- return active;
-}
-
-bool QShakeSensorGestureRecognizer::stop()
-{
- accel->stop();
- active = accel->isActive();
- return !active;
-}
-
-bool QShakeSensorGestureRecognizer::isActive()
-{
- return active;
-}
-
-QString QShakeSensorGestureRecognizer::id() const
-{
- return QString("QtSensors.shake");
-}
-
-#define NUMBER_SHAKES 3
-#define THRESHOLD 25
-
-void QShakeSensorGestureRecognizer::accelChanged()
-{
- qreal x = accel->reading()->x();
- qreal y = accel->reading()->y();
- qreal z = accel->reading()->z();
-
- currentData.x = x;
- currentData.y = y;
- currentData.z = z;
-
- if (qAbs(prevData.x - currentData.x) < 1
- && qAbs(prevData.y - currentData.y) < 1
- && qAbs(prevData.z - currentData.z) < 1) {
- prevData.x = currentData.x;
- prevData.y = currentData.y;
- prevData.z = currentData.z;
- return;
- }
-
- bool wasShake = checkForShake(prevData, currentData, THRESHOLD);
- if (!shaking && wasShake &&
- shakeCount >= NUMBER_SHAKES) {
- shaking = true;
- shakeCount = 0;
- Q_EMIT shake();
- Q_EMIT detected("shake");
-
- } else if (wasShake) {
-
- shakeCount++;
- if (shakeCount > NUMBER_SHAKES) {
- timer->start();
- }
- }
-
- prevData.x = currentData.x;
- prevData.y = currentData.y;
- prevData.z = currentData.z;
-}
-
-void QShakeSensorGestureRecognizer::timeout()
-{
- shakeCount = 0;
- shaking = false;
-}
-
-bool QShakeSensorGestureRecognizer::checkForShake(AccelData prevSensorData, AccelData currentSensorData, qreal threshold)
-{
- double deltaX = qAbs(prevSensorData.x - currentSensorData.x);
- double deltaY = qAbs(prevSensorData.y - currentSensorData.y);
- double deltaZ = qAbs(prevSensorData.z - currentSensorData.z);
-
- return (deltaX > threshold
- || deltaY > threshold
- || deltaZ > threshold);
-}
-
diff --git a/src/plugins/sensorgestures/shake/qshakerecognizer.h b/src/plugins/sensorgestures/shake/qshakerecognizer.h
deleted file mode 100644
index 21c85664..00000000
--- a/src/plugins/sensorgestures/shake/qshakerecognizer.h
+++ /dev/null
@@ -1,98 +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 QSHAKERECOGNIZER_H
-#define QSHAKERECOGNIZER_H
-
-
-#include <QtSensors/QSensor>
-#include <QtSensors/QAccelerometer>
-#include <QtSensors/QAccelerometerFilter>
-#include <QDebug>
-#include <QTimer>
-
-#include <QtSensors/qsensorgesturerecognizer.h>
-
- struct AccelData {
- qreal x;
- qreal y;
- qreal z;
-};
-
-class QShakeSensorGestureRecognizer : public QSensorGestureRecognizer
-{
- Q_OBJECT
-
-public:
-
- QShakeSensorGestureRecognizer(QObject *parent = 0);
- ~QShakeSensorGestureRecognizer();
-
- void create() override;
-
- QString id() const override;
- bool start() override;
- bool stop() override;
- bool isActive() override;
-
- QTimer *timer;
- int timerTimeout;
-
-Q_SIGNALS:
- void shake();
-
-private slots:
- void accelChanged();
- void timeout();
-private:
- QAccelerometer *accel;
- bool active;
- int accelRange;
-
- AccelData prevData;
- AccelData currentData;
-
- bool checkForShake(AccelData prevSensorData, AccelData currentSensorData, qreal threshold);
- bool shaking;
- int shakeCount;
- int threshold;
-
-};
-
-#endif // QSHAKERECOGNIZER_H
diff --git a/src/plugins/sensorgestures/shake/qshakesensorgestureplugin.cpp b/src/plugins/sensorgestures/shake/qshakesensorgestureplugin.cpp
deleted file mode 100644
index 243b2dbf..00000000
--- a/src/plugins/sensorgestures/shake/qshakesensorgestureplugin.cpp
+++ /dev/null
@@ -1,74 +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 <QtPlugin>
-#include <QStringList>
-#include <QObject>
-
-#include "qshakesensorgestureplugin.h"
-
-#include <QtSensors/qsensorgestureplugininterface.h>
-
-#include "qshakerecognizer.h"
-
-
-QShakeSensorGesturePlugin::QShakeSensorGesturePlugin()
-{
-}
-
-QShakeSensorGesturePlugin::~QShakeSensorGesturePlugin()
-{
-}
-
-QStringList QShakeSensorGesturePlugin::supportedIds() const
-{
- QStringList list;
- list << "QtSensors.shake";
- return list;
-}
-
-QList <QSensorGestureRecognizer *> QShakeSensorGesturePlugin::createRecognizers()
-{
- QList <QSensorGestureRecognizer *> recognizers;
-
- QSensorGestureRecognizer *sRec = new QShakeSensorGestureRecognizer(this);
- recognizers.append(sRec);
-
- return recognizers;
-}
diff --git a/src/plugins/sensorgestures/shake/qshakesensorgestureplugin.h b/src/plugins/sensorgestures/shake/qshakesensorgestureplugin.h
deleted file mode 100644
index 96814eb8..00000000
--- a/src/plugins/sensorgestures/shake/qshakesensorgestureplugin.h
+++ /dev/null
@@ -1,65 +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 QSHAKESENSORGESTUREPLUGIN_H
-#define QSHAKESENSORGESTUREPLUGIN_H
-
-#include <QObject>
-#include <QStringList>
-
-#include <QtSensors/qsensorgestureplugininterface.h>
-
-class QShakeSensorGesturePlugin : public QObject, public QSensorGesturePluginInterface
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.QSensorGesturePluginInterface")
- Q_INTERFACES(QSensorGesturePluginInterface)
-
-public:
- explicit QShakeSensorGesturePlugin();
- ~QShakeSensorGesturePlugin();
-
- QList <QSensorGestureRecognizer *> createRecognizers() override;
-
- QStringList gestureSignals() const;
- QStringList supportedIds() const override;
- QString name() const override { return "ShakeGestures"; }
-};
-
-#endif // QSHAKESENSORGESTUREPLUGIN_H
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..e7527d8f
--- /dev/null
+++ b/src/plugins/sensors/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# 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 (QT_FEATURE_winrt_sensors AND NOT SENSORS_PLUGINS OR "winrt" IN_LIST SENSORS_PLUGINS)
+ add_subdirectory(winrt)
+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("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..9a77a9a5
--- /dev/null
+++ b/src/plugins/sensors/android/CMakeLists.txt
@@ -0,0 +1,35 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## QCounterGesturePlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(AndroidSensorPlugin
+ OUTPUT_NAME qtsensors_android
+ PLUGIN_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
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::Sensors
+ android
+)
+
+#### Keys ignored in scope 1:.:.:android.pro:<TRUE>:
+# 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/android/androidaccelerometer.cpp b/src/plugins/sensors/android/androidaccelerometer.cpp
index f38e0047..1e6004ed 100644
--- a/src/plugins/sensors/android/androidaccelerometer.cpp
+++ b/src/plugins/sensors/android/androidaccelerometer.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "androidaccelerometer.h"
#include <QDebug>
diff --git a/src/plugins/sensors/android/androidaccelerometer.h b/src/plugins/sensors/android/androidaccelerometer.h
index 04362451..32fa6410 100644
--- a/src/plugins/sensors/android/androidaccelerometer.h
+++ b/src/plugins/sensors/android/androidaccelerometer.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ANDROIDACCELEROMETER_H
#define ANDROIDACCELEROMETER_H
diff --git a/src/plugins/sensors/android/androidcompass.cpp b/src/plugins/sensors/android/androidcompass.cpp
index 653c5e99..9cdea54d 100644
--- a/src/plugins/sensors/android/androidcompass.cpp
+++ b/src/plugins/sensors/android/androidcompass.cpp
@@ -1,58 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
-** 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$
-**
-****************************************************************************/
-
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// Copyright (C) 2008 The Android Open Source Project
+// SPDX-License-Identifier: Apache-2.0
#include "androidcompass.h"
diff --git a/src/plugins/sensors/android/androidcompass.h b/src/plugins/sensors/android/androidcompass.h
index 1d20de72..592d641c 100644
--- a/src/plugins/sensors/android/androidcompass.h
+++ b/src/plugins/sensors/android/androidcompass.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ANDROIDCOMPASS_H
#define ANDROIDCOMPASS_H
diff --git a/src/plugins/sensors/android/androidgyroscope.cpp b/src/plugins/sensors/android/androidgyroscope.cpp
index 2a38b5a0..acc4798a 100644
--- a/src/plugins/sensors/android/androidgyroscope.cpp
+++ b/src/plugins/sensors/android/androidgyroscope.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "androidgyroscope.h"
#include <QtCore/qmath.h>
diff --git a/src/plugins/sensors/android/androidgyroscope.h b/src/plugins/sensors/android/androidgyroscope.h
index 7d1ecec0..2dd3c8cc 100644
--- a/src/plugins/sensors/android/androidgyroscope.h
+++ b/src/plugins/sensors/android/androidgyroscope.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ANDROIDGYROSCOPE_H
#define ANDROIDGYROSCOPE_H
diff --git a/src/plugins/sensors/android/androidlight.cpp b/src/plugins/sensors/android/androidlight.cpp
index 724ed970..42c8f0b7 100644
--- a/src/plugins/sensors/android/androidlight.cpp
+++ b/src/plugins/sensors/android/androidlight.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "androidlight.h"
diff --git a/src/plugins/sensors/android/androidlight.h b/src/plugins/sensors/android/androidlight.h
index 74c963fb..59c67981 100644
--- a/src/plugins/sensors/android/androidlight.h
+++ b/src/plugins/sensors/android/androidlight.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ANDROIDLIGHT_H
#define ANDROIDLIGHT_H
diff --git a/src/plugins/sensors/android/androidmagnetometer.cpp b/src/plugins/sensors/android/androidmagnetometer.cpp
index ec663c0b..54d2225e 100644
--- a/src/plugins/sensors/android/androidmagnetometer.cpp
+++ b/src/plugins/sensors/android/androidmagnetometer.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "androidmagnetometer.h"
diff --git a/src/plugins/sensors/android/androidmagnetometer.h b/src/plugins/sensors/android/androidmagnetometer.h
index fb1f0ee7..e4e0fcbd 100644
--- a/src/plugins/sensors/android/androidmagnetometer.h
+++ b/src/plugins/sensors/android/androidmagnetometer.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ANDROIDMAGNETOMETER_H
#define ANDROIDMAGNETOMETER_H
diff --git a/src/plugins/sensors/android/androidpressure.cpp b/src/plugins/sensors/android/androidpressure.cpp
index 46acffd6..50dd86a0 100644
--- a/src/plugins/sensors/android/androidpressure.cpp
+++ b/src/plugins/sensors/android/androidpressure.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "androidpressure.h"
diff --git a/src/plugins/sensors/android/androidpressure.h b/src/plugins/sensors/android/androidpressure.h
index ec682e59..7121d73c 100644
--- a/src/plugins/sensors/android/androidpressure.h
+++ b/src/plugins/sensors/android/androidpressure.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ANDROIDPRESSURE_H
#define ANDROIDPRESSURE_H
diff --git a/src/plugins/sensors/android/androidproximity.cpp b/src/plugins/sensors/android/androidproximity.cpp
index 000399b0..2c134ba0 100644
--- a/src/plugins/sensors/android/androidproximity.cpp
+++ b/src/plugins/sensors/android/androidproximity.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "androidproximity.h"
diff --git a/src/plugins/sensors/android/androidproximity.h b/src/plugins/sensors/android/androidproximity.h
index 22169d6f..215292e8 100644
--- a/src/plugins/sensors/android/androidproximity.h
+++ b/src/plugins/sensors/android/androidproximity.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ANDROIDPROXIMITY_H
#define ANDROIDPROXIMITY_H
diff --git a/src/plugins/sensors/android/androidrotation.cpp b/src/plugins/sensors/android/androidrotation.cpp
index c1d141a0..43586a0f 100644
--- a/src/plugins/sensors/android/androidrotation.cpp
+++ b/src/plugins/sensors/android/androidrotation.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "androidrotation.h"
@@ -48,12 +12,41 @@ AndroidRotation::AndroidRotation(int type, QSensor *sensor, QObject *parent)
void AndroidRotation::dataReceived(const ASensorEvent &event)
{
- // ### Check me, at first look it seems wrong,
- // here https://developer.android.com/reference/android/hardware/SensorEvent.html#sensor.type_rotation_vector:
- // are the Android values
- qreal rz = -qRadiansToDegrees(qreal(event.data[0])); // event.data[0] corresponds to x
- qreal rx = -qRadiansToDegrees(qreal(event.data[1])); // event.data[1] corresponds to y
- qreal ry = qRadiansToDegrees(qreal(event.data[2])); // event.data[2] corresponds to z
+ // From android documentation, the rotation sensor values are:
+ // values[0]: x*sin(θ/2)
+ // values[1]: y*sin(θ/2)
+ // values[2]: z*sin(θ/2)
+ // values[3]: cos(θ/2)
+
+ // The mathematics below is adapted from
+ // https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/hardware/SensorManager.java#1644
+ // and
+ // https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/hardware/SensorManager.java#1469
+ // (getRotationMatrixFromVector() followed by getOrientation())
+ qreal angles[3];
+ qreal q1 = qreal(event.data[0]);
+ qreal q2 = qreal(event.data[1]);
+ qreal q3 = qreal(event.data[2]);
+ qreal q0 = qreal(event.data[3]);
+
+ qreal sq_q1 = 2 * q1 * q1;
+ qreal sq_q2 = 2 * q2 * q2;
+ qreal sq_q3 = 2 * q3 * q3;
+ qreal q1_q2 = 2 * q1 * q2;
+ qreal q3_q0 = 2 * q3 * q0;
+ qreal q1_q3 = 2 * q1 * q3;
+ qreal q2_q0 = 2 * q2 * q0;
+ qreal q2_q3 = 2 * q2 * q3;
+ qreal q1_q0 = 2 * q1 * q0;
+
+ angles[0] = std::atan2((q1_q2 - q3_q0), (1 - sq_q1 - sq_q3));
+ angles[1] = std::asin(-(q2_q3 + q1_q0));
+ angles[2] = std::atan2(-(q1_q3 - q2_q0), (1 - sq_q1 - sq_q2));
+
+ qreal rz = -qRadiansToDegrees(angles[0]);
+ qreal rx = -qRadiansToDegrees(angles[1]);
+ qreal ry = qRadiansToDegrees(angles[2]);
+
if (sensor()->skipDuplicates() && qFuzzyCompare(m_reader.x(), rx) &&
qFuzzyCompare(m_reader.y(), ry) &&
qFuzzyCompare(m_reader.z(), rz)) {
diff --git a/src/plugins/sensors/android/androidrotation.h b/src/plugins/sensors/android/androidrotation.h
index 9761b249..84860c11 100644
--- a/src/plugins/sensors/android/androidrotation.h
+++ b/src/plugins/sensors/android/androidrotation.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ANDROIDROTATION_H
#define ANDROIDROTATION_H
diff --git a/src/plugins/sensors/android/androidtemperature.cpp b/src/plugins/sensors/android/androidtemperature.cpp
index 5f85750a..f4c6cbe2 100644
--- a/src/plugins/sensors/android/androidtemperature.cpp
+++ b/src/plugins/sensors/android/androidtemperature.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "androidtemperature.h"
diff --git a/src/plugins/sensors/android/androidtemperature.h b/src/plugins/sensors/android/androidtemperature.h
index ba626051..654a5faa 100644
--- a/src/plugins/sensors/android/androidtemperature.h
+++ b/src/plugins/sensors/android/androidtemperature.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ANDROIDTEMPERATURE_H
#define ANDROIDTEMPERATURE_H
diff --git a/src/plugins/sensors/android/main.cpp b/src/plugins/sensors/android/main.cpp
index 85853cd2..8c2855cd 100644
--- a/src/plugins/sensors/android/main.cpp
+++ b/src/plugins/sensors/android/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qplugin.h>
#include <qsensorplugin.h>
@@ -77,7 +41,7 @@ public:
switch (sensor) {
case ASENSOR_TYPE_ACCELEROMETER:
m_accelerationModes |= AndroidAccelerometer::Accelerometer;
- QSensorManager::registerBackend(QAccelerometer::type, QByteArray::number(sensor), this);
+ QSensorManager::registerBackend(QAccelerometer::sensorType, QByteArray::number(sensor), this);
accelerometer = true;
break;
case ASENSOR_TYPE_GRAVITY:
@@ -87,26 +51,26 @@ public:
m_accelerationModes |= AndroidAccelerometer::LinearAcceleration;
break;
case ASENSOR_TYPE_AMBIENT_TEMPERATURE:
- QSensorManager::registerBackend(QAmbientTemperatureSensor::type, QByteArray::number(sensor), this);
+ QSensorManager::registerBackend(QAmbientTemperatureSensor::sensorType, QByteArray::number(sensor), this);
break;
case ASENSOR_TYPE_GYROSCOPE:
- QSensorManager::registerBackend(QGyroscope::type, QByteArray::number(sensor), this);
+ QSensorManager::registerBackend(QGyroscope::sensorType, QByteArray::number(sensor), this);
break;
case ASENSOR_TYPE_LIGHT:
- QSensorManager::registerBackend(QLightSensor::type, QByteArray::number(sensor), this);
+ QSensorManager::registerBackend(QLightSensor::sensorType, QByteArray::number(sensor), this);
break;
case ASENSOR_TYPE_MAGNETIC_FIELD:
- QSensorManager::registerBackend(QMagnetometer::type, QByteArray::number(sensor), this);
+ QSensorManager::registerBackend(QMagnetometer::sensorType, QByteArray::number(sensor), this);
magnetometer = true;
break;
case ASENSOR_TYPE_PRESSURE:
- QSensorManager::registerBackend(QPressureSensor::type, QByteArray::number(sensor), this);
+ QSensorManager::registerBackend(QPressureSensor::sensorType, QByteArray::number(sensor), this);
break;
case ASENSOR_TYPE_PROXIMITY:
- QSensorManager::registerBackend(QProximitySensor::type, QByteArray::number(sensor), this);
+ QSensorManager::registerBackend(QProximitySensor::sensorType, QByteArray::number(sensor), this);
break;
case ASENSOR_TYPE_ROTATION_VECTOR:
- QSensorManager::registerBackend(QRotationSensor::type, QByteArray::number(sensor), this);
+ QSensorManager::registerBackend(QRotationSensor::sensorType, QByteArray::number(sensor), this);
break;
case ASENSOR_TYPE_RELATIVE_HUMIDITY:
@@ -128,7 +92,7 @@ public:
}
}
if (accelerometer && magnetometer)
- QSensorManager::registerBackend(QCompass::type, AndroidCompassId, this);
+ QSensorManager::registerBackend(QCompass::sensorType, AndroidCompassId, this);
}
QSensorBackend *createBackend(QSensor *sensor) override
diff --git a/src/plugins/sensors/android/qt_attribution.json b/src/plugins/sensors/android/qt_attribution.json
new file mode 100644
index 00000000..9599e5bf
--- /dev/null
+++ b/src/plugins/sensors/android/qt_attribution.json
@@ -0,0 +1,12 @@
+{
+ "Id": "android-compass",
+ "Name": "Android getRotationMatrix and getOrientation",
+ "QDocModule": "qtsensors",
+ "Description": "Code to calculate the rotation matrix and orientation of a compass, adopted from Android sources.",
+ "QtUsage": "Used on Android, in the Android Sensor plugin.",
+ "Files": "androidcompass.cpp",
+
+ "License": "Apache License 2.0",
+ "LicenseId": "Apache-2.0",
+ "Copyright": "Copyright (C) 2008 The Android Open Source Project"
+}
diff --git a/src/plugins/sensors/android/sensoreventqueue.h b/src/plugins/sensors/android/sensoreventqueue.h
index 77bf05c6..b18401e9 100644
--- a/src/plugins/sensors/android/sensoreventqueue.h
+++ b/src/plugins/sensors/android/sensoreventqueue.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSOREVENTQUEUE_H
#define SENSOREVENTQUEUE_H
@@ -125,8 +89,9 @@ public:
void start() override
{
ASensorEventQueue_enableSensor(m_sensorEventQueue, m_sensor);
+ // The QSensor datarate is in Hz (frequency), whereas the setEventRate expects microseconds
if (sensor()->dataRate() > 0)
- ASensorEventQueue_setEventRate(m_sensorEventQueue, m_sensor, std::max(ASensor_getMinDelay(m_sensor), sensor()->dataRate()));
+ ASensorEventQueue_setEventRate(m_sensorEventQueue, m_sensor, std::max(ASensor_getMinDelay(m_sensor), 1000000/sensor()->dataRate()));
m_started = true;
}
void stop() override
diff --git a/src/plugins/sensors/android/sensormanager.cpp b/src/plugins/sensors/android/sensormanager.cpp
index 542e54c9..755b6109 100644
--- a/src/plugins/sensors/android/sensormanager.cpp
+++ b/src/plugins/sensors/android/sensormanager.cpp
@@ -1,48 +1,23 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensormanager.h"
+#include <QtCore/qcoreapplication.h>
+#include <QtCore/qjnitypes.h>
+
#include <dlfcn.h>
+Q_DECLARE_JNI_CLASS(AndroidContext, "android/content/Context")
+Q_DECLARE_JNI_CLASS(Sensor, "android/hardware/Sensor")
+
SensorManager::SensorManager()
{
- auto sensorService = QJNIObjectPrivate::getStaticObjectField("android.content.Context", "SENSOR_SERVICE", "Ljava/lang/String;");
- m_sensorManager = QJNIObjectPrivate{QtAndroidPrivate::context()}.callObjectMethod("getSystemService", "(Ljava/lang/String;)Ljava/lang/Object;", sensorService.object());
+ auto sensorService =
+ QJniObject::getStaticField<QtJniTypes::AndroidContext, jstring>("SENSOR_SERVICE");
+
+ QJniObject context = QNativeInterface::QAndroidApplication::context();
+ m_sensorManager = context.callMethod<jobject>("getSystemService",
+ sensorService.object<jstring>());
setObjectName("QtSensorsLooperThread");
start();
m_waitForStart.acquire();
@@ -50,13 +25,14 @@ SensorManager::SensorManager()
SensorManager::~SensorManager()
{
- m_quit.store(1);
+ m_quit.storeRelaxed(1);
wait();
}
-QJNIObjectPrivate SensorManager::javaSensor(const ASensor *sensor) const
+QJniObject SensorManager::javaSensor(const ASensor *sensor) const
{
- return m_sensorManager.callObjectMethod("getDefaultSensor", "(I)Landroid/hardware/Sensor;", ASensor_getType(sensor));
+ return m_sensorManager.callMethod<QtJniTypes::Sensor>("getDefaultSensor",
+ ASensor_getType(sensor));
}
QSharedPointer<SensorManager> &SensorManager::instance()
@@ -72,19 +48,18 @@ ALooper *SensorManager::looper() const
static inline ASensorManager* androidManager()
{
+ QJniObject context = QNativeInterface::QAndroidApplication::context();
+ auto packageName = context.callMethod<jstring>("getPackageName").toString().toUtf8();
+
#if __ANDROID_API__ >= 26
- return ASensorManager_getInstanceForPackage(QJNIObjectPrivate{QtAndroidPrivate::context()}
- .callObjectMethod("getPackageName", "()Ljava/lang/String;")
- .toString().toUtf8().constData());
+ return ASensorManager_getInstanceForPackage(packageName.constData());
#else
- if (QtAndroidPrivate::androidSdkVersion() >= 26) {
+ if (QNativeInterface::QAndroidApplication::sdkVersion() >= 26) {
using GetInstanceForPackage = ASensorManager *(*)(const char *);
auto handler = dlopen("libandroid.so", RTLD_NOW);
auto function = GetInstanceForPackage(dlsym(handler, "ASensorManager_getInstanceForPackage"));
if (function) {
- auto res = function(QJNIObjectPrivate{QtAndroidPrivate::context()}
- .callObjectMethod("getPackageName", "()Ljava/lang/String;")
- .toString().toUtf8().constData());
+ auto res = function(packageName.constData());
dlclose(handler);
return res;
}
@@ -101,7 +76,8 @@ ASensorManager *SensorManager::manager() const
QString SensorManager::description(const ASensor *sensor) const
{
- return QString::fromUtf8(ASensor_getName(sensor)) + " " + ASensor_getVendor(sensor) + " v" + QString::number(javaSensor(sensor).callMethod<jint>("getVersion"));
+ return QString::fromUtf8(ASensor_getName(sensor)) + " " + ASensor_getVendor(sensor)
+ + " v" + QString::number(javaSensor(sensor).callMethod<jint>("getVersion"));
}
double SensorManager::getMaximumRange(const ASensor *sensor) const
@@ -116,5 +92,5 @@ void SensorManager::run()
do {
if (ALooper_pollAll(5 /*ms*/, nullptr, nullptr, nullptr) == ALOOPER_POLL_TIMEOUT)
QThread::yieldCurrentThread();
- } while (!m_quit.load());
+ } while (!m_quit.loadRelaxed());
}
diff --git a/src/plugins/sensors/android/sensormanager.h b/src/plugins/sensors/android/sensormanager.h
index dc7ffe1f..1d3c274b 100644
--- a/src/plugins/sensors/android/sensormanager.h
+++ b/src/plugins/sensors/android/sensormanager.h
@@ -1,52 +1,15 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORMANAGER_H
#define SENSORMANAGER_H
-#include <QThread>
-#include <QSemaphore>
-#include <QMutex>
-#include <QWaitCondition>
-
-#include <private/qjni_p.h>
-#include <private/qjnihelpers_p.h>
+#include <QtCore/qthread.h>
+#include <QtCore/qsemaphore.h>
+#include <QtCore/qmutex.h>
+#include <QtCore/qwaitcondition.h>
+#include <QtCore/qjniobject.h>
#include <android/sensor.h>
@@ -58,7 +21,7 @@ public:
ALooper *looper() const;
ASensorManager *manager() const;
- QJNIObjectPrivate javaSensor(const ASensor *sensor) const;
+ QJniObject javaSensor(const ASensor *sensor) const;
QString description(const ASensor *sensor) const;
double getMaximumRange(const ASensor *sensor) const;
@@ -71,7 +34,7 @@ private:
QAtomicInt m_quit{0};
ALooper *m_looper = nullptr;
QSemaphore m_waitForStart;
- QJNIObjectPrivate m_sensorManager;
+ QJniObject m_sensorManager;
};
#endif // SENSORMANAGER_H
diff --git a/src/plugins/sensors/dummy/CMakeLists.txt b/src/plugins/sensors/dummy/CMakeLists.txt
new file mode 100644
index 00000000..19f93329
--- /dev/null
+++ b/src/plugins/sensors/dummy/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## dummySensorPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(dummySensorPlugin
+ OUTPUT_NAME qtsensors_dummy
+ PLUGIN_TYPE sensors
+ SOURCES
+ dummyaccelerometer.cpp dummyaccelerometer.h
+ dummycommon.cpp dummycommon.h
+ dummylightsensor.cpp dummylightsensor.h
+ main.cpp
+ LIBRARIES
+ Qt::Core
+ Qt::Sensors
+)
+
+#### Keys ignored in scope 1:.:.:dummy.pro:<TRUE>:
+# OTHER_FILES = "plugin.json"
+
+## Scopes:
+#####################################################################
+
+qt_internal_extend_target(dummySensorPlugin CONDITION UNIX AND NOT ANDROID AND NOT APPLE AND NOT OPENBSD AND NOT QNX
+ 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/dummy/dummyaccelerometer.cpp b/src/plugins/sensors/dummy/dummyaccelerometer.cpp
index f0246915..c46683ef 100644
--- a/src/plugins/sensors/dummy/dummyaccelerometer.cpp
+++ b/src/plugins/sensors/dummy/dummyaccelerometer.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "dummyaccelerometer.h"
#include <QDebug>
diff --git a/src/plugins/sensors/dummy/dummyaccelerometer.h b/src/plugins/sensors/dummy/dummyaccelerometer.h
index 6c890f64..3d1a99cc 100644
--- a/src/plugins/sensors/dummy/dummyaccelerometer.h
+++ b/src/plugins/sensors/dummy/dummyaccelerometer.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef DUMMYACCELEROMETER_H
#define DUMMYACCELEROMETER_H
diff --git a/src/plugins/sensors/dummy/dummycommon.cpp b/src/plugins/sensors/dummy/dummycommon.cpp
index 4a19b13f..f5b63146 100644
--- a/src/plugins/sensors/dummy/dummycommon.cpp
+++ b/src/plugins/sensors/dummy/dummycommon.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "dummycommon.h"
@@ -54,7 +18,7 @@ void dummycommon::start()
int dataRate = sensor()->dataRate();
if (dataRate == 0) {
- if (sensor()->availableDataRates().count())
+ if (sensor()->availableDataRates().size())
// Use the first available rate when -1 is chosen
dataRate = sensor()->availableDataRates().first().first;
else
diff --git a/src/plugins/sensors/dummy/dummycommon.h b/src/plugins/sensors/dummy/dummycommon.h
index 5e775b64..8f5f9703 100644
--- a/src/plugins/sensors/dummy/dummycommon.h
+++ b/src/plugins/sensors/dummy/dummycommon.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef DUMMYCOMMON_H
#define DUMMYCOMMON_H
diff --git a/src/plugins/sensors/dummy/dummylightsensor.cpp b/src/plugins/sensors/dummy/dummylightsensor.cpp
index 8f2a9b8e..efdf360b 100644
--- a/src/plugins/sensors/dummy/dummylightsensor.cpp
+++ b/src/plugins/sensors/dummy/dummylightsensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "dummylightsensor.h"
#include <QDebug>
diff --git a/src/plugins/sensors/dummy/dummylightsensor.h b/src/plugins/sensors/dummy/dummylightsensor.h
index 3bcaf413..5a4e84ec 100644
--- a/src/plugins/sensors/dummy/dummylightsensor.h
+++ b/src/plugins/sensors/dummy/dummylightsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef DUMMYLIGHTSENSOR_H
#define DUMMYLIGHTSENSOR_H
diff --git a/src/plugins/sensors/dummy/main.cpp b/src/plugins/sensors/dummy/main.cpp
index 13dd732e..79755753 100644
--- a/src/plugins/sensors/dummy/main.cpp
+++ b/src/plugins/sensors/dummy/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "dummyaccelerometer.h"
#include "dummylightsensor.h"
@@ -53,8 +17,8 @@ class dummySensorPlugin : public QObject, public QSensorPluginInterface, public
public:
void registerSensors() override
{
- QSensorManager::registerBackend(QAccelerometer::type, dummyaccelerometer::id, this);
- QSensorManager::registerBackend(QAmbientLightSensor::type, dummylightsensor::id, this);
+ QSensorManager::registerBackend(QAccelerometer::sensorType, dummyaccelerometer::id, this);
+ QSensorManager::registerBackend(QAmbientLightSensor::sensorType, dummylightsensor::id, this);
}
QSensorBackend *createBackend(QSensor *sensor) override
diff --git a/src/plugins/sensors/generic/CMakeLists.txt b/src/plugins/sensors/generic/CMakeLists.txt
new file mode 100644
index 00000000..449401ab
--- /dev/null
+++ b/src/plugins/sensors/generic/CMakeLists.txt
@@ -0,0 +1,36 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## genericSensorPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(genericSensorPlugin
+ OUTPUT_NAME qtsensors_generic
+ PLUGIN_TYPE sensors
+ SOURCES
+ genericalssensor.cpp genericalssensor.h
+ genericorientationsensor.cpp genericorientationsensor.h
+ generictiltsensor.cpp generictiltsensor.h
+ main.cpp
+ DEFINES
+ QTSENSORS_GENERICALSSENSOR
+ QTSENSORS_GENERICORIENTATIONSENSOR
+ QTSENSORS_GENERICTILTSENSOR
+ LIBRARIES
+ Qt::Core
+ Qt::Sensors
+)
+
+#### Keys ignored in scope 1:.:.:generic.pro:<TRUE>:
+# 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/generic/genericalssensor.cpp b/src/plugins/sensors/generic/genericalssensor.cpp
index cd20e7e8..af4441ef 100644
--- a/src/plugins/sensors/generic/genericalssensor.cpp
+++ b/src/plugins/sensors/generic/genericalssensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "genericalssensor.h"
#include <QDebug>
diff --git a/src/plugins/sensors/generic/genericalssensor.h b/src/plugins/sensors/generic/genericalssensor.h
index 3d10b9a1..544f27bb 100644
--- a/src/plugins/sensors/generic/genericalssensor.h
+++ b/src/plugins/sensors/generic/genericalssensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef GENERICALSSENSOR_H
#define GENERICALSSENSOR_H
diff --git a/src/plugins/sensors/generic/genericorientationsensor.cpp b/src/plugins/sensors/generic/genericorientationsensor.cpp
index 1bcaaa60..6f880cd8 100644
--- a/src/plugins/sensors/generic/genericorientationsensor.cpp
+++ b/src/plugins/sensors/generic/genericorientationsensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "genericorientationsensor.h"
#include <QDebug>
diff --git a/src/plugins/sensors/generic/genericorientationsensor.h b/src/plugins/sensors/generic/genericorientationsensor.h
index 01265a02..c2f322a7 100644
--- a/src/plugins/sensors/generic/genericorientationsensor.h
+++ b/src/plugins/sensors/generic/genericorientationsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef GENERICORIENTATIONSENSOR_H
#define GENERICORIENTATIONSENSOR_H
diff --git a/src/plugins/sensors/generic/genericrotationsensor.cpp b/src/plugins/sensors/generic/genericrotationsensor.cpp
index 40768297..2da1fbca 100644
--- a/src/plugins/sensors/generic/genericrotationsensor.cpp
+++ b/src/plugins/sensors/generic/genericrotationsensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "genericrotationsensor.h"
#include <QDebug>
diff --git a/src/plugins/sensors/generic/genericrotationsensor.h b/src/plugins/sensors/generic/genericrotationsensor.h
index 98b8f974..cc642298 100644
--- a/src/plugins/sensors/generic/genericrotationsensor.h
+++ b/src/plugins/sensors/generic/genericrotationsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef GENERICROTATIONSENSOR_H
#define GENERICROTATIONSENSOR_H
diff --git a/src/plugins/sensors/generic/generictiltsensor.cpp b/src/plugins/sensors/generic/generictiltsensor.cpp
index bb418893..1d17d0d2 100644
--- a/src/plugins/sensors/generic/generictiltsensor.cpp
+++ b/src/plugins/sensors/generic/generictiltsensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "generictiltsensor.h"
#include <QDebug>
@@ -161,5 +125,5 @@ bool GenericTiltSensor::filter(QAccelerometerReading *reading)
bool GenericTiltSensor::isFeatureSupported(QSensor::Feature feature) const
{
- return (feature == QSensor::SkipDuplicates);
+ return (feature == QSensor::Feature::SkipDuplicates);
}
diff --git a/src/plugins/sensors/generic/generictiltsensor.h b/src/plugins/sensors/generic/generictiltsensor.h
index 71db69d3..3f7f438d 100644
--- a/src/plugins/sensors/generic/generictiltsensor.h
+++ b/src/plugins/sensors/generic/generictiltsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef GENERICTILTSENSOR_H
#define GENERICTILTSENSOR_H
diff --git a/src/plugins/sensors/generic/main.cpp b/src/plugins/sensors/generic/main.cpp
index 44bfff09..02154b2f 100644
--- a/src/plugins/sensors/generic/main.cpp
+++ b/src/plugins/sensors/generic/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifdef QTSENSORS_GENERICORIENTATIONSENSOR
#include "genericorientationsensor.h"
@@ -68,44 +32,44 @@ public:
void sensorsChanged() override
{
- if (!QSensor::defaultSensorForType(QAccelerometer::type).isEmpty()) {
+ if (!QSensor::defaultSensorForType(QAccelerometer::sensorType).isEmpty()) {
// There is an accelerometer available. Register the backends
#ifdef QTSENSORS_GENERICORIENTATIONSENSOR
- if (!QSensorManager::isBackendRegistered(QOrientationSensor::type, genericorientationsensor::id))
- QSensorManager::registerBackend(QOrientationSensor::type, genericorientationsensor::id, this);
+ if (!QSensorManager::isBackendRegistered(QOrientationSensor::sensorType, genericorientationsensor::id))
+ QSensorManager::registerBackend(QOrientationSensor::sensorType, genericorientationsensor::id, this);
#endif
#ifdef QTSENSORS_GENERICROTATIONSENSOR
- if (!QSensorManager::isBackendRegistered(QRotationSensor::type, genericrotationsensor::id))
- QSensorManager::registerBackend(QRotationSensor::type, genericrotationsensor::id, this);
+ if (!QSensorManager::isBackendRegistered(QRotationSensor::sensorType, genericrotationsensor::id))
+ QSensorManager::registerBackend(QRotationSensor::sensorType, genericrotationsensor::id, this);
#endif
#ifdef QTSENSORS_GENERICTILTSENSOR
- if (!QSensorManager::isBackendRegistered(QTiltSensor::type, GenericTiltSensor::id))
- QSensorManager::registerBackend(QTiltSensor::type, GenericTiltSensor::id, this);
+ if (!QSensorManager::isBackendRegistered(QTiltSensor::sensorType, GenericTiltSensor::id))
+ QSensorManager::registerBackend(QTiltSensor::sensorType, GenericTiltSensor::id, this);
#endif
} else {
#ifdef QTSENSORS_GENERICORIENTATIONSENSOR
- if (QSensorManager::isBackendRegistered(QOrientationSensor::type, genericorientationsensor::id))
- QSensorManager::unregisterBackend(QOrientationSensor::type, genericorientationsensor::id);
+ if (QSensorManager::isBackendRegistered(QOrientationSensor::sensorType, genericorientationsensor::id))
+ QSensorManager::unregisterBackend(QOrientationSensor::sensorType, genericorientationsensor::id);
#endif
#ifdef QTSENSORS_GENERICROTATIONSENSOR
- if (QSensorManager::isBackendRegistered(QRotationSensor::type, genericrotationsensor::id))
- QSensorManager::unregisterBackend(QRotationSensor::type, genericrotationsensor::id);
+ if (QSensorManager::isBackendRegistered(QRotationSensor::sensorType, genericrotationsensor::id))
+ QSensorManager::unregisterBackend(QRotationSensor::sensorType, genericrotationsensor::id);
#endif
#ifdef QTSENSORS_GENERICTILTSENSOR
- if (QSensorManager::isBackendRegistered(QTiltSensor::type, GenericTiltSensor::id))
- QSensorManager::unregisterBackend(QTiltSensor::type, GenericTiltSensor::id);
+ if (QSensorManager::isBackendRegistered(QTiltSensor::sensorType, GenericTiltSensor::id))
+ QSensorManager::unregisterBackend(QTiltSensor::sensorType, GenericTiltSensor::id);
#endif
}
- if (!QSensor::defaultSensorForType(QLightSensor::type).isEmpty()) {
+ if (!QSensor::defaultSensorForType(QLightSensor::sensorType).isEmpty()) {
#ifdef QTSENSORS_GENERICALSSENSOR
- if (!QSensorManager::isBackendRegistered(QAmbientLightSensor::type, genericalssensor::id))
- QSensorManager::registerBackend(QAmbientLightSensor::type, genericalssensor::id, this);
+ if (!QSensorManager::isBackendRegistered(QAmbientLightSensor::sensorType, genericalssensor::id))
+ QSensorManager::registerBackend(QAmbientLightSensor::sensorType, genericalssensor::id, this);
#endif
} else {
#ifdef QTSENSORS_GENERICALSSENSOR
- if (QSensorManager::isBackendRegistered(QAmbientLightSensor::type, genericalssensor::id))
- QSensorManager::unregisterBackend(QAmbientLightSensor::type, genericalssensor::id);
+ if (QSensorManager::isBackendRegistered(QAmbientLightSensor::sensorType, genericalssensor::id))
+ QSensorManager::unregisterBackend(QAmbientLightSensor::sensorType, genericalssensor::id);
#endif
}
}
@@ -134,4 +98,3 @@ public:
};
#include "main.moc"
-
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..83093e11
--- /dev/null
+++ b/src/plugins/sensors/iio-sensor-proxy/CMakeLists.txt
@@ -0,0 +1,50 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## IIOSensorProxySensorPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(IIOSensorProxySensorPlugin
+ OUTPUT_NAME qtsensors_iio-sensor-proxy
+ PLUGIN_TYPE sensors
+ SOURCES
+ iiosensorproxycompass.cpp iiosensorproxycompass.h
+ iiosensorproxylightsensor.cpp iiosensorproxylightsensor.h
+ iiosensorproxyorientationsensor.cpp iiosensorproxyorientationsensor.h
+ iiosensorproxysensorbase.cpp iiosensorproxysensorbase.h
+ main.cpp
+ NO_UNITY_BUILD_SOURCES
+ # Duplicate symbol definition between, iiosensorproxycompass.cpp, and
+ # the followings
+ # TODO: dbusPath() can probably be implemented as a static data member
+ iiosensorproxylightsensor.cpp
+ iiosensorproxyorientationsensor.cpp
+ DBUS_INTERFACE_SOURCES
+ org.freedesktop.DBus.Properties.xml
+ net.hadess.SensorProxy.xml
+ net.hadess.SensorProxy.Compass.xml
+ DBUS_INTERFACE_FLAGS
+ "-N"
+ LIBRARIES
+ Qt::Core
+ Qt::DBus
+ Qt::Sensors
+)
+
+#### Keys ignored in scope 1:.:.:iio-sensor-proxy.pro:<TRUE>:
+# 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
+ 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/iio-sensor-proxy/iiosensorproxycompass.cpp b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxycompass.cpp
index fd0b0f1f..f25fe574 100644
--- a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxycompass.cpp
+++ b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxycompass.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "iiosensorproxycompass.h"
#include "compass_interface.h"
diff --git a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxycompass.h b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxycompass.h
index 30d79e37..2be0408b 100644
--- a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxycompass.h
+++ b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxycompass.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef IIOSENSORPROXY_COMPASS_H
#define IIOSENSORPROXY_COMPASS_H
diff --git a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxylightsensor.cpp b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxylightsensor.cpp
index acd48147..b54126e4 100644
--- a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxylightsensor.cpp
+++ b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxylightsensor.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "iiosensorproxylightsensor.h"
#include "sensorproxy_interface.h"
diff --git a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxylightsensor.h b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxylightsensor.h
index 14c07d66..bf833815 100644
--- a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxylightsensor.h
+++ b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxylightsensor.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef IIOSENSORPROXY_LIGHTSENSOR_H
#define IIOSENSORPROXY_LIGHTSENSOR_H
diff --git a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxyorientationsensor.cpp b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxyorientationsensor.cpp
index 86ebb358..f589870a 100644
--- a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxyorientationsensor.cpp
+++ b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxyorientationsensor.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "iiosensorproxyorientationsensor.h"
#include "sensorproxy_interface.h"
diff --git a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxyorientationsensor.h b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxyorientationsensor.h
index 959113f1..0d81d312 100644
--- a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxyorientationsensor.h
+++ b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxyorientationsensor.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef IIOSENSORPROXY_ORIENTATIONSENSOR_H
#define IIOSENSORPROXY_ORIENTATIONSENSOR_H
diff --git a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxysensorbase.cpp b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxysensorbase.cpp
index 0a9f318c..9d7842f8 100644
--- a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxysensorbase.cpp
+++ b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxysensorbase.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "iiosensorproxysensorbase.h"
#include "sensorproxy_interface.h"
diff --git a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxysensorbase.h b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxysensorbase.h
index 96e036ad..12baedcd 100644
--- a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxysensorbase.h
+++ b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxysensorbase.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef IIOSENSORPROXY_SENSORBASE_H
#define IIOSENSORPROXY_SENSORBASE_H
diff --git a/src/plugins/sensors/iio-sensor-proxy/main.cpp b/src/plugins/sensors/iio-sensor-proxy/main.cpp
index 580e2c46..06b726a3 100644
--- a/src/plugins/sensors/iio-sensor-proxy/main.cpp
+++ b/src/plugins/sensors/iio-sensor-proxy/main.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "iiosensorproxyorientationsensor.h"
#include "iiosensorproxylightsensor.h"
@@ -61,12 +25,12 @@ public:
void registerSensors() override
{
if (QDBusConnection::systemBus().interface()->isServiceRegistered("net.hadess.SensorProxy")) {
- if (!QSensorManager::isBackendRegistered(QOrientationSensor::type, IIOSensorProxyOrientationSensor::id))
- QSensorManager::registerBackend(QOrientationSensor::type, IIOSensorProxyOrientationSensor::id, this);
- if (!QSensorManager::isBackendRegistered(QLightSensor::type, IIOSensorProxyLightSensor::id))
- QSensorManager::registerBackend(QLightSensor::type, IIOSensorProxyLightSensor::id, this);
- if (!QSensorManager::isBackendRegistered(QCompass::type, IIOSensorProxyCompass::id))
- QSensorManager::registerBackend(QCompass::type, IIOSensorProxyCompass::id, this);
+ if (!QSensorManager::isBackendRegistered(QOrientationSensor::sensorType, IIOSensorProxyOrientationSensor::id))
+ QSensorManager::registerBackend(QOrientationSensor::sensorType, IIOSensorProxyOrientationSensor::id, this);
+ if (!QSensorManager::isBackendRegistered(QLightSensor::sensorType, IIOSensorProxyLightSensor::id))
+ QSensorManager::registerBackend(QLightSensor::sensorType, IIOSensorProxyLightSensor::id, this);
+ if (!QSensorManager::isBackendRegistered(QCompass::sensorType, IIOSensorProxyCompass::id))
+ QSensorManager::registerBackend(QCompass::sensorType, IIOSensorProxyCompass::id, this);
}
}
diff --git a/src/plugins/sensors/iio-sensor-proxy/org.freedesktop.DBus.Properties.xml b/src/plugins/sensors/iio-sensor-proxy/org.freedesktop.DBus.Properties.xml
index 5dc94f5d..c7a43ca7 100644
--- a/src/plugins/sensors/iio-sensor-proxy/org.freedesktop.DBus.Properties.xml
+++ b/src/plugins/sensors/iio-sensor-proxy/org.freedesktop.DBus.Properties.xml
@@ -20,7 +20,7 @@
<signal name="PropertiesChanged">
<arg name="interface" type="s"/>
<arg name="changed_properties" type="a{sv}"/>
- <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="QVariantMap"/>
<arg name="invalidated_properties" type="as"/>
</signal>
</interface>
diff --git a/src/plugins/sensors/ios/CMakeLists.txt b/src/plugins/sensors/ios/CMakeLists.txt
new file mode 100644
index 00000000..44f61427
--- /dev/null
+++ b/src/plugins/sensors/ios/CMakeLists.txt
@@ -0,0 +1,59 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## IOSSensorPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(IOSSensorPlugin
+ OUTPUT_NAME qtsensors_ios
+ PLUGIN_TYPE sensors
+ SOURCES
+ main.mm
+ LIBRARIES
+ ${FWFoundation}
+ Qt::Core
+ Qt::Sensors
+)
+
+#### Keys ignored in scope 1:.:.:ios.pro:<TRUE>:
+# OTHER_FILES = "plugin.json"
+
+## Scopes:
+#####################################################################
+
+set_target_properties(IOSSensorPlugin
+ PROPERTIES
+ DISABLE_PRECOMPILE_HEADERS ON
+)
+
+qt_internal_extend_target(IOSSensorPlugin CONDITION IOS AND UIKIT
+ SOURCES
+ ioscompass.h ioscompass.mm
+ DEFINES
+ HAVE_COMPASS
+ 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
+ iospressure.h iospressure.mm
+ iosmotionmanager.h iosmotionmanager.mm
+ DEFINES
+ HAVE_COREMOTION
+ LIBRARIES
+ ${FWCoreMotion}
+)
+
+qt_internal_extend_target(IOSSensorPlugin CONDITION UIKIT AND NOT WATCHOS
+ SOURCES
+ iosproximitysensor.h iosproximitysensor.mm
+ DEFINES
+ HAVE_UIDEVICE
+ 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/ios/iosaccelerometer.h b/src/plugins/sensors/ios/iosaccelerometer.h
index 4ac73a97..fb8b93b5 100644
--- a/src/plugins/sensors/ios/iosaccelerometer.h
+++ b/src/plugins/sensors/ios/iosaccelerometer.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Lorn Potter
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Lorn Potter
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef IOSACCELEROMETER_H
#define IOSACCELEROMETER_H
diff --git a/src/plugins/sensors/ios/iosaccelerometer.mm b/src/plugins/sensors/ios/iosaccelerometer.mm
index d2d6e9fb..84fd06ad 100644
--- a/src/plugins/sensors/ios/iosaccelerometer.mm
+++ b/src/plugins/sensors/ios/iosaccelerometer.mm
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Lorn Potter
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Lorn Potter
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "iosaccelerometer.h"
#include "iosmotionmanager.h"
diff --git a/src/plugins/sensors/ios/ioscompass.h b/src/plugins/sensors/ios/ioscompass.h
index 2babc92a..3ebcb4ad 100644
--- a/src/plugins/sensors/ios/ioscompass.h
+++ b/src/plugins/sensors/ios/ioscompass.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef IOSCompass_H
#define IOSCompass_H
diff --git a/src/plugins/sensors/ios/ioscompass.mm b/src/plugins/sensors/ios/ioscompass.mm
index 7fc48d36..afcdef9f 100644
--- a/src/plugins/sensors/ios/ioscompass.mm
+++ b/src/plugins/sensors/ios/ioscompass.mm
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#import <CoreLocation/CLHeading.h>
#import <CoreLocation/CLLocationManagerDelegate.h>
diff --git a/src/plugins/sensors/ios/iosgyroscope.h b/src/plugins/sensors/ios/iosgyroscope.h
index 0d7fea49..f765a57d 100644
--- a/src/plugins/sensors/ios/iosgyroscope.h
+++ b/src/plugins/sensors/ios/iosgyroscope.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef IOSGYROSCOPE_H
#define IOSGYROSCOPE_H
diff --git a/src/plugins/sensors/ios/iosgyroscope.mm b/src/plugins/sensors/ios/iosgyroscope.mm
index 8155abac..5310e09b 100644
--- a/src/plugins/sensors/ios/iosgyroscope.mm
+++ b/src/plugins/sensors/ios/iosgyroscope.mm
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "iosmotionmanager.h"
#include "iosgyroscope.h"
diff --git a/src/plugins/sensors/ios/iosmagnetometer.h b/src/plugins/sensors/ios/iosmagnetometer.h
index 2c55eac3..7388c830 100644
--- a/src/plugins/sensors/ios/iosmagnetometer.h
+++ b/src/plugins/sensors/ios/iosmagnetometer.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef IOSMAGNETOMETER_H
#define IOSMAGNETOMETER_H
diff --git a/src/plugins/sensors/ios/iosmagnetometer.mm b/src/plugins/sensors/ios/iosmagnetometer.mm
index bfbe6e6d..9c60d544 100644
--- a/src/plugins/sensors/ios/iosmagnetometer.mm
+++ b/src/plugins/sensors/ios/iosmagnetometer.mm
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "iosmotionmanager.h"
#include "iosmagnetometer.h"
@@ -53,7 +17,7 @@ IOSMagnetometer::IOSMagnetometer(QSensor *sensor)
: QSensorBackend(sensor)
, m_motionManager([QIOSMotionManager sharedManager])
, m_timer(0)
- , m_returnGeoValues(false)
+ , m_returnGeoValues(true)
{
setReading<QMagnetometerReading>(&m_reading);
// Technical information about data rate is not found, but
@@ -75,7 +39,7 @@ void IOSMagnetometer::start()
if (m_returnGeoValues) {
if (++s_deviceMotionStartCount == 1)
- [m_motionManager startDeviceMotionUpdates];
+ [m_motionManager startDeviceMotionUpdatesUsingReferenceFrame:CMAttitudeReferenceFrameXMagneticNorthZVertical];
} else {
if (++s_magnetometerStartCount == 1)
[m_motionManager startMagnetometerUpdates];
diff --git a/src/plugins/sensors/ios/iosmotionmanager.h b/src/plugins/sensors/ios/iosmotionmanager.h
index 7c2a1b27..cfb1d99f 100644
--- a/src/plugins/sensors/ios/iosmotionmanager.h
+++ b/src/plugins/sensors/ios/iosmotionmanager.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Lorn Potter
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Lorn Potter
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef IOSMOTIONMANAGER_H
#define IOSMOTIONMANAGER_H
diff --git a/src/plugins/sensors/ios/iosmotionmanager.mm b/src/plugins/sensors/ios/iosmotionmanager.mm
index 90741089..3bf2c537 100644
--- a/src/plugins/sensors/ios/iosmotionmanager.mm
+++ b/src/plugins/sensors/ios/iosmotionmanager.mm
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Lorn Potter
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Lorn Potter
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "iosmotionmanager.h"
diff --git a/src/plugins/sensors/ios/iospressure.h b/src/plugins/sensors/ios/iospressure.h
new file mode 100644
index 00000000..f95b9bc4
--- /dev/null
+++ b/src/plugins/sensors/ios/iospressure.h
@@ -0,0 +1,37 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef IOSPRESSURE_H
+#define IOSPRESSURE_H
+
+#include <qsensorbackend.h>
+#include <qpressuresensor.h>
+
+@class CMAltimeter;
+
+QT_BEGIN_NAMESPACE
+
+class IOSPressure : public QSensorBackend
+{
+public:
+ static char const * const id;
+
+ explicit IOSPressure(QSensor *sensor);
+ ~IOSPressure();
+ void timerEvent(QTimerEvent *) override;
+
+ void start() override;
+ void stop() override;
+
+private:
+ Q_DISABLE_COPY_MOVE(IOSPressure)
+ CMAltimeter *m_altimeter = nullptr;
+ QPressureReading m_reading;
+ int m_timer = 0;
+
+ static int s_startCount;
+};
+QT_END_NAMESPACE
+
+#endif // IOSPRESSURE_H
+
diff --git a/src/plugins/sensors/ios/iospressure.mm b/src/plugins/sensors/ios/iospressure.mm
new file mode 100644
index 00000000..d3a9275e
--- /dev/null
+++ b/src/plugins/sensors/ios/iospressure.mm
@@ -0,0 +1,65 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "iospressure.h"
+#import <CoreMotion/CoreMotion.h>
+
+char const * const IOSPressure::id("ios.pressure");
+
+QT_BEGIN_NAMESPACE
+
+int IOSPressure::s_startCount = 0;
+
+IOSPressure::IOSPressure(QSensor *sensor)
+ : QSensorBackend(sensor)
+{
+ m_altimeter = [[CMAltimeter alloc] init];
+ setReading<QPressureReading>(&m_reading);
+ addDataRate(1, 100); // 100Hz
+}
+
+IOSPressure::~IOSPressure()
+{
+ [m_altimeter stopRelativeAltitudeUpdates];
+ [m_altimeter release];
+}
+
+void IOSPressure::start()
+{
+ if (m_timer != 0)
+ return;
+
+ int hz = sensor()->dataRate();
+ m_timer = startTimer(1000 / (hz == 0 ? 60 : hz));
+ if (++s_startCount == 1) {
+ [m_altimeter startRelativeAltitudeUpdatesToQueue:[NSOperationQueue mainQueue]
+ withHandler:^(CMAltitudeData * _Nullable altitudeData , NSError * _Nullable error) {
+ if (error == nil) {
+ m_reading.setPressure([altitudeData.pressure doubleValue] * 1000);
+ m_reading.setTimestamp(quint64(altitudeData.timestamp * 1e6));
+ }
+ }];
+ }
+}
+
+void IOSPressure::stop()
+{
+ if (m_timer == 0)
+ return;
+
+ killTimer(m_timer);
+ m_timer = 0;
+ if (--s_startCount == 0)
+ [m_altimeter stopRelativeAltitudeUpdates];
+}
+
+void IOSPressure::timerEvent(QTimerEvent *)
+{
+ // skip update if NaN or 0
+ if ((m_reading.pressure() != m_reading.pressure()) ||
+ m_reading.pressure() == 0)
+ return;
+ newReadingAvailable();
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/sensors/ios/iosproximitysensor.h b/src/plugins/sensors/ios/iosproximitysensor.h
index 0d69391f..09d22650 100644
--- a/src/plugins/sensors/ios/iosproximitysensor.h
+++ b/src/plugins/sensors/ios/iosproximitysensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef IOSPROXIMITYSENSOR_H
#define IOSPROXIMITYSENSOR_H
diff --git a/src/plugins/sensors/ios/iosproximitysensor.mm b/src/plugins/sensors/ios/iosproximitysensor.mm
index e596aa5b..903877bf 100644
--- a/src/plugins/sensors/ios/iosproximitysensor.mm
+++ b/src/plugins/sensors/ios/iosproximitysensor.mm
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#import <UIKit/UIDevice.h>
diff --git a/src/plugins/sensors/ios/main.mm b/src/plugins/sensors/ios/main.mm
index d6b98192..9e479de5 100644
--- a/src/plugins/sensors/ios/main.mm
+++ b/src/plugins/sensors/ios/main.mm
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qsensorplugin.h>
#include <qsensorbackend.h>
@@ -47,6 +11,7 @@
#include "iosmagnetometer.h"
#include "ioscompass.h"
#include "iosproximitysensor.h"
+#include "iospressure.h"
#import <CoreLocation/CoreLocation.h>
#ifdef HAVE_COREMOTION
@@ -62,19 +27,21 @@ public:
void registerSensors() override
{
#ifdef HAVE_COREMOTION
- QSensorManager::registerBackend(QAccelerometer::type, IOSAccelerometer::id, this);
+ QSensorManager::registerBackend(QAccelerometer::sensorType, IOSAccelerometer::id, this);
if ([QIOSMotionManager sharedManager].gyroAvailable)
- QSensorManager::registerBackend(QGyroscope::type, IOSGyroscope::id, this);
+ QSensorManager::registerBackend(QGyroscope::sensorType, IOSGyroscope::id, this);
if ([QIOSMotionManager sharedManager].magnetometerAvailable)
- QSensorManager::registerBackend(QMagnetometer::type, IOSMagnetometer::id, this);
+ QSensorManager::registerBackend(QMagnetometer::sensorType, IOSMagnetometer::id, this);
+ if ([CMAltimeter isRelativeAltitudeAvailable])
+ QSensorManager::registerBackend(QPressureSensor::sensorType, IOSPressure::id, this);
#endif
#ifdef HAVE_COMPASS
if ([CLLocationManager headingAvailable])
- QSensorManager::registerBackend(QCompass::type, IOSCompass::id, this);
+ QSensorManager::registerBackend(QCompass::sensorType, IOSCompass::id, this);
#endif
#ifdef HAVE_UIDEVICE
if (IOSProximitySensor::available())
- QSensorManager::registerBackend(QProximitySensor::type, IOSProximitySensor::id, this);
+ QSensorManager::registerBackend(QProximitySensor::sensorType, IOSProximitySensor::id, this);
#endif
}
@@ -87,6 +54,8 @@ public:
return new IOSGyroscope(sensor);
if (sensor->identifier() == IOSMagnetometer::id)
return new IOSMagnetometer(sensor);
+ if (sensor->identifier() == IOSPressure::id)
+ return new IOSPressure(sensor);
#endif
#ifdef HAVE_COMPASS
if (sensor->identifier() == IOSCompass::id)
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/linux/linuxsysaccelerometer.cpp b/src/plugins/sensors/linux/linuxsysaccelerometer.cpp
deleted file mode 100644
index c5c7e375..00000000
--- a/src/plugins/sensors/linux/linuxsysaccelerometer.cpp
+++ /dev/null
@@ -1,188 +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 "linuxsysaccelerometer.h"
-#include <QtCore/QDebug>
-#include <QtCore/QtGlobal>
-#include <QtCore/QFile>
-#include <QtCore/QDebug>
-#include <QtCore/QTimer>
-
-#include <QtCore/QStringList>
-
-#include <time.h>
-#include <errno.h>
-
-char const * const LinuxSysAccelerometer::id("linuxsys.accelerometer");
-
-// This plugin reads the accelerometer from a sys interface.
-
-// test machine (laptop):
-// QT_ACCEL_FILEPATH=/sys/devices/platform/lis3lv02d/position
-// QT_ACCEL_DATADIVISOR=7
-// QT_ACCEL_DELIMITER=,
-
-quint64 produceTimestamp()
-{
- struct timespec tv;
- int ok;
-
-#ifdef CLOCK_MONOTONIC_RAW
- ok = clock_gettime(CLOCK_MONOTONIC_RAW, &tv);
- if (ok != 0)
-#endif
- ok = clock_gettime(CLOCK_MONOTONIC, &tv);
- Q_ASSERT(ok == 0);
-
- quint64 result = (tv.tv_sec * 1000000ULL) + (tv.tv_nsec * 0.001); // scale to microseconds
- return result;
-}
-
-// TODO get output template from env and apply
-// Currently this assumes the output is like:
-// (x,y,z) or x,y,z
-
-LinuxSysAccelerometer::LinuxSysAccelerometer(QSensor *sensor)
- : QSensorBackend(sensor)
- , m_timerid(0)
- , path(QString())
- , divisor(0)
- , delimiter(QString())
-{
- setReading<QAccelerometerReading>(&m_reading);
- addDataRate(1, 100); // 100Hz
- addOutputRange(-22.418, 22.418, 0.17651); // 2G
-// not sure how to retrieve proper range
-
- path = QString::fromLatin1(qgetenv("QT_ACCEL_FILEPATH"));
- bool ok;
- divisor = QString::fromLatin1(qgetenv("QT_ACCEL_DATADIVISOR")).toInt(&ok);
- if (divisor == 0 || !ok) {
- divisor = 1;
- }
- delimiter = QString::fromLatin1(qgetenv("QT_ACCEL_DELIMITER"));
- file.setFileName(path);
-}
-
-LinuxSysAccelerometer::~LinuxSysAccelerometer()
-{
-}
-
-void LinuxSysAccelerometer::start()
-{
- if (m_timerid)
- return;
-
- if (!openFile())
- return;
-
- int dataRate = sensor()->dataRate();
- if (dataRate == 0) {
- if (sensor()->availableDataRates().count())
- dataRate = sensor()->availableDataRates().first().second;
- else
- dataRate = 1;
- }
-
- int interval = 1000 / dataRate;
-
- if (interval)
- m_timerid = startTimer(interval);
-}
-
-void LinuxSysAccelerometer::stop()
-{
- if (m_timerid) {
- killTimer(m_timerid);
- m_timerid = 0;
- }
- closeFile();
-}
-
-void LinuxSysAccelerometer::poll()
-{
- if (!file.isOpen())
- return;
-
- file.seek(0);
- QString str = file.readLine();
- if (str.isEmpty()) {
- return;
- }
- str = str.simplified();
-
- if (!str.at(0).isNumber() && str.at(0) != '-') {
- str.remove(0,1);
- }
-
- if (!str.at(str.size()-1).isNumber()) {
- str.chop(1);
- }
-
- QStringList accelDataList = str.split(delimiter);
-
- m_reading.setTimestamp(produceTimestamp());
- m_reading.setX(-accelDataList.at(0).toFloat() / divisor);
- m_reading.setY(-accelDataList.at(1).toFloat() / divisor);
- m_reading.setZ(-accelDataList.at(2).toFloat() / divisor);
-
- newReadingAvailable();
-}
-
-void LinuxSysAccelerometer::timerEvent(QTimerEvent * /*event*/)
-{
- poll();
-}
-
-bool LinuxSysAccelerometer::openFile()
-{
- if (!path.isEmpty()
- && !file.open(QIODevice::ReadOnly)) {
- qWarning() << "Could not open file" << strerror(errno);
- return false;
- }
- return true;
-}
-
-void LinuxSysAccelerometer::closeFile()
-{
- file.close();
-}
-
-
diff --git a/src/plugins/sensors/linux/linuxsysaccelerometer.h b/src/plugins/sensors/linux/linuxsysaccelerometer.h
deleted file mode 100644
index af89bf77..00000000
--- a/src/plugins/sensors/linux/linuxsysaccelerometer.h
+++ /dev/null
@@ -1,74 +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 LINUXSYSACCELEROMETER_H
-#define LINUXSYSACCELEROMETER_H
-
-#include <qsensorbackend.h>
-#include <qaccelerometer.h>
-#include <QtCore/QFile>
-
-
-class LinuxSysAccelerometer : public QSensorBackend
-{
-public:
- static char const * const id;
-
- LinuxSysAccelerometer(QSensor *sensor);
- ~LinuxSysAccelerometer();
-
- void start() override;
- void stop() override;
- void poll();
- void timerEvent(QTimerEvent * /*event*/) override;
-
-private:
- QAccelerometerReading m_reading;
- int m_timerid;
-
- bool openFile();
- void closeFile();
- QString path;
- QFile file;
- float divisor;
- QString delimiter;
-};
-
-#endif // LINUXSYSACCELEROMETER_H
-
diff --git a/src/plugins/sensors/linux/main.cpp b/src/plugins/sensors/linux/main.cpp
deleted file mode 100644
index a82ab821..00000000
--- a/src/plugins/sensors/linux/main.cpp
+++ /dev/null
@@ -1,72 +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 "linuxsysaccelerometer.h"
-
-#include <qsensorplugin.h>
-#include <qsensorbackend.h>
-#include <qsensormanager.h>
-
-#include <QtCore/QFile>
-#include <QtCore/QDebug>
-
-class LinuxSensorPlugin : public QObject, public QSensorPluginInterface, public QSensorBackendFactory
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "com.qt-project.Qt.QSensorPluginInterface/1.0" FILE "plugin.json")
- Q_INTERFACES(QSensorPluginInterface)
-public:
- void registerSensors() override
- {
- QString path = QString::fromLatin1(qgetenv("QT_ACCEL_FILEPATH"));
- if (!path.isEmpty() && !QSensorManager::isBackendRegistered(QAccelerometer::type, LinuxSysAccelerometer::id))
- QSensorManager::registerBackend(QAccelerometer::type, LinuxSysAccelerometer::id, this);
- }
-
- QSensorBackend *createBackend(QSensor *sensor) override
- {
- if (sensor->identifier() == LinuxSysAccelerometer::id)
- return new LinuxSysAccelerometer(sensor);
-
- return 0;
- }
-};
-
-#include "main.moc"
-
diff --git a/src/plugins/sensors/linux/plugin.json b/src/plugins/sensors/linux/plugin.json
deleted file mode 100644
index f3863f11..00000000
--- a/src/plugins/sensors/linux/plugin.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "Keys": [ "linux" ] }
diff --git a/src/plugins/sensors/sensorfw/CMakeLists.txt b/src/plugins/sensors/sensorfw/CMakeLists.txt
new file mode 100644
index 00000000..cc5e9dad
--- /dev/null
+++ b/src/plugins/sensors/sensorfw/CMakeLists.txt
@@ -0,0 +1,38 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## sensorfwSensorPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(sensorfwSensorPlugin
+ OUTPUT_NAME qtsensors_sensorfw
+ PLUGIN_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
+ LIBRARIES
+ Qt::Core
+ Qt::DBus
+ Qt::Network
+ Qt::SensorsPrivate
+ sensorfw
+)
+
+#### Keys ignored in scope 1:.:.:sensorfw.pro:<TRUE>:
+# CONFIGFILES.files = "Sensors.conf"
+# CONFIGFILES.path = "/etc/xdg/QtProject/"
+# INSTALLS = "CONFIGFILES"
+# OTHER_FILES = "plugin.json"
diff --git a/src/plugins/sensors/sensorfw/main.cpp b/src/plugins/sensors/sensorfw/main.cpp
index c1a02a57..9e8b6ac9 100644
--- a/src/plugins/sensors/sensorfw/main.cpp
+++ b/src/plugins/sensors/sensorfw/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfwaccelerometer.h"
#include "sensorfwals.h"
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/sensorfwaccelerometer.cpp b/src/plugins/sensors/sensorfw/sensorfwaccelerometer.cpp
index a1e9840a..38910b3a 100644
--- a/src/plugins/sensors/sensorfw/sensorfwaccelerometer.cpp
+++ b/src/plugins/sensors/sensorfw/sensorfwaccelerometer.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfwaccelerometer.h"
@@ -63,7 +27,7 @@ void sensorfwaccelerometer::slotDataAvailable(const XYZ& data)
newReadingAvailable();
}
-void sensorfwaccelerometer::slotFrameAvailable(const QVector<XYZ>& frame)
+void sensorfwaccelerometer::slotFrameAvailable(const QList<XYZ> &frame)
{
for (int i=0, l=frame.size(); i<l; i++) {
slotDataAvailable(frame.at(i));
@@ -75,7 +39,8 @@ bool sensorfwaccelerometer::doConnect()
Q_ASSERT(m_sensorInterface);
if (m_bufferSize==1)
return QObject::connect(m_sensorInterface, SIGNAL(dataAvailable(XYZ)), this, SLOT(slotDataAvailable(XYZ)));
- return QObject::connect(m_sensorInterface, SIGNAL(frameAvailable(QVector<XYZ>)),this, SLOT(slotFrameAvailable(QVector<XYZ>)));
+ return QObject::connect(m_sensorInterface, SIGNAL(frameAvailable(QList<XYZ>)), this,
+ SLOT(slotFrameAvailable(QList<XYZ>)));
}
diff --git a/src/plugins/sensors/sensorfw/sensorfwaccelerometer.h b/src/plugins/sensors/sensorfw/sensorfwaccelerometer.h
index 89d7bf78..d877a4bb 100644
--- a/src/plugins/sensors/sensorfw/sensorfwaccelerometer.h
+++ b/src/plugins/sensors/sensorfw/sensorfwaccelerometer.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORFWACCELEROMETER_H
#define SENSORFWACCELEROMETER_H
@@ -66,8 +30,8 @@ private:
bool m_initDone;
private slots:
- void slotDataAvailable(const XYZ& data);
- void slotFrameAvailable(const QVector<XYZ>&);
+ void slotDataAvailable(const XYZ &data);
+ void slotFrameAvailable(const QList<XYZ> &);
};
#endif
diff --git a/src/plugins/sensors/sensorfw/sensorfwals.cpp b/src/plugins/sensors/sensorfw/sensorfwals.cpp
index c43f7648..8701f482 100644
--- a/src/plugins/sensors/sensorfw/sensorfwals.cpp
+++ b/src/plugins/sensors/sensorfw/sensorfwals.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfwals.h"
diff --git a/src/plugins/sensors/sensorfw/sensorfwals.h b/src/plugins/sensors/sensorfw/sensorfwals.h
index 9a71550e..86af858b 100644
--- a/src/plugins/sensors/sensorfw/sensorfwals.h
+++ b/src/plugins/sensors/sensorfw/sensorfwals.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORFWALS_H
#define SENSORFWALS_H
diff --git a/src/plugins/sensors/sensorfw/sensorfwcompass.cpp b/src/plugins/sensors/sensorfw/sensorfwcompass.cpp
index 252404fa..05dc5672 100644
--- a/src/plugins/sensors/sensorfw/sensorfwcompass.cpp
+++ b/src/plugins/sensors/sensorfw/sensorfwcompass.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfwcompass.h"
diff --git a/src/plugins/sensors/sensorfw/sensorfwcompass.h b/src/plugins/sensors/sensorfw/sensorfwcompass.h
index 9afe9b41..2db3e924 100644
--- a/src/plugins/sensors/sensorfw/sensorfwcompass.h
+++ b/src/plugins/sensors/sensorfw/sensorfwcompass.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORFWCOMPASS_H
#define SENSORFWCOMPASS_H
diff --git a/src/plugins/sensors/sensorfw/sensorfwgyroscope.cpp b/src/plugins/sensors/sensorfw/sensorfwgyroscope.cpp
index cc9c169e..096b6be3 100644
--- a/src/plugins/sensors/sensorfw/sensorfwgyroscope.cpp
+++ b/src/plugins/sensors/sensorfw/sensorfwgyroscope.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfwgyroscope.h"
@@ -64,7 +28,7 @@ void SensorfwGyroscope::slotDataAvailable(const XYZ& data)
newReadingAvailable();
}
-void SensorfwGyroscope::slotFrameAvailable(const QVector<XYZ>& frame)
+void SensorfwGyroscope::slotFrameAvailable(const QList<XYZ> &frame)
{
for (int i=0, l=frame.size(); i<l; i++) {
slotDataAvailable(frame.at(i));
@@ -76,7 +40,8 @@ bool SensorfwGyroscope::doConnect()
Q_ASSERT(m_sensorInterface);
if (m_bufferSize==1)
return QObject::connect(m_sensorInterface, SIGNAL(dataAvailable(XYZ)), this, SLOT(slotDataAvailable(XYZ)));
- return QObject::connect(m_sensorInterface, SIGNAL(frameAvailable(QVector<XYZ>)),this, SLOT(slotFrameAvailable(QVector<XYZ>)));
+ return QObject::connect(m_sensorInterface, SIGNAL(frameAvailable(QList<XYZ>)), this,
+ SLOT(slotFrameAvailable(QList<XYZ>)));
}
QString SensorfwGyroscope::sensorName() const
diff --git a/src/plugins/sensors/sensorfw/sensorfwgyroscope.h b/src/plugins/sensors/sensorfw/sensorfwgyroscope.h
index d9346a94..97335379 100644
--- a/src/plugins/sensors/sensorfw/sensorfwgyroscope.h
+++ b/src/plugins/sensors/sensorfw/sensorfwgyroscope.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORFWGYROSCOPE_H
@@ -68,9 +32,8 @@ private:
bool m_initDone;
static const float MILLI;
private slots:
- void slotDataAvailable(const XYZ& data);
- void slotFrameAvailable(const QVector<XYZ>&);
-
+ void slotDataAvailable(const XYZ &data);
+ void slotFrameAvailable(const QList<XYZ> &);
};
diff --git a/src/plugins/sensors/sensorfw/sensorfwirproximitysensor.cpp b/src/plugins/sensors/sensorfw/sensorfwirproximitysensor.cpp
index 83714d82..05e4ce67 100644
--- a/src/plugins/sensors/sensorfw/sensorfwirproximitysensor.cpp
+++ b/src/plugins/sensors/sensorfw/sensorfwirproximitysensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfwirproximitysensor.h"
#define RM680_PS "/dev/bh1770glc_ps"
diff --git a/src/plugins/sensors/sensorfw/sensorfwirproximitysensor.h b/src/plugins/sensors/sensorfw/sensorfwirproximitysensor.h
index ece68a58..d82096a6 100644
--- a/src/plugins/sensors/sensorfw/sensorfwirproximitysensor.h
+++ b/src/plugins/sensors/sensorfw/sensorfwirproximitysensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORFWIRPROXIMITYSENSOR_H
#define SENSORFWIRPROXIMITYSENSOR_H
diff --git a/src/plugins/sensors/sensorfw/sensorfwlidsensor.cpp b/src/plugins/sensors/sensorfw/sensorfwlidsensor.cpp
index 18661b95..e922096a 100644
--- a/src/plugins/sensors/sensorfw/sensorfwlidsensor.cpp
+++ b/src/plugins/sensors/sensorfw/sensorfwlidsensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Canonical, 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Canonical, Ltd
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfwlidsensor.h"
diff --git a/src/plugins/sensors/sensorfw/sensorfwlidsensor.h b/src/plugins/sensors/sensorfw/sensorfwlidsensor.h
index 7ee967a9..50d222e9 100644
--- a/src/plugins/sensors/sensorfw/sensorfwlidsensor.h
+++ b/src/plugins/sensors/sensorfw/sensorfwlidsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Canonical, 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Canonical, Ltd
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORFWLIDSENSOR_H
diff --git a/src/plugins/sensors/sensorfw/sensorfwlightsensor.cpp b/src/plugins/sensors/sensorfw/sensorfwlightsensor.cpp
index 9fc5bef3..cf20cdbe 100644
--- a/src/plugins/sensors/sensorfw/sensorfwlightsensor.cpp
+++ b/src/plugins/sensors/sensorfw/sensorfwlightsensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfwlightsensor.h"
diff --git a/src/plugins/sensors/sensorfw/sensorfwlightsensor.h b/src/plugins/sensors/sensorfw/sensorfwlightsensor.h
index 9d8faa6c..c3e0fb87 100644
--- a/src/plugins/sensors/sensorfw/sensorfwlightsensor.h
+++ b/src/plugins/sensors/sensorfw/sensorfwlightsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORFWLIGHTSENSOR_H
diff --git a/src/plugins/sensors/sensorfw/sensorfwmagnetometer.cpp b/src/plugins/sensors/sensorfw/sensorfwmagnetometer.cpp
index 084e6eac..2946f11f 100644
--- a/src/plugins/sensors/sensorfw/sensorfwmagnetometer.cpp
+++ b/src/plugins/sensors/sensorfw/sensorfwmagnetometer.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfwmagnetometer.h"
@@ -76,8 +40,7 @@ void SensorfwMagnetometer::slotDataAvailable(const MagneticField& data)
newReadingAvailable();
}
-
-void SensorfwMagnetometer::slotFrameAvailable(const QVector<MagneticField>& frame)
+void SensorfwMagnetometer::slotFrameAvailable(const QList<MagneticField> &frame)
{
for (int i=0, l=frame.size(); i<l; i++) {
slotDataAvailable(frame.at(i));
@@ -90,8 +53,8 @@ bool SensorfwMagnetometer::doConnect()
if (m_bufferSize==1)
return QObject::connect(m_sensorInterface, SIGNAL(dataAvailable(MagneticField)),
this, SLOT(slotDataAvailable(MagneticField)));
- return QObject::connect(m_sensorInterface, SIGNAL(frameAvailable(QVector<MagneticField>)),
- this, SLOT(slotFrameAvailable(QVector<MagneticField>)));
+ return QObject::connect(m_sensorInterface, SIGNAL(frameAvailable(QList<MagneticField>)), this,
+ SLOT(slotFrameAvailable(QList<MagneticField>)));
}
QString SensorfwMagnetometer::sensorName() const
diff --git a/src/plugins/sensors/sensorfw/sensorfwmagnetometer.h b/src/plugins/sensors/sensorfw/sensorfwmagnetometer.h
index 03f29556..0ba66b62 100644
--- a/src/plugins/sensors/sensorfw/sensorfwmagnetometer.h
+++ b/src/plugins/sensors/sensorfw/sensorfwmagnetometer.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORFWMAGNETOMETER_H
#define SENSORFWMAGNETOMETER_H
@@ -69,9 +33,8 @@ private:
bool m_isGeoMagnetometer;
private slots:
- void slotDataAvailable(const MagneticField& data);
- void slotFrameAvailable(const QVector<MagneticField>&);
-
+ void slotDataAvailable(const MagneticField &data);
+ void slotFrameAvailable(const QList<MagneticField> &);
};
#endif
diff --git a/src/plugins/sensors/sensorfw/sensorfworientationsensor.cpp b/src/plugins/sensors/sensorfw/sensorfworientationsensor.cpp
index f659eb4c..f398b218 100644
--- a/src/plugins/sensors/sensorfw/sensorfworientationsensor.cpp
+++ b/src/plugins/sensors/sensorfw/sensorfworientationsensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfworientationsensor.h"
diff --git a/src/plugins/sensors/sensorfw/sensorfworientationsensor.h b/src/plugins/sensors/sensorfw/sensorfworientationsensor.h
index fac59fe8..8863b0cd 100644
--- a/src/plugins/sensors/sensorfw/sensorfworientationsensor.h
+++ b/src/plugins/sensors/sensorfw/sensorfworientationsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORFWORIENTATIONSENSOR_H
#define SENSORFWORIENTATIONSENSOR_H
diff --git a/src/plugins/sensors/sensorfw/sensorfwproximitysensor.cpp b/src/plugins/sensors/sensorfw/sensorfwproximitysensor.cpp
index 8eb28705..04eb698b 100644
--- a/src/plugins/sensors/sensorfw/sensorfwproximitysensor.cpp
+++ b/src/plugins/sensors/sensorfw/sensorfwproximitysensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfwproximitysensor.h"
diff --git a/src/plugins/sensors/sensorfw/sensorfwproximitysensor.h b/src/plugins/sensors/sensorfw/sensorfwproximitysensor.h
index 992db84a..daeabd4d 100644
--- a/src/plugins/sensors/sensorfw/sensorfwproximitysensor.h
+++ b/src/plugins/sensors/sensorfw/sensorfwproximitysensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORFWPROXIMITYSENSOR_H
#define SENSORFWPROXIMITYSENSOR_H
diff --git a/src/plugins/sensors/sensorfw/sensorfwrotationsensor.cpp b/src/plugins/sensors/sensorfw/sensorfwrotationsensor.cpp
index d884c538..8c99cfb0 100644
--- a/src/plugins/sensors/sensorfw/sensorfwrotationsensor.cpp
+++ b/src/plugins/sensors/sensorfw/sensorfwrotationsensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfwrotationsensor.h"
@@ -60,7 +24,7 @@ void SensorfwRotationSensor::slotDataAvailable(const XYZ& data)
newReadingAvailable();
}
-void SensorfwRotationSensor::slotFrameAvailable(const QVector<XYZ>& frame)
+void SensorfwRotationSensor::slotFrameAvailable(const QList<XYZ> &frame)
{
for (int i=0, l=frame.size(); i<l; i++) {
slotDataAvailable(frame.at(i));
@@ -72,7 +36,8 @@ bool SensorfwRotationSensor::doConnect()
Q_ASSERT(m_sensorInterface);
if (m_bufferSize==1)
return QObject::connect(m_sensorInterface, SIGNAL(dataAvailable(XYZ)), this, SLOT(slotDataAvailable(XYZ)));
- return QObject::connect(m_sensorInterface, SIGNAL(frameAvailable(QVector<XYZ>)),this, SLOT(slotFrameAvailable(QVector<XYZ>)));
+ return QObject::connect(m_sensorInterface, SIGNAL(frameAvailable(QList<XYZ>)), this,
+ SLOT(slotFrameAvailable(QList<XYZ>)));
}
QString SensorfwRotationSensor::sensorName() const
diff --git a/src/plugins/sensors/sensorfw/sensorfwrotationsensor.h b/src/plugins/sensors/sensorfw/sensorfwrotationsensor.h
index f9150f6d..de0fe24d 100644
--- a/src/plugins/sensors/sensorfw/sensorfwrotationsensor.h
+++ b/src/plugins/sensors/sensorfw/sensorfwrotationsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORFWROTATION_H
@@ -67,8 +31,7 @@ private:
private slots:
void slotDataAvailable(const XYZ& data);
- void slotFrameAvailable(const QVector<XYZ>&);
-
+ void slotFrameAvailable(const QList<XYZ> &);
};
#endif
diff --git a/src/plugins/sensors/sensorfw/sensorfwsensorbase.cpp b/src/plugins/sensors/sensorfw/sensorfwsensorbase.cpp
index 27a07ad6..9736857b 100644
--- a/src/plugins/sensors/sensorfw/sensorfwsensorbase.cpp
+++ b/src/plugins/sensors/sensorfw/sensorfwsensorbase.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfwsensorbase.h"
@@ -92,7 +56,7 @@ void SensorfwSensorBase::start()
if (m_sensorInterface) {
// dataRate
QByteArray type = sensor()->type();
- if (type != QTapSensor::type && type != QProximitySensor::type) {
+ if (type != QTapSensor::sensorType && type != QProximitySensor::sensorType) {
int dataRate = sensor()->dataRate();
int interval = dataRate > 0 ? 1000 / dataRate : 0;
// for testing maximum speed
@@ -291,8 +255,8 @@ bool SensorfwSensorBase::initSensorInterface(QString const &name)
// TODO deztructor: Leaking abstraction detected. Just copied code
// from initSensor<>() here, need to
QByteArray type = sensor()->type();
- if ((type == QAmbientLightSensor::type) // SensorFW returns lux values, plugin enumerated values
- || (type == QIRProximitySensor::type) // SensorFW returns raw reflectance values, plugin % of max reflectance
+ if ((type == QAmbientLightSensor::sensorType) // SensorFW returns lux values, plugin enumerated values
+ || (type == QIRProximitySensor::sensorType) // SensorFW returns raw reflectance values, plugin % of max reflectance
|| (name == "accelerometersensor") // SensorFW returns milliGs, plugin m/s^2
|| (name == "magnetometersensor") // SensorFW returns nanoTeslas, plugin Teslas
|| (name == "gyroscopesensor")) // SensorFW returns DSPs, plugin milliDSPs
@@ -330,4 +294,3 @@ bool SensorfwSensorBase::isFeatureSupported(QSensor::Feature feature) const
return false;
}
-
diff --git a/src/plugins/sensors/sensorfw/sensorfwsensorbase.h b/src/plugins/sensors/sensorfw/sensorfwsensorbase.h
index 7e7f5c33..db78017a 100644
--- a/src/plugins/sensors/sensorfw/sensorfwsensorbase.h
+++ b/src/plugins/sensors/sensorfw/sensorfwsensorbase.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORFWSENSORBASE_H
@@ -101,7 +65,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/sensorfw/sensorfwtapsensor.cpp b/src/plugins/sensors/sensorfw/sensorfwtapsensor.cpp
index 23498618..95dd794c 100644
--- a/src/plugins/sensors/sensorfw/sensorfwtapsensor.cpp
+++ b/src/plugins/sensors/sensorfw/sensorfwtapsensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfwtapsensor.h"
diff --git a/src/plugins/sensors/sensorfw/sensorfwtapsensor.h b/src/plugins/sensors/sensorfw/sensorfwtapsensor.h
index 7e9edb4c..a8e48a86 100644
--- a/src/plugins/sensors/sensorfw/sensorfwtapsensor.h
+++ b/src/plugins/sensors/sensorfw/sensorfwtapsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORFWTAPSENSOR_H
#define SENSORFWTAPSENSOR_H
diff --git a/src/plugins/sensors/sensors.pro b/src/plugins/sensors/sensors.pro
deleted file mode 100644
index 7fce2071..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
-}
-
-winrt {
- 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):winrt:SUBDIRS += winrt
diff --git a/src/plugins/sensors/sensortag/Sensors.conf b/src/plugins/sensors/sensortag/Sensors.conf
deleted file mode 100644
index b8d79752..00000000
--- a/src/plugins/sensors/sensortag/Sensors.conf
+++ /dev/null
@@ -1,13 +0,0 @@
-[Default]
-QAccelerometer=sensortag.accelerometer
-QAmbientLightSensor=sensortag.als
-QCompass=sensortag.compass
-QMagnetometer=sensortag.magnetometer
-QOrientationSensor=sensortag.orientationsensor
-QProximitySensor=sensortag.proximitysensor
-QRotationSensor=sensortag.rotationsensor
-QTapSensor=sensortag.tapsensor
-QLightSensor=sensortag.lightsensor
-QIRProximitySensor=sensortag.irproximitysensor
-QGyroscope=sensortag.gyroscope
-QLidSensor=sensortag.lidsensor
diff --git a/src/plugins/sensors/sensortag/main.cpp b/src/plugins/sensors/sensortag/main.cpp
deleted file mode 100644
index e6dc54e5..00000000
--- a/src/plugins/sensors/sensortag/main.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2016 Canonical, 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 "sensortagaccelerometer.h"
-#include "sensortagals.h"
-#include "sensortagbase.h"
-#include "sensortaggyroscope.h"
-#include "sensortaghumiditysensor.h"
-#include "sensortaglightsensor.h"
-#include "sensortagmagnetometer.h"
-#include "sensortagpressuresensor.h"
-#include "sensortagtemperaturesensor.h"
-
-#include <QtSensors/qsensorplugin.h>
-#include <QtSensors/qsensorbackend.h>
-#include <QtSensors/qsensormanager.h>
-#include <QSettings>
-
-class SensortagSensorPlugin : public QObject, public QSensorPluginInterface, public QSensorBackendFactory
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "com.qt-project.Qt.QSensorPluginInterface/1.0" FILE "plugin.json")
- Q_INTERFACES(QSensorPluginInterface)
-
-public:
-
- void registerSensors()
- {
- if (!QSensorManager::isBackendRegistered(QAccelerometer::type, SensorTagAccelerometer::id))
- QSensorManager::registerBackend(QAccelerometer::type, SensorTagAccelerometer::id, this);
-
- if (!QSensorManager::isBackendRegistered(QAmbientLightSensor::type, SensorTagAls::id))
- QSensorManager::registerBackend(QAmbientLightSensor::type, SensorTagAls::id, this);
-
- if (!QSensorManager::isBackendRegistered(QLightSensor::type, SensorTagLightSensor::id))
- QSensorManager::registerBackend(QLightSensor::type, SensorTagLightSensor::id, this);
-
- if (!QSensorManager::isBackendRegistered(QAmbientTemperatureSensor::type, SensorTagTemperatureSensor::id))
- QSensorManager::registerBackend(QAmbientTemperatureSensor::type, SensorTagTemperatureSensor::id, this);
-
- if (!QSensorManager::isBackendRegistered(QHumiditySensor::type, SensorTagHumiditySensor::id))
- QSensorManager::registerBackend(QHumiditySensor::type, SensorTagHumiditySensor::id, this);
-
- if (!QSensorManager::isBackendRegistered(QPressureSensor::type, SensorTagPressureSensor::id))
- QSensorManager::registerBackend(QPressureSensor::type, SensorTagPressureSensor::id, this);
-
- if (!QSensorManager::isBackendRegistered(QGyroscope::type, SensorTagGyroscope::id))
- QSensorManager::registerBackend(QGyroscope::type, SensorTagGyroscope::id, this);
-
- if (!QSensorManager::isBackendRegistered(QMagnetometer::type, SensorTagMagnetometer::id))
- QSensorManager::registerBackend(QMagnetometer::type, SensorTagMagnetometer::id, this);
- }
-
- QSensorBackend *createBackend(QSensor *sensor)
- {
- if (sensor->identifier() == SensorTagAccelerometer::id)
- return new SensorTagAccelerometer(sensor);
- if (sensor->identifier() == SensorTagAls::id)
- return new SensorTagAls(sensor);
- if (sensor->identifier() == SensorTagLightSensor::id)
- return new SensorTagLightSensor(sensor);
- if (sensor->identifier() == SensorTagTemperatureSensor::id)
- return new SensorTagTemperatureSensor(sensor);
- if (sensor->identifier() == SensorTagHumiditySensor::id)
- return new SensorTagHumiditySensor(sensor);
- if (sensor->identifier() == SensorTagPressureSensor::id)
- return new SensorTagPressureSensor(sensor);
- if (sensor->identifier() == SensorTagGyroscope::id)
- return new SensorTagGyroscope(sensor);
- if (sensor->identifier() == SensorTagMagnetometer::id)
- return new SensorTagMagnetometer(sensor);
- return nullptr;
- }
-};
-
-#include "main.moc"
diff --git a/src/plugins/sensors/sensortag/plugin.json b/src/plugins/sensors/sensortag/plugin.json
deleted file mode 100644
index 9a0f4d52..00000000
--- a/src/plugins/sensors/sensortag/plugin.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "Keys": [ "sensortag" ] }
diff --git a/src/plugins/sensors/sensortag/sensortag.pri b/src/plugins/sensors/sensortag/sensortag.pri
deleted file mode 100644
index d1d60cb1..00000000
--- a/src/plugins/sensors/sensortag/sensortag.pri
+++ /dev/null
@@ -1,22 +0,0 @@
-# Input
-HEADERS += sensortagaccelerometer.h \
- sensortagals.h \
- sensortagbase.h \
- sensortaggyroscope.h \
- sensortaghumiditysensor.h \
- sensortaglightsensor.h \
- sensortagmagnetometer.h \
- sensortagpressuresensor.h \
- sensortagtemperaturesensor.h
-
-SOURCES += main.cpp \
- sensortagaccelerometer.cpp \
- sensortagals.cpp \
- sensortagbase.cpp \
- sensortaggyroscope.cpp \
- sensortaghumiditysensor.cpp \
- sensortaglightsensor.cpp \
- sensortagmagnetometer.cpp \
- sensortagpressuresensor.cpp \
- sensortagtemperaturesensor.cpp
-
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/sensortag/sensortagaccelerometer.cpp b/src/plugins/sensors/sensortag/sensortagaccelerometer.cpp
deleted file mode 100644
index b5b582a9..00000000
--- a/src/plugins/sensors/sensortag/sensortagaccelerometer.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 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 "sensortagaccelerometer.h"
-#include <QtSensors/qsensorbackend.h>
-
-char const * const SensorTagAccelerometer::id("sensortag.accelerometer");
-
-SensorTagAccelerometer::SensorTagAccelerometer(QSensor *sensor)
- : SensorTagBase(sensor)
-{
- init();
- setDescription(QLatin1String("x, y, and z axes accelerations in m/s^2"));
- setReading<QAccelerometerReading>(&m_reading);
- sensor->setDataRate(50);//set a default rate
-}
-
-void SensorTagAccelerometer::slotDataAvailable(const QAccelerometerReading &data)
-{
- m_reading.setX(data.x());
- m_reading.setY(data.y());
- m_reading.setZ(data.z());
- m_reading.setTimestamp(produceTimestamp());
- newReadingAvailable();
-}
-
-void SensorTagAccelerometer::init()
-{
- m_initDone = false;
-}
-
-void SensorTagAccelerometer::start()
-{
- QObject::connect(this, &SensorTagBase::accelDataAvailable,
- this, &SensorTagAccelerometer::slotDataAvailable);
- d_ptr->enableService(TI_SENSORTAG_ACCELEROMETER_SERVICE);
-}
-
-void SensorTagAccelerometer::stop()
-{
- QObject::disconnect(this, &SensorTagBase::accelDataAvailable,
- this, &SensorTagAccelerometer::slotDataAvailable);
- d_ptr->disableService(TI_SENSORTAG_ACCELEROMETER_SERVICE);
-}
-
diff --git a/src/plugins/sensors/sensortag/sensortagaccelerometer.h b/src/plugins/sensors/sensortag/sensortagaccelerometer.h
deleted file mode 100644
index 39ad47f6..00000000
--- a/src/plugins/sensors/sensortag/sensortagaccelerometer.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 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 SENSORTAGACCELEROMETER_H
-#define SENSORTAGACCELEROMETER_H
-
-#include "sensortagbase.h"
-#include <QtSensors/qaccelerometer.h>
-
-class SensorTagAccelerometer : public SensorTagBase
-{
- Q_OBJECT
-
-public:
- static char const * const id;
- SensorTagAccelerometer(QSensor *sensor);
-protected:
- void start() override;
- void stop() override;
- virtual void init();
-
-private:
- QAccelerometerReading m_reading;
- bool m_initDone = false;
-
-private slots:
- void slotDataAvailable(const QAccelerometerReading &data);
-};
-
-#endif
-// SENSORTAGACCELEROMETER_H
diff --git a/src/plugins/sensors/sensortag/sensortagals.cpp b/src/plugins/sensors/sensortag/sensortagals.cpp
deleted file mode 100644
index 3fe2de4c..00000000
--- a/src/plugins/sensors/sensortag/sensortagals.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2016 Canonical, 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 "sensortagals.h"
-#include "sensortagbase.h"
-#include <QDebug>
-
-char const * const SensorTagAls::id("sensortag.als");
-
-SensorTagAls::SensorTagAls(QSensor *sensor)
- : SensorTagBase(sensor)
- , m_initDone(false)
-{
- init();
- setReading<QAmbientLightReading>(&m_reading);
- setDescription(QLatin1String("ambient light intensity given as 5 pre-defined levels"));
-}
-
-void SensorTagAls::start()
-{
- QObject::connect(this, &SensorTagBase::luxDataAvailable, this, &SensorTagAls::slotDataAvailable);
- d_ptr->enableService(TI_SENSORTAG_LIGHT_SERVICE);
-}
-
-void SensorTagAls::stop()
-{
- QObject::disconnect(this, &SensorTagBase::luxDataAvailable, this, &SensorTagAls::slotDataAvailable);
- d_ptr->disableService(TI_SENSORTAG_LIGHT_SERVICE);
-}
-
-void SensorTagAls::slotDataAvailable(qreal data)
-{
- QAmbientLightReading::LightLevel level = getLightLevel(data);
- if (level != m_reading.lightLevel()) {
- m_reading.setLightLevel(level);
- m_reading.setTimestamp(produceTimestamp());
- newReadingAvailable();
- }
-}
-
-QAmbientLightReading::LightLevel SensorTagAls::getLightLevel(int lux)
-{
- if (lux < 0)
- return QAmbientLightReading::Undefined;
- if (lux < 10)
- return QAmbientLightReading::Dark;
- if (lux < 80)
- return QAmbientLightReading::Twilight;
- if (lux < 400)
- return QAmbientLightReading::Light;
- if (lux < 2500)
- return QAmbientLightReading::Bright;
- return QAmbientLightReading::Sunny;
-}
-
-void SensorTagAls::init()
-{
- m_initDone = false;
-}
diff --git a/src/plugins/sensors/sensortag/sensortagals.h b/src/plugins/sensors/sensortag/sensortagals.h
deleted file mode 100644
index 3ef1b928..00000000
--- a/src/plugins/sensors/sensortag/sensortagals.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 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 SENSORTAGALS_H
-#define SENSORTAGALS_H
-
-#include "sensortagbase.h"
-#include <QtSensors/qambientlightsensor.h>
-
-class SensorTagAls : public SensorTagBase
-{
- Q_OBJECT
-
-public:
- static char const * const id;
- SensorTagAls(QSensor *sensor);
-protected:
- void start() override;
- void stop() override;
- virtual void init();
-
-private:
- QAmbientLightReading m_reading;
- bool m_initDone = false;
-private slots:
- void slotDataAvailable(qreal data);
- static QAmbientLightReading::LightLevel getLightLevel(int lux);
-};
-
-#endif
-//SENSORTAGALS_H
diff --git a/src/plugins/sensors/sensortag/sensortagbase.cpp b/src/plugins/sensors/sensortag/sensortagbase.cpp
deleted file mode 100644
index 322a86d7..00000000
--- a/src/plugins/sensors/sensortag/sensortagbase.cpp
+++ /dev/null
@@ -1,600 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2016 Canonical, 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 "sensortagbase.h"
-
-#include <QLowEnergyCharacteristic>
-#include <QtMath>
-#include <QTimer>
-#include <QDeadlineTimer>
-
-Q_GLOBAL_STATIC(SensorTagBasePrivate, sensortagBasePrivate)
-
-SensorTagBasePrivate::SensorTagBasePrivate(QObject *parent)
- : QObject(parent)
-{
- QTimer::singleShot(50, this, &SensorTagBasePrivate::deviceSearch);
-}
-
-void SensorTagBasePrivate::deviceSearch()
-{
- m_deviceDiscoveryAgent = new QBluetoothDeviceDiscoveryAgent(this);
-
- connect(m_deviceDiscoveryAgent, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered,
- this, &SensorTagBasePrivate::deviceFound);
- connect(m_deviceDiscoveryAgent, QOverload<QBluetoothDeviceDiscoveryAgent::Error>::of(&QBluetoothDeviceDiscoveryAgent::error),
- this, &SensorTagBasePrivate::deviceScanError);
- connect(m_deviceDiscoveryAgent, &QBluetoothDeviceDiscoveryAgent::finished,
- this, &SensorTagBasePrivate::scanFinished);
-
- QTimer::singleShot(20000, this, &SensorTagBasePrivate::deviceSearchTimeout); //make sure to timeout
- m_deviceDiscoveryAgent->start(QBluetoothDeviceDiscoveryAgent::LowEnergyMethod);
-}
-
-void SensorTagBasePrivate::deviceSearchTimeout()
-{
- if (m_deviceDiscoveryAgent->isActive() && m_control == nullptr) {
- m_deviceDiscoveryAgent->stop();
- qWarning("No Sensor Tag devices found");
- }
-}
-
-void SensorTagBasePrivate::deviceFound(const QBluetoothDeviceInfo &device)
-{
- if (device.coreConfigurations() & QBluetoothDeviceInfo::LowEnergyCoreConfiguration) {
- const QString idString = QString::fromLatin1(qgetenv("QT_SENSORTAG_ID"));
-
- const QBluetoothAddress watchForAddress(idString);
- //mac uses deviceUuid
- const QUuid watchForId(idString);
-
- bool ok;
-
- if ((!watchForAddress.isNull() && watchForAddress == device.address()) ||
- (!watchForId.isNull() && watchForId == device.deviceUuid())) {
- ok = true;
- }
- if (ok || device.name().contains("SensorTag")) {
-
- m_deviceDiscoveryAgent->stop();
-
- m_control = new QLowEnergyController(device.address(), this);
-
- connect(m_control, &QLowEnergyController::discoveryFinished,
- this, &SensorTagBasePrivate::serviceDiscoveryFinished);
- connect(m_control, &QLowEnergyController::serviceDiscovered,
- this, &SensorTagBasePrivate::serviceDiscovered);
- connect(m_control, QOverload<QLowEnergyController::Error>::of(&QLowEnergyController::error),
- this, &SensorTagBasePrivate::controllerError);
- connect(m_control, &QLowEnergyController::connected,
- this, &SensorTagBasePrivate::sensortagDeviceConnected);
- connect(m_control, &QLowEnergyController::disconnected,
- this, &SensorTagBasePrivate::deviceDisconnected);
-
- m_control->connectToDevice();
- }
- }
-}
-
-void SensorTagBasePrivate::serviceDiscoveryFinished()
-{
- discoveryDone = true;
-}
-
-void SensorTagBasePrivate::scanFinished()
-{
- if (m_control == nullptr)
- qWarning("No Sensor Tag devices found");
-}
-
-void SensorTagBasePrivate::deviceScanError(QBluetoothDeviceDiscoveryAgent::Error error)
-{
- switch (error) {
- case QBluetoothDeviceDiscoveryAgent::PoweredOffError:
- qWarning("The Bluetooth adaptor is powered off, power it on before doing discovery.");
- break;
- case QBluetoothDeviceDiscoveryAgent::InputOutputError:
- qWarning("Writing or reading from the device resulted in an error.");
- break;
- default:
- qWarning("An unknown error has occurred.");
- break;
- };
-}
-
-void SensorTagBasePrivate::serviceError(QLowEnergyService::ServiceError e)
-{
- switch (e) {
- case QLowEnergyService::DescriptorWriteError:
- qWarning("Cannot obtain SensorTag notifications");
- break;
- default:
- case QLowEnergyService::CharacteristicWriteError:
- qWarning() << "SensorTag service error:" << e;
- break;
- };
-}
-
-void SensorTagBasePrivate::controllerError(QLowEnergyController::Error error)
-{
- qWarning("Cannot connect to remote device.");
- qWarning() << "Controller Error:" << error;
-}
-
-void SensorTagBasePrivate::sensortagDeviceConnected()
-{
- m_control->discoverServices();
-}
-
-void SensorTagBasePrivate::deviceDisconnected()
-{
- if (q_ptr && q_ptr->sensor()->isActive())
- q_ptr->sensorStopped();
-}
-
-void SensorTagBasePrivate::serviceDiscovered(const QBluetoothUuid &gatt)
-{
- if (enabledServiceUuids.contains(gatt)) {
-
- if (gatt == TI_SENSORTAG_LIGHT_SERVICE) {
- lightService = m_control->createServiceObject(gatt, this);
- doConnections(lightService);
- } else if (gatt == TI_SENSORTAG_TEMPERATURE_SERVICE) {
- temperatureService = m_control->createServiceObject(gatt, this);
- doConnections(temperatureService);
- } else if (gatt == TI_SENSORTAG_BAROMETER_SERVICE) {
- barometerService = m_control->createServiceObject(gatt, this);
- doConnections(barometerService);
- } else if (gatt == TI_SENSORTAG_HUMIDTIY_SERVICE) {
- humidityService = m_control->createServiceObject(gatt, this);
- doConnections(humidityService);
- } else if (gatt == TI_SENSORTAG_INFO_SERVICE) {
- infoService = m_control->createServiceObject(gatt, this);
- doConnections(infoService);
- } else if (gatt == TI_SENSORTAG_ACCELEROMETER_SERVICE) {
- acceleratorService = m_control->createServiceObject(gatt, this);
- doConnections(acceleratorService);
- } else if (gatt == TI_SENSORTAG_GYROSCOPE_SERVICE) {
- gyroscopeService = m_control->createServiceObject(gatt, this);
- doConnections(gyroscopeService);
- } else if (gatt == TI_SENSORTAG_MAGNETOMETER_SERVICE) {
- magnetometerService = m_control->createServiceObject(gatt, this);
- doConnections(magnetometerService);
- } else if (movementService == nullptr) {
- if (gatt == TI_SENSORTAG_MOVEMENT_SERVICE) {
- movementService = m_control->createServiceObject(gatt, this);
- doConnections(movementService);
- }
- }
- }
-}
-
-void SensorTagBasePrivate::doConnections(QLowEnergyService *service)
-{
- if (service) {
- connect(service, &QLowEnergyService::stateChanged,
- this, &SensorTagBasePrivate::serviceStateChanged);
-
- connect(service, &QLowEnergyService::characteristicChanged,
- this, &SensorTagBasePrivate::updateCharacteristic);
-
- connect(service,SIGNAL(error(QLowEnergyService::ServiceError)),
- this,SLOT(serviceError(QLowEnergyService::ServiceError)));
-
- if (service->state() == QLowEnergyService::DiscoveryRequired) {
- service->discoverDetails();
- } else if (!enabledServiceUuids.isEmpty()
- && enabledServiceUuids.contains(service->serviceUuid())) {
- enableService(service->serviceUuid());
- }
- }
-}
-
-void SensorTagBasePrivate::serviceStateChanged(QLowEnergyService::ServiceState newState)
-{
- if (newState != QLowEnergyService::ServiceDiscovered)
- return;
-
- QLowEnergyService *m_service = qobject_cast<QLowEnergyService *>(sender());
-
- if (!m_service)
- return;
-
- if (!enabledServiceUuids.isEmpty()
- && enabledServiceUuids.contains(m_service->serviceUuid())) {
- enableService(m_service->serviceUuid());
- }
-}
-
-void SensorTagBasePrivate::enableLight(bool on)
-{
- if (!lightService && discoveryDone)
- serviceDiscovered(TI_SENSORTAG_LIGHT_SERVICE);
- if (!lightService)
- return;
-
- const QLowEnergyCharacteristic hrChar = lightService->characteristic(TI_SENSORTAG_LIGHT_CONTROL);
- lightService->writeCharacteristic(hrChar, on ? enableSensorCharacteristic : disableSensorCharacteristic);
-
- const QLowEnergyCharacteristic hrChar2 = lightService->characteristic(TI_SENSORTAG_LIGHT_DATA);
-
- if (hrChar2.descriptors().count() > 0) {
- const QLowEnergyDescriptor m_notificationDesc = hrChar2.descriptors().at(0);
- lightService->writeDescriptor(m_notificationDesc,
- on ? enableNotificationsCharacteristic : disableNotificationsCharacteristic);
- }
-}
-
-void SensorTagBasePrivate::enableTemp(bool on)
-{
- if (!temperatureService && discoveryDone)
- serviceDiscovered(TI_SENSORTAG_TEMPERATURE_SERVICE);
-
- if (!temperatureService)
- return;
-
- const QLowEnergyCharacteristic hrChar = temperatureService->characteristic(TI_SENSORTAG_IR_TEMPERATURE_CONTROL);
- temperatureService->writeCharacteristic(hrChar,on ? enableSensorCharacteristic : disableSensorCharacteristic);
-
- const QLowEnergyCharacteristic hrChar2 = temperatureService->characteristic(TI_SENSORTAG_IR_TEMPERATURE_DATA);
-
- if (hrChar2.descriptors().count() > 0) {
- const QLowEnergyDescriptor m_notificationDesc = hrChar2.descriptors().at(0);
- temperatureService->writeDescriptor(m_notificationDesc,
- on ? enableNotificationsCharacteristic : disableNotificationsCharacteristic);
- }
-}
-
-void SensorTagBasePrivate::enablePressure(bool on)
-{
- if (!barometerService && discoveryDone)
- serviceDiscovered(TI_SENSORTAG_BAROMETER_SERVICE);
- if (!barometerService)
- return;
-
- const QLowEnergyCharacteristic hrChar = barometerService->characteristic(TI_SENSORTAG_BAROMETER_CONTROL);
- barometerService->writeCharacteristic(hrChar, on ? enableSensorCharacteristic : disableSensorCharacteristic);
-
- const QLowEnergyCharacteristic hrChar2 = barometerService->characteristic(TI_SENSORTAG_BAROMETER_DATA);
- if (hrChar2.descriptors().count() > 0) {
- const QLowEnergyDescriptor m_notificationDesc = hrChar2.descriptors().at(0);
-
- barometerService->writeDescriptor(m_notificationDesc,
- on ? enableNotificationsCharacteristic : disableNotificationsCharacteristic);
- }
-}
-
-void SensorTagBasePrivate::enableHumidity(bool on)
-{
- if (!humidityService && discoveryDone)
- serviceDiscovered(TI_SENSORTAG_HUMIDTIY_SERVICE);
- if (!humidityService)
- return;
-
- const QLowEnergyCharacteristic hrChar = humidityService->characteristic(TI_SENSORTAG_HUMIDTIY_CONTROL);
- humidityService->writeCharacteristic(hrChar, on ? enableSensorCharacteristic : disableSensorCharacteristic);
- const QLowEnergyCharacteristic hrChar2 = humidityService->characteristic(TI_SENSORTAG_HUMIDTIY_DATA);
- if (hrChar2.descriptors().count() > 0) {
- const QLowEnergyDescriptor m_notificationDesc = hrChar2.descriptors().at(0);
- humidityService->writeDescriptor(m_notificationDesc,
- on ? enableNotificationsCharacteristic : disableNotificationsCharacteristic);
- }
-}
-
-void SensorTagBasePrivate::enableMovement(bool on)
-{
- if (!movementService && discoveryDone)
- serviceDiscovered(TI_SENSORTAG_MOVEMENT_SERVICE);
- if (!movementService)
- return;
-
- QByteArray controlCharacteristic;
-
- int movementControl = 0;
- //movement service has different syntax here
- if (on) {
- if (gyroscopeEnabled)
- movementControl += 7;
- if (accelerometerEnabled)
- movementControl += 56;
- if (magnetometerEnabled)
- movementControl += 64;
-
- controlCharacteristic = QByteArray::number(movementControl, 16);
- controlCharacteristic.append("04");
-
- } else {
- controlCharacteristic = "00";
- }
-
- const QLowEnergyCharacteristic hrChar = movementService->characteristic(TI_SENSORTAG_MOVEMENT_CONTROL);
- movementService->writeCharacteristic(hrChar, QByteArray::fromHex(controlCharacteristic));
-
- const QLowEnergyCharacteristic hrChar2 = movementService->characteristic(TI_SENSORTAG_MOVEMENT_DATA);
- if (hrChar2.descriptors().count() > 0) {
- QLowEnergyDescriptor m_notificationDesc = hrChar2.descriptors().at(0);
-
- movementService->writeDescriptor(m_notificationDesc,
- on ? enableNotificationsCharacteristic : disableNotificationsCharacteristic);
- }
-}
-
-void SensorTagBasePrivate::enableService(const QBluetoothUuid &uuid)
-{
- if (uuid == TI_SENSORTAG_ACCELEROMETER_SERVICE
- || uuid == TI_SENSORTAG_MAGNETOMETER_SERVICE
- || uuid == TI_SENSORTAG_GYROSCOPE_SERVICE) {
-
- if ((uuid != TI_SENSORTAG_MOVEMENT_SERVICE)
- && (accelerometerEnabled || magnetometerEnabled || gyroscopeEnabled))
- return;
-
- if (!enabledServiceUuids.contains(TI_SENSORTAG_MOVEMENT_SERVICE))
- enabledServiceUuids.append(TI_SENSORTAG_MOVEMENT_SERVICE);
-
- if (uuid == TI_SENSORTAG_ACCELEROMETER_SERVICE)
- accelerometerEnabled = true;
- else if (uuid == TI_SENSORTAG_MAGNETOMETER_SERVICE)
- magnetometerEnabled = true;
- else if (uuid == TI_SENSORTAG_GYROSCOPE_SERVICE)
- gyroscopeEnabled = true;
-
- } else if (!enabledServiceUuids.contains(uuid))
- enabledServiceUuids.append(uuid);
-
- if (discoveryDone) {
-
- if (uuid == TI_SENSORTAG_LIGHT_SERVICE)
- enableLight(true);
- else if (uuid == TI_SENSORTAG_TEMPERATURE_SERVICE)
- enableTemp(true);
- else if (uuid == TI_SENSORTAG_BAROMETER_SERVICE)
- enablePressure(true);
- else if (uuid == TI_SENSORTAG_HUMIDTIY_SERVICE)
- enableHumidity(true);
- else if (uuid == TI_SENSORTAG_MOVEMENT_SERVICE)
- enableMovement(true);
- else if (uuid == TI_SENSORTAG_ACCELEROMETER_SERVICE)
- enableMovement(true);
- else if (uuid == TI_SENSORTAG_MAGNETOMETER_SERVICE)
- enableMovement(true);
- else if (uuid == TI_SENSORTAG_GYROSCOPE_SERVICE)
- enableMovement(true);
- }
-}
-
-void SensorTagBasePrivate::disableService(const QBluetoothUuid &uuid)
-{
- enabledServiceUuids.removeOne(uuid);
-
- if (uuid == TI_SENSORTAG_LIGHT_SERVICE) {
- enableLight(false);
- } else if (uuid == TI_SENSORTAG_TEMPERATURE_SERVICE) {
- enableTemp(false);
- } else if (uuid == TI_SENSORTAG_BAROMETER_SERVICE) {
- enablePressure(false);
- } else if (uuid == TI_SENSORTAG_HUMIDTIY_SERVICE) {
- enableHumidity(false);
- } else if (uuid == TI_SENSORTAG_MOVEMENT_SERVICE) {
- enableMovement(false);
- } else if (uuid == TI_SENSORTAG_ACCELEROMETER_SERVICE) {
- enableMovement(false);
- accelerometerEnabled = false;
- } else if (uuid == TI_SENSORTAG_MAGNETOMETER_SERVICE) {
- enableMovement(false);
- magnetometerEnabled = false;
- } else if (uuid == TI_SENSORTAG_GYROSCOPE_SERVICE) {
- enableMovement(false);
- gyroscopeEnabled = false;
- }
-}
-
-void SensorTagBasePrivate::updateCharacteristic(const QLowEnergyCharacteristic &c,
- const QByteArray &value)
-{
- if (c.uuid() == TI_SENSORTAG_LIGHT_DATA) {
- convertLux(value);
- } else if (c.uuid()== TI_SENSORTAG_IR_TEMPERATURE_DATA) {
- convertTemperature(value);
- } else if (c.uuid() == TI_SENSORTAG_BAROMETER_DATA) {
- convertBarometer(value);
- } else if (c.uuid()== TI_SENSORTAG_HUMIDTIY_DATA) {
- convertHumidity(value);
- } else if (c.uuid()== TI_SENSORTAG_BAROMETER_DATA) {
- convertBarometer(value);
- } else if ((c.uuid() == TI_SENSORTAG_ACCELEROMETER_DATA
- || c.uuid() == TI_SENSORTAG_MOVEMENT_DATA) && accelerometerEnabled) {
- convertAccelerometer(value);
- } else if ((c.uuid() == TI_SENSORTAG_MAGNETOMETER_DATA
- || c.uuid()== TI_SENSORTAG_MOVEMENT_DATA) && magnetometerEnabled) {
- convertMagnetometer(value);
- } else if ((c.uuid() == TI_SENSORTAG_GYROSCOPE_DATA
- || c.uuid() == TI_SENSORTAG_MOVEMENT_DATA) && gyroscopeEnabled) {
- convertGyroscope(value);
- }
-}
-
-void SensorTagBasePrivate::convertLux(const QByteArray &bytes)
-{
- if (bytes.size() < 1)
- return;
-
- quint16 dat = ((quint16)bytes[1] & 0xFF) << 8;
- dat |= (quint16)(bytes[0] & 0xFF);
-
- qreal lux = dat * .01;
-
- emit luxDataAvailable(lux);
-}
-
-void SensorTagBasePrivate::convertTemperature(const QByteArray &bytes)
-{
- if (bytes.size() < 3)
- return;
-
- qint16 objTemp = ((bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00));
- objTemp >>= 2;
- qreal objectTemperature = objTemp * 0.03125;
- // change to this if you want to use the ambient/die temp sensor
- // qreal ambientTemperature = ambTemp / 128.0;
-
- emit tempDataAvailable(objectTemperature);
-}
-
-void SensorTagBasePrivate::convertHumidity(const QByteArray &bytes)
-{
- if (bytes.size() < 3)
- return;
- quint16 rawH = (bytes[2] & 0xff) | ((bytes[3] << 8) & 0xff00);
- qreal rHumidity = (qreal)(rawH / 65535) * 100.0;
-
- emit humidityDataAvailable(rHumidity);
-}
-
-void SensorTagBasePrivate::convertBarometer(const QByteArray &bytes)
-{
- if (bytes.size() < 5)
- return;
- quint32 pressure = (bytes[3] & 0xff) | ((bytes[4] << 8) & 0xff00) | ((bytes[5] << 16) & 0xff0000);
-
- qreal mbars = (qreal)pressure / 100.0;
- emit pressureDataAvailable(mbars);
-}
-
-void SensorTagBasePrivate::convertAccelerometer(const QByteArray &bytes)
-{
- if (bytes.size() < 3)
- return;
-
- int range = 8;
-
- qint16 X = (qint16)((bytes[8]) + ((bytes[9] << 8)));
- qint16 Y = (qint16)((bytes[6]) + ((bytes[7] << 8)));
- qint16 Z = (qint16)((bytes[10]) + ((bytes[11] << 8)));
-
- accelReading.setX((qreal)(X * 1.0) / (32768 / range) * 9.80665);
- accelReading.setY(-(qreal)(Y * 1.0) / (32768 / range) * 9.80665);
- accelReading.setZ((qreal)(Z * 1.0) / (32768 / range) * 9.80665);
- // TODO needs calibration
-
- emit accelDataAvailable(accelReading);
-}
-
-void SensorTagBasePrivate::convertMagnetometer(const QByteArray &bytes)
-{
- if (bytes.size() < 3)
- return;
-
- qreal scale = 6.67100977199; // 32768 / 4912;
- qint16 X = (qint16)((bytes[12]) + ((bytes[13] << 8)));
- qint16 Y = (qint16)((bytes[14]) + ((bytes[15] << 8)));
- qint16 Z = (qint16)((bytes[16]) + ((bytes[17] << 8)));
- // TODO needs calibration
-
- magReading.setX((qreal)(X / scale));
- magReading.setY((qreal)(Y / scale));
- magReading.setZ((qreal)(Z / scale));
-
- emit magDataAvailable(magReading);
-}
-
-void SensorTagBasePrivate::convertGyroscope(const QByteArray &bytes)
-{
- if (bytes.size() < 3)
- return;
-
- qreal scale = 128.0;
- qint16 X = (qint16)((bytes[2]) + ((bytes[3] << 8)));
- qint16 Y = (qint16)((bytes[0]) + ((bytes[1] << 8)));
- qint16 Z = (qint16)((bytes[4]) + ((bytes[5] << 8)));
-
- gyroReading.setX((qreal)(X / scale));
- gyroReading.setY((qreal)(Y / scale));
- gyroReading.setZ((qreal)(Z / scale));
-
- emit gyroDataAvailable(gyroReading);
-}
-
-SensorTagBasePrivate * SensorTagBasePrivate::instance()
-{
- SensorTagBasePrivate *priv = sensortagBasePrivate();
- return priv;
-}
-
-SensorTagBase::SensorTagBase(QSensor *sensor)
- : QSensorBackend(sensor),
- leService(nullptr),
- serviceId(nullptr),
- d_ptr(SensorTagBasePrivate::instance())
-{
- connect(d_ptr, &SensorTagBasePrivate::luxDataAvailable,
- this, &SensorTagBase::luxDataAvailable);
- connect(d_ptr, &SensorTagBasePrivate::tempDataAvailable,
- this, &SensorTagBase::tempDataAvailable);
- connect(d_ptr, &SensorTagBasePrivate::humidityDataAvailable,
- this, &SensorTagBase::humidityDataAvailable);
- connect(d_ptr, &SensorTagBasePrivate::pressureDataAvailable,
- this, &SensorTagBase::pressureDataAvailable);
- connect(d_ptr, &SensorTagBasePrivate::accelDataAvailable,
- this, &SensorTagBase::accelDataAvailable);
- connect(d_ptr, &SensorTagBasePrivate::gyroDataAvailable,
- this, &SensorTagBase::gyroDataAvailable);
- connect(d_ptr, &SensorTagBasePrivate::magDataAvailable,
- this, &SensorTagBase::magDataAvailable);
-}
-
-SensorTagBase::~SensorTagBase()
-{
-}
-
-void SensorTagBase::start()
-{
-}
-
-void SensorTagBase::stop()
-{
-}
-
-quint64 SensorTagBase::produceTimestamp()
-{
- return QDeadlineTimer::current().deadlineNSecs() / 1000;
-}
-
-
diff --git a/src/plugins/sensors/sensortag/sensortagbase.h b/src/plugins/sensors/sensortag/sensortagbase.h
deleted file mode 100644
index 5d61aacf..00000000
--- a/src/plugins/sensors/sensortag/sensortagbase.h
+++ /dev/null
@@ -1,252 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 Canonical, 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 SENSORTAGBASEPRIVATE_H
-#define SENSORTAGBASEPRIVATE_H
-
-#include <QObject>
-#include <QSensorBackend>
-
-#include <QBluetoothDeviceDiscoveryAgent>
-#include <QBluetoothDeviceInfo>
-#include <QLowEnergyController>
-#include <QLowEnergyService>
-
-#include <QAccelerometerReading>
-#include <QGyroscopeReading>
-#include <QMagnetometerReading>
-
-class SensorTagBase;
-
-class SensorTagBasePrivate : public QObject
-{
- Q_OBJECT
- Q_DECLARE_PUBLIC(SensorTagBase)
-public:
- explicit SensorTagBasePrivate(QObject *parent = 0);
-
- QLowEnergyService *lightService = nullptr;
- QLowEnergyService *temperatureService = nullptr;
- QLowEnergyService *barometerService = nullptr;
- QLowEnergyService *humidityService = nullptr;
- QLowEnergyService *movementService = nullptr;
- QLowEnergyService *acceleratorService = nullptr;
- QLowEnergyService *magnetometerService = nullptr;
- QLowEnergyService *gyroscopeService = nullptr;
-
- void enableService(const QBluetoothUuid &uuid);
- void disableService(const QBluetoothUuid &uuid);
-
- static SensorTagBasePrivate *instance();
-
-signals:
- void accelDataAvailable(const QAccelerometerReading &);
- void gyroDataAvailable(const QGyroscopeReading &);
- void magDataAvailable(const QMagnetometerReading &);
-
- void luxDataAvailable(qreal);
- void tempDataAvailable(qreal);
- void humidityDataAvailable(qreal);
- void pressureDataAvailable(qreal);
- void compassDataAvailable(qreal);
-
-public slots:
- void enableLight(bool);
- void enableTemp(bool);
- void enablePressure(bool);
- void enableHumidity(bool);
- void enableMovement(bool);
-
- void deviceFound(const QBluetoothDeviceInfo&);
- void scanFinished();
-
- void deviceScanError(QBluetoothDeviceDiscoveryAgent::Error);
- void serviceDiscovered(const QBluetoothUuid &);
-
- void controllerError(QLowEnergyController::Error);
-
- void sensortagDeviceConnected();
- void deviceDisconnected();
-
- void serviceStateChanged(QLowEnergyService::ServiceState s);
- void updateCharacteristic(const QLowEnergyCharacteristic &c,
- const QByteArray &value);
- void serviceError(QLowEnergyService::ServiceError e);
- void doConnections(QLowEnergyService *service);
-
-private slots:
- void deviceSearch();
- void serviceDiscoveryFinished();
- void deviceSearchTimeout();
-
-private:
-
- void convertLux(const QByteArray &value);
- void convertTemperature(const QByteArray &value);
- void convertBarometer(const QByteArray &value);
- void convertHumidity(const QByteArray &value);
- void convertAccelerometer(const QByteArray &value);
- void convertMagnetometer(const QByteArray &value);
- void convertGyroscope(const QByteArray &value);
-
- QBluetoothDeviceDiscoveryAgent *m_deviceDiscoveryAgent = nullptr;
- QLowEnergyDescriptor m_notificationDesc;
-
- QLowEnergyController *m_control = nullptr;
- QLowEnergyService *infoService = nullptr;
-
- QAccelerometerReading accelReading;
- QGyroscopeReading gyroReading;
- QMagnetometerReading magReading;
-
- bool discoveryDone = false;
- QList <QBluetoothUuid> enabledServiceUuids;
- SensorTagBase *q_ptr;
-
- bool accelerometerEnabled = false;
- bool gyroscopeEnabled = false;
- bool magnetometerEnabled = false;
-
- const QByteArray enableSensorCharacteristic = QByteArrayLiteral("\x01");
- const QByteArray disableSensorCharacteristic = QByteArrayLiteral("\x00");
-
- const QByteArray enableNotificationsCharacteristic = QByteArrayLiteral("\x01\x00");
- const QByteArray disableNotificationsCharacteristic = QByteArrayLiteral("\x00\x00");
-};
-
-const QBluetoothUuid TI_SENSORTAG_TEMPERATURE_SERVICE(QUuid("{f000aa00-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_IR_TEMPERATURE_DATA(QUuid("{f000aa01-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_IR_TEMPERATURE_CONTROL(QUuid("{f000aa02-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_IR_TEMPERATURE_PERIOD(QUuid("{f000aa03-0451-4000-b000-000000000000}"));
-
-const QBluetoothUuid TI_SENSORTAG_ACCELEROMETER_SERVICE(QUuid("{f000aa10-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_ACCELEROMETER_DATA(QUuid("{f000aa11-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_ACCELEROMETER_CONTROL(QUuid("{f000aa12-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_ACCELEROMETER_PERIOD(QUuid("{f000aa13-0451-4000-b000-000000000000}"));
-
-const QBluetoothUuid TI_SENSORTAG_HUMIDTIY_SERVICE(QUuid("{f000aa20-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_HUMIDTIY_DATA(QUuid("{f000aa21-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_HUMIDTIY_CONTROL(QUuid("{f000aa22-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_HUMIDTIY_PERIOD(QUuid("{f000aa23-0451-4000-b000-000000000000}"));
-
-const QBluetoothUuid TI_SENSORTAG_MAGNETOMETER_SERVICE(QUuid("{f000aa30-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_MAGNETOMETER_DATA(QUuid("{f000aa31-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_MAGNETOMETER_CONTROL(QUuid("{f000aa32-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_MAGNETOMETER_PERIOD(QUuid("{f000aa33-0451-4000-b000-000000000000}"));
-
-const QBluetoothUuid TI_SENSORTAG_BAROMETER_SERVICE(QUuid("{f000aa40-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_BAROMETER_DATA(QUuid("{f000aa41-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_BAROMETER_CONTROL(QUuid("{f000aa42-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_BAROMETER_CALIBRATION(QUuid("{f000aa43-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_BAROMETER_PERIOD(QUuid("{f000aa44-0451-4000-b000-000000000000}"));
-
-const QBluetoothUuid TI_SENSORTAG_GYROSCOPE_SERVICE(QUuid("{f000aa50-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_GYROSCOPE_DATA(QUuid("{f000aa51-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_GYROSCOPE_CONTROL(QUuid("{f000aa52-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_GYROSCOPE_PERIOD(QUuid("{f000aa53-0451-4000-b000-000000000000}"));
-
-// test service "{f000aa60-0451-4000-b000-000000000000}"
-
-const QBluetoothUuid TI_SENSORTAG_IO_SERVICE(QUuid("{f000aa64-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_IO_DATA(QUuid("{f000aa65-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_IO_CONTROL(QUuid("{f000aa66-0451-4000-b000-000000000000}"));
-
-const QBluetoothUuid TI_SENSORTAG_LIGHT_SERVICE(QUuid("{f000aa70-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_LIGHT_DATA(QUuid("{f000aa71-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_LIGHT_CONTROL(QUuid("{f000aa72-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_LIGHT_PERIOD(QUuid("{f000aa73-0451-4000-b000-000000000000}"));
-
-const QBluetoothUuid TI_SENSORTAG_MOVEMENT_SERVICE(QUuid("{f000aa80-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_MOVEMENT_DATA(QUuid("{f000aa81-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_MOVEMENT_CONTROL(QUuid("{f000aa82-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_MOVEMENT_PERIOD(QUuid("{f000aa83-0451-4000-b000-000000000000}"));
-
-// keypress "{f000ffe0-0000-1000-8000-00805f9b34fb"
-
-// Connection Control Service "{f000ccc0-0451-4000-b000-000000000000}"
-// OAD (over air download) Service "{f000ffc0-0451-4000-b000-000000000000}"
-
-const QBluetoothUuid TI_SENSORTAG_INFO_SERVICE(QUuid("{0000180a-0000-1000-8000-00805f9b34fb}"));
-//we might want to use these somehow
-//const QBluetoothUuid TI_SENSORTAG_BATTERY_SERVICE "180F"
-//const QBluetoothUuid TI_SENSORTAG_BATTERY_BATTERY_LEVEL "2A19"
-
-// {00001800-0000-1000-8000-00805f9b34fb} //Generic Access Service
-// {00001801-0000-1000-8000-00805f9b34fb} //Generic Attribute Service
-
-class SensorTagBase : public QSensorBackend
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(SensorTagBase)
-public:
- SensorTagBase(QSensor *sensor);
- virtual ~SensorTagBase();
-
- quint64 produceTimestamp();
-signals:
- void accelDataAvailable(const QAccelerometerReading &);
- void luxDataAvailable(qreal);
- void tempDataAvailable(qreal);
- void humidityDataAvailable(qreal);
- void pressureDataAvailable(qreal);
- void gyroDataAvailable(const QGyroscopeReading &);
- void magDataAvailable(const QMagnetometerReading &);
-
-protected:
- void start() override;
- void stop() override;
- QLowEnergyService *leService;
- QBluetoothUuid *serviceId;
-
-private:
- SensorTagBasePrivate *d_ptr;
- friend class SensorTagTemperatureSensor;
- friend class SensorTagAls;
- friend class SensorTagHumiditySensor;
- friend class SensorTagLightSensor;
-
- friend class SensorTagPressureSensor;
- friend class SensorTagAccelerometer;
-
- friend class SensorTagGyroscope;
- friend class SensorTagMagnetometer;
-};
-
-#endif // SENSORTAGBASEPRIVATE_H
diff --git a/src/plugins/sensors/sensortag/sensortaggyroscope.cpp b/src/plugins/sensors/sensortag/sensortaggyroscope.cpp
deleted file mode 100644
index 136d1433..00000000
--- a/src/plugins/sensors/sensortag/sensortaggyroscope.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2016 Canonical, 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 "sensortaggyroscope.h"
-
-char const * const SensorTagGyroscope::id("sensortag.gyroscope");
-const float SensorTagGyroscope::MILLI = 0.001;
-
-SensorTagGyroscope::SensorTagGyroscope(QSensor *sensor)
- : SensorTagBase(sensor)
-{
- init();
- setDescription(QLatin1String("angular velocities around x, y, and z axis in degrees per second"));
- setReading<QGyroscopeReading>(&m_reading);
- sensor->setDataRate(50);//set a default rate
-}
-
-void SensorTagGyroscope::slotDataAvailable(const QGyroscopeReading& data)
-{
- m_reading.setX(data.x());
- m_reading.setY(data.y());
- m_reading.setZ(data.z());
- m_reading.setTimestamp(produceTimestamp());
- newReadingAvailable();
-}
-
-void SensorTagGyroscope::init()
-{
- m_initDone = false;
-}
-
-void SensorTagGyroscope::start()
-{
- QObject::connect(this, &SensorTagBase::gyroDataAvailable,
- this, &SensorTagGyroscope::slotDataAvailable);
- d_ptr->enableService(TI_SENSORTAG_GYROSCOPE_SERVICE);
-}
-
-
-void SensorTagGyroscope::stop()
-{
- QObject::disconnect(this, &SensorTagBase::gyroDataAvailable,
- this, &SensorTagGyroscope::slotDataAvailable);
- d_ptr->disableService(TI_SENSORTAG_GYROSCOPE_SERVICE);
-}
-
diff --git a/src/plugins/sensors/sensortag/sensortaggyroscope.h b/src/plugins/sensors/sensortag/sensortaggyroscope.h
deleted file mode 100644
index af3cfe41..00000000
--- a/src/plugins/sensors/sensortag/sensortaggyroscope.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 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 SENSORTAGGYROSCOPE_H
-#define SENSORTAGGYROSCOPE_H
-
-#include "sensortagbase.h"
-#include <QtSensors/qgyroscope.h>
-
-class SensorTagGyroscope : public SensorTagBase
-{
- Q_OBJECT
-
-public:
- static char const * const id;
- SensorTagGyroscope(QSensor *sensor);
-protected:
- void start() override;
- void stop() override;
- virtual void init();
-
-private:
- QGyroscopeReading m_reading;
- bool m_initDone = false;
- static const float MILLI;
-private slots:
- void slotDataAvailable(const QGyroscopeReading &data);
-};
-
-#endif // SENSORTAGGYROSCOPE_H
diff --git a/src/plugins/sensors/sensortag/sensortaghumiditysensor.cpp b/src/plugins/sensors/sensortag/sensortaghumiditysensor.cpp
deleted file mode 100644
index 77b4585c..00000000
--- a/src/plugins/sensors/sensortag/sensortaghumiditysensor.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2016 Canonical, 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 "sensortaghumiditysensor.h"
-#include "sensortagbase.h"
-
-char const * const SensorTagHumiditySensor::id("sensortag.humidity");
-
-SensorTagHumiditySensor::SensorTagHumiditySensor(QSensor *sensor)
- : SensorTagBase(sensor)
-{
- setReading<QHumidityReading>(&m_reading);
-}
-
-
-void SensorTagHumiditySensor::humidityChanged(qreal value)
-{
- m_reading.setRelativeHumidity(value);
-
- m_reading.setTimestamp(produceTimestamp());
- newReadingAvailable();
-}
-
-void SensorTagHumiditySensor::start()
-{
- QObject::connect(this, &SensorTagBase::humidityDataAvailable,
- this, &SensorTagHumiditySensor::humidityChanged);
- d_ptr->enableService(TI_SENSORTAG_HUMIDTIY_SERVICE);
-}
-
-void SensorTagHumiditySensor::stop()
-{
- QObject::disconnect(this, &SensorTagBase::humidityDataAvailable,
- this, &SensorTagHumiditySensor::humidityChanged);
- d_ptr->disableService(TI_SENSORTAG_HUMIDTIY_SERVICE);
-}
-
diff --git a/src/plugins/sensors/sensortag/sensortaghumiditysensor.h b/src/plugins/sensors/sensortag/sensortaghumiditysensor.h
deleted file mode 100644
index 5511bf05..00000000
--- a/src/plugins/sensors/sensortag/sensortaghumiditysensor.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 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 SENSORTAGHUMIDITYSENSOR_H
-#define SENSORTAGHUMIDITYSENSOR_H
-
-#include "sensortagbase.h"
-#include <QHumidityReading>
-
-class SensorTagHumiditySensor : public SensorTagBase
-{
- Q_OBJECT
-public:
- SensorTagHumiditySensor(QSensor *sensor);
- static char const * const id;
-protected:
- void start() override;
- void stop() override;
-private slots:
- void humidityChanged(qreal value);
-private:
- QHumidityReading m_reading;
-};
-
-#endif // SENSORTAGHUMIDITYSENSOR_H
diff --git a/src/plugins/sensors/sensortag/sensortaglightsensor.cpp b/src/plugins/sensors/sensortag/sensortaglightsensor.cpp
deleted file mode 100644
index 9e4038b3..00000000
--- a/src/plugins/sensors/sensortag/sensortaglightsensor.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2016 Canonical, 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 "sensortaglightsensor.h"
-
-char const * const SensorTagLightSensor::id("sensortag.lightsensor");
-
-SensorTagLightSensor::SensorTagLightSensor(QSensor *sensor)
- : SensorTagBase(sensor)
-{
- init();
- setReading<QLightReading>(&m_reading);
- sensor->setDataRate(10);//set a default rate
-}
-
-void SensorTagLightSensor::slotDataAvailable(qreal data)
-{
- m_reading.setLux(data);
- m_reading.setTimestamp(produceTimestamp());
- newReadingAvailable();
-}
-
-void SensorTagLightSensor::init()
-{
- m_initDone = false;
-}
-
-void SensorTagLightSensor::start()
-{
- QObject::connect(this, &SensorTagBase::luxDataAvailable,
- this, &SensorTagLightSensor::slotDataAvailable);
- d_ptr->enableService(TI_SENSORTAG_LIGHT_SERVICE);
-}
-
-void SensorTagLightSensor::stop()
-{
- QObject::disconnect(this, &SensorTagBase::luxDataAvailable,
- this, &SensorTagLightSensor::slotDataAvailable);
- d_ptr->disableService(TI_SENSORTAG_LIGHT_SERVICE);
-}
diff --git a/src/plugins/sensors/sensortag/sensortaglightsensor.h b/src/plugins/sensors/sensortag/sensortaglightsensor.h
deleted file mode 100644
index edff8263..00000000
--- a/src/plugins/sensors/sensortag/sensortaglightsensor.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 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 SENSORTAGLIGHTSENSOR_H
-#define SENSORTAGLIGHTSENSOR_H
-
-#include "sensortagbase.h"
-#include <QtSensors/qlightsensor.h>
-
-class SensorTagLightSensor : public SensorTagBase
-{
- Q_OBJECT
-
-public:
- static char const * const id;
- SensorTagLightSensor(QSensor *sensor);
-protected:
- void start() override;
- void stop() override;
- virtual void init();
-private:
- QLightReading m_reading;
- bool m_initDone = false;
-private slots:
- void slotDataAvailable(qreal data);
-};
-
-#endif
-//SENSORTAGLIGHTSENSOR_H
diff --git a/src/plugins/sensors/sensortag/sensortagmagnetometer.cpp b/src/plugins/sensors/sensortag/sensortagmagnetometer.cpp
deleted file mode 100644
index d5d46221..00000000
--- a/src/plugins/sensors/sensortag/sensortagmagnetometer.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2016 Canonical, 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 "sensortagmagnetometer.h"
-
-char const * const SensorTagMagnetometer::id("sensortag.magnetometer");
-const float SensorTagMagnetometer::NANO = 0.000000001;
-
-SensorTagMagnetometer::SensorTagMagnetometer(QSensor *sensor)
- : SensorTagBase(sensor)
-{
- init();
- setDescription(QLatin1String("magnetic flux density in teslas (T)"));
- setReading<QMagnetometerReading>(&m_reading);
-}
-
-void SensorTagMagnetometer::start()
-{
- QObject::connect(this, &SensorTagBase::magDataAvailable,
- this, &SensorTagMagnetometer::slotDataAvailable);
- d_ptr->enableService(TI_SENSORTAG_MAGNETOMETER_SERVICE);
-}
-
-void SensorTagMagnetometer::stop()
-{
- QObject::disconnect(this, &SensorTagBase::magDataAvailable,
- this, &SensorTagMagnetometer::slotDataAvailable);
- d_ptr->disableService(TI_SENSORTAG_MAGNETOMETER_SERVICE);
-}
-
-void SensorTagMagnetometer::slotDataAvailable(const QMagnetometerReading &data)
-{
- m_reading.setX(data.x());
- m_reading.setY(data.y());
- m_reading.setZ(data.z());
- m_reading.setTimestamp(produceTimestamp());
- newReadingAvailable();
-}
-
-void SensorTagMagnetometer::init()
-{
- m_initDone = false;
-}
diff --git a/src/plugins/sensors/sensortag/sensortagmagnetometer.h b/src/plugins/sensors/sensortag/sensortagmagnetometer.h
deleted file mode 100644
index 424727a2..00000000
--- a/src/plugins/sensors/sensortag/sensortagmagnetometer.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 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 SENSORTAGMAGNETOMETER_H
-#define SENSORTAGMAGNETOMETER_H
-
-#include "sensortagbase.h"
-#include <QtSensors/qmagnetometer.h>
-
-class SensorTagMagnetometer : public SensorTagBase
-{
- Q_OBJECT
-
-public:
- static char const * const id;
- SensorTagMagnetometer(QSensor *sensor);
-protected:
- void start() override;
- void stop() override;
- virtual void init();
-
-private:
- static const float NANO;
- QMagnetometerReading m_reading;
- bool m_initDone = false;
-
-private slots:
- void slotDataAvailable(const QMagnetometerReading &data);
-};
-
-#endif
-//SENSORTAGMAGNETOMETER_H
diff --git a/src/plugins/sensors/sensortag/sensortagpressuresensor.cpp b/src/plugins/sensors/sensortag/sensortagpressuresensor.cpp
deleted file mode 100644
index 7d2c8f93..00000000
--- a/src/plugins/sensors/sensortag/sensortagpressuresensor.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2016 Canonical, 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 "sensortagpressuresensor.h"
-#include "sensortagbase.h"
-
-char const * const SensorTagPressureSensor::id("sensortag.pressure");
-
-SensorTagPressureSensor::SensorTagPressureSensor(QSensor *sensor)
- : SensorTagBase(sensor)
-{
- setReading<QPressureReading>(&m_reading);
-}
-
-void SensorTagPressureSensor::pressureChanged(qreal value)
-{
- m_reading.setPressure(value);
- m_reading.setTimestamp(produceTimestamp());
- newReadingAvailable();
-}
-
-void SensorTagPressureSensor::start()
-{
- QObject::connect(this, &SensorTagBase::pressureDataAvailable,
- this, &SensorTagPressureSensor::pressureChanged);
- d_ptr->enableService(TI_SENSORTAG_BAROMETER_SERVICE);
-}
-
-void SensorTagPressureSensor::stop()
-{
- QObject::disconnect(this, &SensorTagBase::pressureDataAvailable,
- this, &SensorTagPressureSensor::pressureChanged);
- d_ptr->disableService(TI_SENSORTAG_BAROMETER_SERVICE);
-}
-
diff --git a/src/plugins/sensors/sensortag/sensortagpressuresensor.h b/src/plugins/sensors/sensortag/sensortagpressuresensor.h
deleted file mode 100644
index 5f8b0cfd..00000000
--- a/src/plugins/sensors/sensortag/sensortagpressuresensor.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 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 SENSORTAGPRESSURESENSOR_H
-#define SENSORTAGPRESSURESENSOR_H
-
-#include "sensortagbase.h"
-#include <QObject>
-#include <QPressureReading>
-
-class SensorTagPressureSensor : public SensorTagBase
-{
- Q_OBJECT
-public:
- SensorTagPressureSensor(QSensor *sensor);
- static char const * const id;
-
-protected:
- void start() override;
- void stop() override;
-
-private slots:
- void pressureChanged(qreal value);
-private:
- QPressureReading m_reading;
-};
-
-#endif // SENSORTAGPRESSURESENSOR_H
diff --git a/src/plugins/sensors/sensortag/sensortagtemperaturesensor.cpp b/src/plugins/sensors/sensortag/sensortagtemperaturesensor.cpp
deleted file mode 100644
index ab8c4a2f..00000000
--- a/src/plugins/sensors/sensortag/sensortagtemperaturesensor.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2016 Canonical, 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 "sensortagtemperaturesensor.h"
-#include "sensortagbase.h"
-
-char const * const SensorTagTemperatureSensor::id("sensortag.temperature");
-
-SensorTagTemperatureSensor::SensorTagTemperatureSensor(QSensor *sensor)
- : SensorTagBase(sensor)
-{
- setReading<QAmbientTemperatureReading>(&m_reading);
-}
-
-void SensorTagTemperatureSensor::temperatureChanged(qreal value)
-{
- m_reading.setTemperature(value);
- m_reading.setTimestamp(produceTimestamp());
- newReadingAvailable();
-}
-
-void SensorTagTemperatureSensor::start()
-{
- QObject::connect(this, &SensorTagBase::tempDataAvailable,
- this, &SensorTagTemperatureSensor::temperatureChanged);
- d_ptr->enableService(TI_SENSORTAG_TEMPERATURE_SERVICE);
-}
-
-void SensorTagTemperatureSensor::stop()
-{
- QObject::disconnect(this, &SensorTagBase::tempDataAvailable,
- this, &SensorTagTemperatureSensor::temperatureChanged);
- d_ptr->disableService(TI_SENSORTAG_TEMPERATURE_SERVICE);
-}
-
diff --git a/src/plugins/sensors/sensortag/sensortagtemperaturesensor.h b/src/plugins/sensors/sensortag/sensortagtemperaturesensor.h
deleted file mode 100644
index c4c45d58..00000000
--- a/src/plugins/sensors/sensortag/sensortagtemperaturesensor.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 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 SENSORTAGTEMPERATURESENSOR_H
-#define SENSORTAGTEMPERATURESENSOR_H
-
-#include "sensortagbase.h"
-#include <QAmbientTemperatureReading>
-
-class SensorTagTemperatureSensor : public SensorTagBase
-{
- Q_OBJECT
-public:
- SensorTagTemperatureSensor(QSensor *sensor);
- static char const * const id;
-protected:
- void start() override;
- void stop() override;
-private slots:
- void temperatureChanged(qreal value);
-private:
- QAmbientTemperatureReading m_reading;
-};
-
-#endif // SENSORTAGTEMPERATURESENSOR_H
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 <QSensorPluginInterface>
-#include <QSensorBackend>
-#include <QSensorManager>
-
-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 <QtCore/QDataStream>
-
-namespace QtMobility {
-
-void qt_registerSensorTypes()
-{
- qRegisterMetaTypeStreamOperators<QAmbientLightReadingData>("QtMobility::QAmbientLightReadingData");
- qRegisterMetaTypeStreamOperators<QLightReadingData>("QtMobility::QLightReadingData");
- qRegisterMetaTypeStreamOperators<QAccelerometerReadingData>("QtMobility::QAccelerometerReadingData");
- qRegisterMetaTypeStreamOperators<QCompassReadingData>("QtMobility::QCompassReadingData");
- qRegisterMetaTypeStreamOperators<QProximityReadingData>("QtMobility::QProximityReadingData");
- qRegisterMetaTypeStreamOperators<QIRProximityReadingData>("QtMobility::QIRProximityReadingData");
- qRegisterMetaTypeStreamOperators<QMagnetometerReadingData>("QtMobility::QMagnetometerReadingData");
-}
-
-QDataStream &operator<<(QDataStream &out, const QAmbientLightReadingData &s)
-{
- out << static_cast<qint32>(s.lightLevel) << s.timestamp;
- return out;
-}
-
-QDataStream &operator>>(QDataStream &in, QAmbientLightReadingData &s)
-{
- qint32 lightLevel;
- in >> lightLevel >> s.timestamp;
- s.lightLevel = static_cast<SimulatorLightLevel>(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 <QtCore/QMetaType>
-#include <QtCore/QDateTime>
-
-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 <QDebug>
-#include <QtGlobal>
-
-const char *SimulatorAccelerometer::id("Simulator.Accelerometer");
-
-SimulatorAccelerometer::SimulatorAccelerometer(QSensor *sensor)
- : SimulatorCommon(sensor)
-{
- setReading<QAccelerometerReading>(&m_reading);
-}
-
-void SimulatorAccelerometer::poll()
-{
- QtMobility::QAccelerometerReadingData data = SensorsConnection::instance()->qtAccelerometerData;
- quint64 newTimestamp;
- if (!data.timestamp.isValid())
- newTimestamp = static_cast<quint64>(QDateTime::currentMSecsSinceEpoch()) / 1000;
- else
- newTimestamp = static_cast<quint64>(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 <qaccelerometer.h>
-
-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 <QDebug>
-#include <QtGlobal>
-
-const char *SimulatorAmbientLightSensor::id("Simulator.AmbientLightSensor");
-
-SimulatorAmbientLightSensor::SimulatorAmbientLightSensor(QSensor *sensor)
- : SimulatorCommon(sensor)
-{
- setReading<QAmbientLightReading>(&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<quint64>(QDateTime::currentMSecsSinceEpoch()) / 1000;
- else
- newTimestamp = static_cast<quint64>(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 <qambientlightsensor.h>
-
-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 <QtSimulator/QtSimulator>
-#include <QDebug>
-#include <QThread>
-
-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<Simulator::Connection> mConnection;
- QScopedPointer<Simulator::ConnectionWorker> 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 <qsensorbackend.h>
-#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 <QDebug>
-#include <QtGlobal>
-
-const char *SimulatorCompass::id("Simulator.Compass");
-
-SimulatorCompass::SimulatorCompass(QSensor *sensor)
- : SimulatorCommon(sensor)
-{
- setReading<QCompassReading>(&m_reading);
-}
-
-void SimulatorCompass::poll()
-{
- QtMobility::QCompassReadingData data = SensorsConnection::instance()->qtCompassData;
- quint64 newTimestamp;
- if (!data.timestamp.isValid())
- newTimestamp = static_cast<quint64>(QDateTime::currentMSecsSinceEpoch()) / 1000;
- else
- newTimestamp = static_cast<quint64>(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 <qcompass.h>
-
-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 <QDebug>
-#include <QtGlobal>
-
-const char *SimulatorIRProximitySensor::id("Simulator.IRProximitySensor");
-
-SimulatorIRProximitySensor::SimulatorIRProximitySensor(QSensor *sensor)
- : SimulatorCommon(sensor)
-{
- setReading<QIRProximityReading>(&m_reading);
-}
-
-void SimulatorIRProximitySensor::poll()
-{
- QtMobility::QIRProximityReadingData data = SensorsConnection::instance()->qtIRProximityData;
- quint64 newTimestamp;
- if (!data.timestamp.isValid())
- newTimestamp = static_cast<quint64>(QDateTime::currentMSecsSinceEpoch()) / 1000;
- else
- newTimestamp = static_cast<quint64>(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 <qirproximitysensor.h>
-
-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 <QDebug>
-#include <QtGlobal>
-
-const char *SimulatorLightSensor::id("Simulator.LightSensor");
-
-SimulatorLightSensor::SimulatorLightSensor(QSensor *sensor)
- : SimulatorCommon(sensor)
-{
- setReading<QLightReading>(&m_reading);
-}
-
-void SimulatorLightSensor::poll()
-{
- QtMobility::QLightReadingData data = SensorsConnection::instance()->qtLightData;
- quint64 newTimestamp;
- if (!data.timestamp.isValid())
- newTimestamp = static_cast<quint64>(QDateTime::currentMSecsSinceEpoch()) / 1000;
- else
- newTimestamp = static_cast<quint64>(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 <qlightsensor.h>
-
-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 <QDebug>
-#include <QtGlobal>
-
-const char *SimulatorMagnetometer::id("Simulator.Magnetometer");
-
-SimulatorMagnetometer::SimulatorMagnetometer(QSensor *sensor)
- : SimulatorCommon(sensor)
-{
- setReading<QMagnetometerReading>(&m_reading);
-}
-
-void SimulatorMagnetometer::poll()
-{
- QtMobility::QMagnetometerReadingData data = SensorsConnection::instance()->qtMagnetometerData;
- quint64 newTimestamp;
- if (!data.timestamp.isValid())
- newTimestamp = static_cast<quint64>(QDateTime::currentMSecsSinceEpoch()) / 1000;
- else
- newTimestamp = static_cast<quint64>(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 <qmagnetometer.h>
-
-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 <QDebug>
-#include <QtGlobal>
-
-const char *SimulatorProximitySensor::id("Simulator.ProximitySensor");
-
-SimulatorProximitySensor::SimulatorProximitySensor(QSensor *sensor)
- : SimulatorCommon(sensor)
-{
- setReading<QProximityReading>(&m_reading);
-}
-
-void SimulatorProximitySensor::poll()
-{
- QtMobility::QProximityReadingData data = SensorsConnection::instance()->qtProximityData;
- quint64 newTimestamp;
- if (!data.timestamp.isValid())
- newTimestamp = static_cast<quint64>(QDateTime::currentMSecsSinceEpoch() / 1000;
- else
- newTimestamp = static_cast<quint64>(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 <qproximitysensor.h>
-
-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..78baef86
--- /dev/null
+++ b/src/plugins/sensors/winrt/CMakeLists.txt
@@ -0,0 +1,32 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## WinRtSensorPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(WinRtSensorPlugin
+ OUTPUT_NAME qtsensors_winrt
+ PLUGIN_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
+ LIBRARIES
+ Qt::Core
+ Qt::CorePrivate
+ Qt::Sensors
+)
+
+qt_internal_extend_target(WinRtSensorPlugin CONDITION MSVC
+ LIBRARIES
+ runtimeobject
+)
+
+#### Keys ignored in scope 1:.:.:winrt.pro:<TRUE>:
+# OTHER_FILES = "plugin.json"
diff --git a/src/plugins/sensors/winrt/main.cpp b/src/plugins/sensors/winrt/main.cpp
index ecf2a41b..04869082 100644
--- a/src/plugins/sensors/winrt/main.cpp
+++ b/src/plugins/sensors/winrt/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "winrtaccelerometer.h"
#include "winrtcompass.h"
@@ -52,6 +16,7 @@
#include <QtSensors/QSensorBackendFactory>
#include <QtSensors/QSensorManager>
#include <QtSensors/QSensorPluginInterface>
+#include <wrl.h>
class WinRtSensorPlugin : public QObject, public QSensorPluginInterface, public QSensorBackendFactory
{
@@ -59,14 +24,24 @@ class WinRtSensorPlugin : public QObject, public QSensorPluginInterface, public
Q_PLUGIN_METADATA(IID "com.qt-project.Qt.QSensorPluginInterface/1.0" FILE "plugin.json")
Q_INTERFACES(QSensorPluginInterface)
public:
+
+ ~WinRtSensorPlugin()
+ {
+ CoUninitialize();
+ }
+
void registerSensors() override
{
- QSensorManager::registerBackend(QAccelerometer::type, QByteArrayLiteral("WinRtAccelerometer"), this);
- QSensorManager::registerBackend(QCompass::type, QByteArrayLiteral("WinRtCompass"), this);
- QSensorManager::registerBackend(QGyroscope::type, QByteArrayLiteral("WinRtGyroscope"), this);
- QSensorManager::registerBackend(QRotationSensor::type, QByteArrayLiteral("WinRtRotationSensor"), this);
- QSensorManager::registerBackend(QAmbientLightSensor::type, QByteArrayLiteral("WinRtAmbientLightSensor"), this);
- QSensorManager::registerBackend(QOrientationSensor::type, QByteArrayLiteral("WinRtOrientationSensor"), this);
+ if (FAILED(CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED))) {
+ qErrnoWarning("CoInitializeEx() failed.");
+ return;
+ }
+ QSensorManager::registerBackend(QAccelerometer::sensorType, QByteArrayLiteral("WinRtAccelerometer"), this);
+ QSensorManager::registerBackend(QCompass::sensorType, QByteArrayLiteral("WinRtCompass"), this);
+ QSensorManager::registerBackend(QGyroscope::sensorType, QByteArrayLiteral("WinRtGyroscope"), this);
+ QSensorManager::registerBackend(QRotationSensor::sensorType, QByteArrayLiteral("WinRtRotationSensor"), this);
+ QSensorManager::registerBackend(QAmbientLightSensor::sensorType, QByteArrayLiteral("WinRtAmbientLightSensor"), this);
+ QSensorManager::registerBackend(QOrientationSensor::sensorType, QByteArrayLiteral("WinRtOrientationSensor"), this);
}
QSensorBackend *createBackend(QSensor *sensor) override
diff --git a/src/plugins/sensors/winrt/winrt.pro b/src/plugins/sensors/winrt/winrt.pro
deleted file mode 100644
index 21996fdd..00000000
--- a/src/plugins/sensors/winrt/winrt.pro
+++ /dev/null
@@ -1,27 +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
-
-PLUGIN_TYPE = sensors
-PLUGIN_CLASS_NAME = WinRtSensorPlugin
-load(qt_plugin)
diff --git a/src/plugins/sensors/winrt/winrtaccelerometer.cpp b/src/plugins/sensors/winrt/winrtaccelerometer.cpp
index 3570a47d..43a364c9 100644
--- a/src/plugins/sensors/winrt/winrtaccelerometer.cpp
+++ b/src/plugins/sensors/winrt/winrtaccelerometer.cpp
@@ -1,51 +1,15 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "winrtaccelerometer.h"
#include "winrtcommon.h"
#include <QtSensors/QAccelerometerReading>
-#include <private/qeventdispatcher_winrt_p.h>
#include <functional>
#include <wrl.h>
#include <windows.devices.sensors.h>
+
using namespace Microsoft::WRL;
using namespace Microsoft::WRL::Wrappers;
using namespace ABI::Windows::Foundation;
@@ -119,28 +83,30 @@ WinRtAccelerometer::WinRtAccelerometer(QSensor *sensor)
: QSensorBackend(sensor), d_ptr(new WinRtAccelerometerPrivate(this))
{
Q_D(WinRtAccelerometer);
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- HStringReference classId(RuntimeClass_Windows_Devices_Sensors_Accelerometer);
- ComPtr<IAccelerometerStatics> factory;
- HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
- if (FAILED(hr)) {
- qCWarning(lcWinRtSensors) << "Unable to initialize accelerometer factory."
+
+ HStringReference classId(RuntimeClass_Windows_Devices_Sensors_Accelerometer);
+ ComPtr<IAccelerometerStatics> factory;
+ HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
+ if (FAILED(hr)) {
+ qCWarning(lcWinRtSensors) << "Unable to initialize accelerometer factory."
<< qt_error_string(hr);
- return hr;
- }
+ sensorError(hr);
+ return;
+ }
+ hr = factory->GetDefault(&d->sensor);
- hr = factory->GetDefault(&d->sensor);
- if (FAILED(hr)) {
- qCWarning(lcWinRtSensors) << "Unable to get default accelerometer."
+ if (FAILED(hr)) {
+ qCWarning(lcWinRtSensors) << "Unable to get default accelerometer."
<< qt_error_string(hr);
- }
- return hr;
- });
- if (FAILED(hr) || !d->sensor) {
sensorError(hr);
return;
}
+ if (!d->sensor) {
+ qCWarning(lcWinRtSensors) << "Default accelerometer was not found on the system.";
+ return;
+ }
+
hr = d->sensor->get_MinimumReportInterval(&d->minimumReportInterval);
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to get the minimum report interval."
@@ -167,11 +133,10 @@ void WinRtAccelerometer::start()
if (d->token.value)
return;
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- ComPtr<AccelerometerReadingHandler> callback =
- Callback<AccelerometerReadingHandler>(d, &WinRtAccelerometerPrivate::readingChanged);
- return d->sensor->add_ReadingChanged(callback.Get(), &d->token);
- });
+ ComPtr<AccelerometerReadingHandler> callback =
+ Callback<AccelerometerReadingHandler>(d, &WinRtAccelerometerPrivate::readingChanged);
+ HRESULT hr = d->sensor->add_ReadingChanged(callback.Get(), &d->token);
+
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to attach to reading changed event."
<< qt_error_string(hr);
@@ -200,9 +165,7 @@ void WinRtAccelerometer::stop()
if (!d->token.value)
return;
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- return d->sensor->remove_ReadingChanged(d->token);
- });
+ HRESULT hr = d->sensor->remove_ReadingChanged(d->token);
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to detach from reading changed event."
<< qt_error_string(hr);
diff --git a/src/plugins/sensors/winrt/winrtaccelerometer.h b/src/plugins/sensors/winrt/winrtaccelerometer.h
index dcb52ee5..96b0f093 100644
--- a/src/plugins/sensors/winrt/winrtaccelerometer.h
+++ b/src/plugins/sensors/winrt/winrtaccelerometer.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef WINRTACCELEROMETER_H
#define WINRTACCELEROMETER_H
diff --git a/src/plugins/sensors/winrt/winrtambientlightsensor.cpp b/src/plugins/sensors/winrt/winrtambientlightsensor.cpp
index 426d61bf..17785256 100644
--- a/src/plugins/sensors/winrt/winrtambientlightsensor.cpp
+++ b/src/plugins/sensors/winrt/winrtambientlightsensor.cpp
@@ -1,47 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "winrtambientlightsensor.h"
#include "winrtcommon.h"
#include <QtSensors/QAmbientLightSensor>
-#include <private/qeventdispatcher_winrt_p.h>
#include <functional>
#include <wrl.h>
@@ -118,27 +81,27 @@ WinRtAmbientLightSensor::WinRtAmbientLightSensor(QSensor *sensor)
: QSensorBackend(sensor), d_ptr(new WinRtAmbientLightSensorPrivate(this))
{
Q_D(WinRtAmbientLightSensor);
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- HStringReference classId(RuntimeClass_Windows_Devices_Sensors_LightSensor);
- ComPtr<ILightSensorStatics> factory;
- HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
- if (FAILED(hr)) {
- qCWarning(lcWinRtSensors) << "Unable to initialize light sensor factory."
- << qt_error_string(hr);
- return hr;
- }
- hr = factory->GetDefault(&d->sensor);
- if (FAILED(hr)) {
- qCWarning(lcWinRtSensors) << "Unable to get default light sensor."
+ HStringReference classId(RuntimeClass_Windows_Devices_Sensors_LightSensor);
+ ComPtr<ILightSensorStatics> factory;
+ HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
+ if (FAILED(hr)) {
+ qCWarning(lcWinRtSensors) << "Unable to initialize light sensor factory."
<< qt_error_string(hr);
- }
- return hr;
- });
- if (FAILED(hr) || !d->sensor) {
sensorError(hr);
return;
}
+ hr = factory->GetDefault(&d->sensor);
+ if (FAILED(hr)) {
+ qCWarning(lcWinRtSensors) << "Unable to get default light sensor."
+ << qt_error_string(hr);
+ sensorError(hr);
+ return;
+ }
+ if (!d->sensor) {
+ qCWarning(lcWinRtSensors) << "Default lightsensor was not found on the system.";
+ return;
+ }
hr = d->sensor->get_MinimumReportInterval(&d->minimumReportInterval);
if (FAILED(hr)) {
@@ -166,11 +129,10 @@ void WinRtAmbientLightSensor::start()
if (d->token.value)
return;
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- ComPtr<LightSensorReadingHandler> callback =
+ ComPtr<LightSensorReadingHandler> callback =
Callback<LightSensorReadingHandler>(d, &WinRtAmbientLightSensorPrivate::readingChanged);
- return d->sensor->add_ReadingChanged(callback.Get(), &d->token);
- });
+ HRESULT hr = d->sensor->add_ReadingChanged(callback.Get(), &d->token);
+
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to attach to reading changed event."
<< qt_error_string(hr);
@@ -199,9 +161,7 @@ void WinRtAmbientLightSensor::stop()
if (!d->token.value)
return;
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- return d->sensor->remove_ReadingChanged(d->token);
- });
+ HRESULT hr = d->sensor->remove_ReadingChanged(d->token);
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to detach from reading changed event."
<< qt_error_string(hr);
diff --git a/src/plugins/sensors/winrt/winrtambientlightsensor.h b/src/plugins/sensors/winrt/winrtambientlightsensor.h
index e32db890..160d7474 100644
--- a/src/plugins/sensors/winrt/winrtambientlightsensor.h
+++ b/src/plugins/sensors/winrt/winrtambientlightsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef WINRTAMBIENTLIGHTSENSOR_H
#define WINRTAMBIENTLIGHTSENSOR_H
diff --git a/src/plugins/sensors/winrt/winrtcommon.cpp b/src/plugins/sensors/winrt/winrtcommon.cpp
index 3e5d1525..e655a672 100644
--- a/src/plugins/sensors/winrt/winrtcommon.cpp
+++ b/src/plugins/sensors/winrt/winrtcommon.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "winrtcommon.h"
diff --git a/src/plugins/sensors/winrt/winrtcommon.h b/src/plugins/sensors/winrt/winrtcommon.h
index db3c8197..6f4c868c 100644
--- a/src/plugins/sensors/winrt/winrtcommon.h
+++ b/src/plugins/sensors/winrt/winrtcommon.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef WINRTCOMMON_H
#define WINRTCOMMON_H
diff --git a/src/plugins/sensors/winrt/winrtcompass.cpp b/src/plugins/sensors/winrt/winrtcompass.cpp
index 5ef730d0..a12f1dcd 100644
--- a/src/plugins/sensors/winrt/winrtcompass.cpp
+++ b/src/plugins/sensors/winrt/winrtcompass.cpp
@@ -1,47 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "winrtcompass.h"
#include "winrtcommon.h"
#include <QtSensors/QCompass>
-#include <private/qeventdispatcher_winrt_p.h>
#include <functional>
#include <wrl.h>
@@ -136,28 +99,30 @@ WinRtCompass::WinRtCompass(QSensor *sensor)
: QSensorBackend(sensor), d_ptr(new WinRtCompassPrivate(this))
{
Q_D(WinRtCompass);
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- HStringReference classId(RuntimeClass_Windows_Devices_Sensors_Compass);
- ComPtr<ICompassStatics> factory;
- HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
- if (FAILED(hr)) {
- qCWarning(lcWinRtSensors) << "Unable to initialize light sensor factory."
+
+ HStringReference classId(RuntimeClass_Windows_Devices_Sensors_Compass);
+ ComPtr<ICompassStatics> factory;
+ HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
+ if (FAILED(hr)) {
+ qCWarning(lcWinRtSensors) << "Unable to initialize light sensor factory."
<< qt_error_string(hr);
- return hr;
- }
+ sensorError(hr);
+ return;
+ }
- hr = factory->GetDefault(&d->sensor);
- if (FAILED(hr)) {
- qCWarning(lcWinRtSensors) << "Unable to get default compass."
+ hr = factory->GetDefault(&d->sensor);
+ if (FAILED(hr)) {
+ qCWarning(lcWinRtSensors) << "Unable to get default compass."
<< qt_error_string(hr);
- }
- return hr;
- });
- if (FAILED(hr) || !d->sensor) {
sensorError(hr);
return;
}
+ if (!d->sensor) {
+ qCWarning(lcWinRtSensors) << "Default compass was not found on the system.";
+ return;
+ }
+
hr = d->sensor->get_MinimumReportInterval(&d->minimumReportInterval);
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to get the minimum report interval."
@@ -183,12 +148,10 @@ void WinRtCompass::start()
return;
if (d->token.value)
return;
-
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- ComPtr<CompassReadingHandler> callback =
+ ComPtr<CompassReadingHandler> callback =
Callback<CompassReadingHandler>(d, &WinRtCompassPrivate::readingChanged);
- return d->sensor->add_ReadingChanged(callback.Get(), &d->token);
- });
+ HRESULT hr = d->sensor->add_ReadingChanged(callback.Get(), &d->token);
+
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to attach to reading changed event."
<< qt_error_string(hr);
@@ -216,9 +179,8 @@ void WinRtCompass::stop()
return;
if (!d->token.value)
return;
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- return d->sensor->remove_ReadingChanged(d->token);
- });
+ HRESULT hr = d->sensor->remove_ReadingChanged(d->token);
+
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to detach from reading changed event."
<< qt_error_string(hr);
diff --git a/src/plugins/sensors/winrt/winrtcompass.h b/src/plugins/sensors/winrt/winrtcompass.h
index 5bb8faf1..f4297c36 100644
--- a/src/plugins/sensors/winrt/winrtcompass.h
+++ b/src/plugins/sensors/winrt/winrtcompass.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef WINRTCOMPASS_H
#define WINRTCOMPASS_H
diff --git a/src/plugins/sensors/winrt/winrtgyroscope.cpp b/src/plugins/sensors/winrt/winrtgyroscope.cpp
index 45b544c7..c5fff500 100644
--- a/src/plugins/sensors/winrt/winrtgyroscope.cpp
+++ b/src/plugins/sensors/winrt/winrtgyroscope.cpp
@@ -1,47 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "winrtgyroscope.h"
#include "winrtcommon.h"
#include <QtSensors/QGyroscope>
-#include <private/qeventdispatcher_winrt_p.h>
#include <functional>
#include <wrl.h>
@@ -51,7 +14,7 @@ using namespace Microsoft::WRL::Wrappers;
using namespace ABI::Windows::Foundation;
using namespace ABI::Windows::Devices::Sensors;
-typedef ITypedEventHandler<Gyrometer *, GyrometerReadingChangedEventArgs *> InclinometerReadingHandler;
+typedef ITypedEventHandler<Gyrometer *, GyrometerReadingChangedEventArgs *> GyrometerReadingHandler;
QT_USE_NAMESPACE
@@ -116,28 +79,30 @@ WinRtGyroscope::WinRtGyroscope(QSensor *sensor)
: QSensorBackend(sensor), d_ptr(new WinRtGyroscopePrivate(this))
{
Q_D(WinRtGyroscope);
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- HStringReference classId(RuntimeClass_Windows_Devices_Sensors_Gyrometer);
- ComPtr<IGyrometerStatics> factory;
- HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
- if (FAILED(hr)) {
- qCWarning(lcWinRtSensors) << "Unable to initialize gyroscope sensor factory."
+
+ HStringReference classId(RuntimeClass_Windows_Devices_Sensors_Gyrometer);
+ ComPtr<IGyrometerStatics> factory;
+ HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
+ if (FAILED(hr)) {
+ qCWarning(lcWinRtSensors) << "Unable to initialize gyroscope sensor factory."
<< qt_error_string(hr);
- return hr;
- }
+ sensorError(hr);
+ return;
+ }
- hr = factory->GetDefault(&d->sensor);
- if (FAILED(hr)) {
- qCWarning(lcWinRtSensors) << "Unable to get default gyroscope sensor."
+ hr = factory->GetDefault(&d->sensor);
+ if (FAILED(hr)) {
+ qCWarning(lcWinRtSensors) << "Unable to get default gyroscope sensor."
<< qt_error_string(hr);
- }
- return hr;
- });
- if (FAILED(hr) || !d->sensor) {
sensorError(hr);
return;
}
+ if (!d->sensor) {
+ qCWarning(lcWinRtSensors) << "Default gyroscope was not found on the system.";
+ return;
+ }
+
hr = d->sensor->get_MinimumReportInterval(&d->minimumReportInterval);
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to get the minimum report interval."
@@ -164,11 +129,10 @@ void WinRtGyroscope::start()
if (d->token.value)
return;
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- ComPtr<InclinometerReadingHandler> callback =
- Callback<InclinometerReadingHandler>(d, &WinRtGyroscopePrivate::readingChanged);
- return d->sensor->add_ReadingChanged(callback.Get(), &d->token);
- });
+ ComPtr<GyrometerReadingHandler> callback =
+ Callback<GyrometerReadingHandler>(d, &WinRtGyroscopePrivate::readingChanged);
+ HRESULT hr = d->sensor->add_ReadingChanged(callback.Get(), &d->token);
+
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to attach to reading changed event."
<< qt_error_string(hr);
@@ -197,9 +161,7 @@ void WinRtGyroscope::stop()
if (!d->token.value)
return;
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- return d->sensor->remove_ReadingChanged(d->token);
- });
+ HRESULT hr = d->sensor->remove_ReadingChanged(d->token);
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to detach from reading changed event."
<< qt_error_string(hr);
diff --git a/src/plugins/sensors/winrt/winrtgyroscope.h b/src/plugins/sensors/winrt/winrtgyroscope.h
index 7bd85332..9d2fad4b 100644
--- a/src/plugins/sensors/winrt/winrtgyroscope.h
+++ b/src/plugins/sensors/winrt/winrtgyroscope.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef WINRTGYROSCOPE_H
#define WINRTGYROSCOPE_H
@@ -55,7 +19,7 @@ public:
bool isFeatureSupported(QSensor::Feature feature) const override
{
- if (feature == QSensor::AxesOrientation || feature == QSensor::AccelerationMode)
+ if (feature == QSensor::Feature::AxesOrientation || feature == QSensor::Feature::AccelerationMode)
return true;
return false;
}
diff --git a/src/plugins/sensors/winrt/winrtorientationsensor.cpp b/src/plugins/sensors/winrt/winrtorientationsensor.cpp
index e24ff954..330ccae7 100644
--- a/src/plugins/sensors/winrt/winrtorientationsensor.cpp
+++ b/src/plugins/sensors/winrt/winrtorientationsensor.cpp
@@ -1,47 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "winrtorientationsensor.h"
#include "winrtcommon.h"
#include <QtSensors/QOrientationSensor>
-#include <private/qeventdispatcher_winrt_p.h>
#include <functional>
#include <wrl.h>
@@ -122,27 +85,26 @@ WinRtOrientationSensor::WinRtOrientationSensor(QSensor *sensor)
: QSensorBackend(sensor), d_ptr(new WinRtOrientationSensorPrivate(this))
{
Q_D(WinRtOrientationSensor);
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- HStringReference classId(RuntimeClass_Windows_Devices_Sensors_SimpleOrientationSensor);
- ComPtr<ISimpleOrientationSensorStatics> factory;
- HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
- if (FAILED(hr)) {
- qCWarning(lcWinRtSensors) << "Unable to initialize orientation sensor factory."
+ HStringReference classId(RuntimeClass_Windows_Devices_Sensors_SimpleOrientationSensor);
+ ComPtr<ISimpleOrientationSensorStatics> factory;
+ HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
+ if (FAILED(hr)) {
+ qCWarning(lcWinRtSensors) << "Unable to initialize orientation sensor factory."
<< qt_error_string(hr);
- return hr;
- }
-
- hr = factory->GetDefault(&d->sensor);
- if (FAILED(hr)) {
- qCWarning(lcWinRtSensors) << "Unable to get default orientation sensor."
+ sensorError(hr);
+ return;
+ }
+ hr = factory->GetDefault(&d->sensor);
+ if (FAILED(hr)) {
+ qCWarning(lcWinRtSensors) << "Unable to get default orientation sensor."
<< qt_error_string(hr);
- }
- return hr;
- });
- if (FAILED(hr) || !d->sensor) {
sensorError(hr);
return;
}
+ if (!d->sensor) {
+ qCWarning(lcWinRtSensors) << "Default orientationsensor was not found on the system.";
+ return;
+ }
setReading<QOrientationReading>(&d->reading);
}
@@ -159,11 +121,10 @@ void WinRtOrientationSensor::start()
if (d->token.value)
return;
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- ComPtr<SimpleOrientationReadingHandler> callback =
+ ComPtr<SimpleOrientationReadingHandler> callback =
Callback<SimpleOrientationReadingHandler>(d, &WinRtOrientationSensorPrivate::readingChanged);
- return d->sensor->add_OrientationChanged(callback.Get(), &d->token);
- });
+ HRESULT hr = d->sensor->add_OrientationChanged(callback.Get(), &d->token);
+
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to attach to reading changed event."
<< qt_error_string(hr);
@@ -180,9 +141,7 @@ void WinRtOrientationSensor::stop()
if (!d->token.value)
return;
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- return d->sensor->remove_OrientationChanged(d->token);
- });
+ HRESULT hr = d->sensor->remove_OrientationChanged(d->token);
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to detach from reading changed event."
<< qt_error_string(hr);
diff --git a/src/plugins/sensors/winrt/winrtorientationsensor.h b/src/plugins/sensors/winrt/winrtorientationsensor.h
index 8e40a3e9..e7aaf4d8 100644
--- a/src/plugins/sensors/winrt/winrtorientationsensor.h
+++ b/src/plugins/sensors/winrt/winrtorientationsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef WINRTORIENTATIONSENSOR_H
#define WINRTORIENTATIONSENSOR_H
diff --git a/src/plugins/sensors/winrt/winrtrotationsensor.cpp b/src/plugins/sensors/winrt/winrtrotationsensor.cpp
index 5dd4eae5..c29395fa 100644
--- a/src/plugins/sensors/winrt/winrtrotationsensor.cpp
+++ b/src/plugins/sensors/winrt/winrtrotationsensor.cpp
@@ -1,47 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "winrtrotationsensor.h"
#include "winrtcommon.h"
#include <QtSensors/QRotationSensor>
-#include <private/qeventdispatcher_winrt_p.h>
#include <functional>
#include <wrl.h>
@@ -114,28 +77,29 @@ WinRtRotationSensor::WinRtRotationSensor(QSensor *sensor)
: QSensorBackend(sensor), d_ptr(new WinRtRotationSensorPrivate(this))
{
Q_D(WinRtRotationSensor);
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- HStringReference classId(RuntimeClass_Windows_Devices_Sensors_Inclinometer);
- ComPtr<IInclinometerStatics> factory;
- HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
- if (FAILED(hr)) {
- qCWarning(lcWinRtSensors) << "Unable to initialize rotation sensor factory."
- << qt_error_string(hr);
- return hr;
- }
- hr = factory->GetDefault(&d->sensor);
- if (FAILED(hr)) {
- qCWarning(lcWinRtSensors) << "Unable to get default rotation sensor."
+ HStringReference classId(RuntimeClass_Windows_Devices_Sensors_Inclinometer);
+ ComPtr<IInclinometerStatics> factory;
+ HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
+ if (FAILED(hr)) {
+ qCWarning(lcWinRtSensors) << "Unable to initialize rotation sensor factory."
+ << qt_error_string(hr);
+ sensorError(hr);
+ return;
+ }
+ hr = factory->GetDefault(&d->sensor);
+ if (FAILED(hr)) {
+ qCWarning(lcWinRtSensors) << "Unable to get default rotation sensor."
<< qt_error_string(hr);
- }
- return hr;
- });
- if (FAILED(hr) || !d->sensor) {
sensorError(hr);
return;
}
+ if (!d->sensor) {
+ qCWarning(lcWinRtSensors) << "Default rotationsensor was not found on the system.";
+ return;
+ }
+
hr = d->sensor->get_MinimumReportInterval(&d->minimumReportInterval);
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to get the minimum report interval."
@@ -162,11 +126,10 @@ void WinRtRotationSensor::start()
if (d->token.value)
return;
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- ComPtr<InclinometerReadingHandler> callback =
+ ComPtr<InclinometerReadingHandler> callback =
Callback<InclinometerReadingHandler>(d, &WinRtRotationSensorPrivate::readingChanged);
- return d->sensor->add_ReadingChanged(callback.Get(), &d->token);
- });
+ HRESULT hr = d->sensor->add_ReadingChanged(callback.Get(), &d->token);
+
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to attach to reading changed event."
<< qt_error_string(hr);
@@ -195,9 +158,7 @@ void WinRtRotationSensor::stop()
if (!d->token.value)
return;
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- return d->sensor->remove_ReadingChanged(d->token);
- });
+ HRESULT hr = d->sensor->remove_ReadingChanged(d->token);
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to detach from reading changed event."
<< qt_error_string(hr);
diff --git a/src/plugins/sensors/winrt/winrtrotationsensor.h b/src/plugins/sensors/winrt/winrtrotationsensor.h
index 4b3e6faf..add2d027 100644
--- a/src/plugins/sensors/winrt/winrtrotationsensor.h
+++ b/src/plugins/sensors/winrt/winrtrotationsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef WINRTROTATIONSENSOR_H
#define WINRTROTATIONSENSOR_H
@@ -55,7 +19,7 @@ public:
bool isFeatureSupported(QSensor::Feature feature) const override
{
- if (feature == QSensor::AxesOrientation || feature == QSensor::AccelerationMode)
+ if (feature == QSensor::Feature::AxesOrientation || feature == QSensor::Feature::AccelerationMode)
return true;
return false;
}
diff --git a/src/sensors/CMakeLists.txt b/src/sensors/CMakeLists.txt
new file mode 100644
index 00000000..6d883696
--- /dev/null
+++ b/src/sensors/CMakeLists.txt
@@ -0,0 +1,95 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## Sensors Module:
+#####################################################################
+
+qt_internal_add_module(Sensors
+ PLUGIN_TYPES sensors
+ SOURCES
+ qsensorbackend.cpp qsensorbackend.h
+ qsensormanager.cpp qsensormanager.h
+ qsensorplugin.cpp qsensorplugin.h
+ qsensorsglobal.h
+ sensorlog_p.h
+ qsensor.h
+ qaccelerometer.h
+ qambientlightsensor.h
+ qambienttemperaturesensor.h
+ qcompass.h
+ qlightsensor.h
+ qmagnetometer.h
+ qorientationsensor.h
+ qproximitysensor.h
+ qirproximitysensor.h
+ qrotationsensor.h
+ qtapsensor.h
+ qtiltsensor.h
+ qgyroscope.h
+ qpressuresensor.h
+ qhumiditysensor.h
+ qlidsensor.h
+ qsensor_p.h
+ qaccelerometer_p.h
+ qambientlightsensor_p.h
+ qambienttemperaturesensor_p.h
+ qcompass_p.h
+ qlightsensor_p.h
+ qmagnetometer_p.h
+ qorientationsensor_p.h
+ qproximitysensor_p.h
+ qirproximitysensor_p.h
+ qrotationsensor_p.h
+ qtapsensor_p.h
+ qtiltsensor_p.h
+ qgyroscope_p.h
+ qpressuresensor_p.h
+ qhumiditysensor_p.h
+ qlidsensor_p.h
+ qsensor.cpp
+ qaccelerometer.cpp
+ qambientlightsensor.cpp
+ qambienttemperaturesensor.cpp
+ qcompass.cpp
+ qlightsensor.cpp
+ qmagnetometer.cpp
+ qorientationsensor.cpp
+ qproximitysensor.cpp
+ qirproximitysensor.cpp
+ qrotationsensor.cpp
+ qtapsensor.cpp
+ qtiltsensor.cpp
+ qgyroscope.cpp
+ qpressuresensor.cpp
+ qhumiditysensor.cpp
+ qlidsensor.cpp
+ DEFINES
+ $<$<CONFIG:Debug>:ENABLE_RUNTIME_SENSORLOG>
+ LIBRARIES
+ Qt::CorePrivate
+ PUBLIC_LIBRARIES
+ Qt::Core
+ PRIVATE_MODULE_INTERFACE
+ Qt::CorePrivate
+ GENERATE_CPP_EXPORTS
+)
+
+if(ANDROID)
+ set_property(TARGET Sensors APPEND PROPERTY QT_ANDROID_LIB_DEPENDENCIES
+ ${INSTALL_PLUGINSDIR}/sensors/libplugins_sensors_qtsensors_android.so
+ )
+endif()
+
+## Scopes:
+#####################################################################
+
+qt_internal_extend_target(Sensors CONDITION SENSORS_CONFIG_PATH
+ DEFINES
+ QTSENSORS_CONFIG_PATH="${SENSORS_CONFIG_PATH}"
+)
+
+qt_internal_add_docs(Sensors
+ doc/qtsensors.qdocconf
+)
+
diff --git a/src/sensors/configure.cmake b/src/sensors/configure.cmake
new file mode 100644
index 00000000..04eb0e30
--- /dev/null
+++ b/src/sensors/configure.cmake
@@ -0,0 +1,58 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+
+
+#### Inputs
+
+
+
+#### Libraries
+# special case begin
+if (LINUX)
+ qt_find_package(Sensorfw PROVIDED_TARGETS Sensorfw::Sensorfw MODULE_NAME sensors QMAKE_LIB sensorfw)
+endif()
+# special case end
+
+#### Tests
+
+if (WIN32 AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../../config.tests/winrt/CMakeLists.txt")
+ qt_config_compile_test("winrt_sensors"
+ LABEL "WinRT sensors"
+ PROJECT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../config.tests/winrt")
+endif()
+
+#### Features
+
+# special case begin
+qt_feature("sensorfw" PRIVATE
+ LABEL "sensorfw"
+ CONDITION Sensorfw_FOUND
+)
+# special case end
+
+qt_feature("winrt_sensors" PRIVATE
+ LABEL "WinRT sensors backend"
+ CONDITION WIN32 AND TEST_winrt_sensors
+)
+
+qt_configure_add_summary_section(NAME "Qt Sensors")
+if (LINUX)
+ # At the moment there is no Qt6 version of sensorfw, and while the
+ # FindSensorfw.cmake in this repo would find the package using pkg-config,
+ # it would not work. Once the Qt6 version exists, remove the
+ # "sensorfw_enabled_with_cmake" entry, enable build in
+ # src/plugins/sensors/CMakeLists.txt and fix any potential errors.
+ qt_configure_add_summary_entry(ARGS "sensorfw")
+ qt_configure_add_summary_entry(ARGS "sensorfw_enabled_with_cmake")
+ qt_configure_add_report_entry(
+ TYPE WARNING
+ MESSAGE "SensorFW support currently not enabled with cmake"
+ )
+endif()
+
+if (WIN32)
+ qt_configure_add_summary_entry(ARGS "winrt_sensors")
+endif()
+
+qt_configure_end_summary_section() # end of "Qt Sensors" section
diff --git a/src/sensors/doc/images/sensorgesture-cover.png b/src/sensors/doc/images/sensorgesture-cover.png
deleted file mode 100644
index 7b4fbc5f..00000000
--- a/src/sensors/doc/images/sensorgesture-cover.png
+++ /dev/null
Binary files differ
diff --git a/src/sensors/doc/images/sensorgesture-doubletap.png b/src/sensors/doc/images/sensorgesture-doubletap.png
deleted file mode 100644
index 6253d0f8..00000000
--- a/src/sensors/doc/images/sensorgesture-doubletap.png
+++ /dev/null
Binary files differ
diff --git a/src/sensors/doc/images/sensorgesture-facedown.png b/src/sensors/doc/images/sensorgesture-facedown.png
deleted file mode 100644
index a85664f1..00000000
--- a/src/sensors/doc/images/sensorgesture-facedown.png
+++ /dev/null
Binary files differ
diff --git a/src/sensors/doc/images/sensorgesture-faceup.png b/src/sensors/doc/images/sensorgesture-faceup.png
deleted file mode 100644
index c20ef089..00000000
--- a/src/sensors/doc/images/sensorgesture-faceup.png
+++ /dev/null
Binary files differ
diff --git a/src/sensors/doc/images/sensorgesture-flat.png b/src/sensors/doc/images/sensorgesture-flat.png
deleted file mode 100644
index e8eafafb..00000000
--- a/src/sensors/doc/images/sensorgesture-flat.png
+++ /dev/null
Binary files differ
diff --git a/src/sensors/doc/images/sensorgesture-hover.png b/src/sensors/doc/images/sensorgesture-hover.png
deleted file mode 100644
index fecf6b3a..00000000
--- a/src/sensors/doc/images/sensorgesture-hover.png
+++ /dev/null
Binary files differ
diff --git a/src/sensors/doc/images/sensorgesture-shake.png b/src/sensors/doc/images/sensorgesture-shake.png
deleted file mode 100644
index 06f9eeaf..00000000
--- a/src/sensors/doc/images/sensorgesture-shake.png
+++ /dev/null
Binary files differ
diff --git a/src/sensors/doc/images/sensorgesture-slam_1.png b/src/sensors/doc/images/sensorgesture-slam_1.png
deleted file mode 100644
index d56f8892..00000000
--- a/src/sensors/doc/images/sensorgesture-slam_1.png
+++ /dev/null
Binary files differ
diff --git a/src/sensors/doc/images/sensorgesture-slam_2.png b/src/sensors/doc/images/sensorgesture-slam_2.png
deleted file mode 100644
index 5fe8ecba..00000000
--- a/src/sensors/doc/images/sensorgesture-slam_2.png
+++ /dev/null
Binary files differ
diff --git a/src/sensors/doc/images/sensorgesture-twist.png b/src/sensors/doc/images/sensorgesture-twist.png
deleted file mode 100644
index bec15854..00000000
--- a/src/sensors/doc/images/sensorgesture-twist.png
+++ /dev/null
Binary files differ
diff --git a/src/sensors/doc/images/sensorgesture-whip.png b/src/sensors/doc/images/sensorgesture-whip.png
deleted file mode 100644
index aa998bb7..00000000
--- a/src/sensors/doc/images/sensorgesture-whip.png
+++ /dev/null
Binary files differ
diff --git a/src/sensors/doc/qtsensors-module-use.qdocinc b/src/sensors/doc/qtsensors-module-use.qdocinc
new file mode 100644
index 00000000..761b6bbd
--- /dev/null
+++ b/src/sensors/doc/qtsensors-module-use.qdocinc
@@ -0,0 +1,15 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+//! [cmakebuild]
+ \code
+ find_package(Qt6 REQUIRED COMPONENTS Sensors)
+ target_link_libraries(mytarget PRIVATE Qt6::Sensors)
+ \endcode
+//! [cmakebuild]
+
+//! [qmakebuild]
+ \code
+ QT += sensors
+ \endcode
+//! [qmakebuild]
diff --git a/src/sensors/doc/qtsensors.qdocconf b/src/sensors/doc/qtsensors.qdocconf
index 0845e707..b7569927 100644
--- a/src/sensors/doc/qtsensors.qdocconf
+++ b/src/sensors/doc/qtsensors.qdocconf
@@ -1,4 +1,3 @@
-include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf)
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
include($QT_INSTALL_DOCS/config/exampleurl-qtsensors.qdocconf)
@@ -14,33 +13,26 @@ qhp.QtSensors.virtualFolder = qtsensors
qhp.QtSensors.indexTitle = Qt Sensors
qhp.QtSensors.indexRoot =
-qhp.QtSensors.filterAttributes = qtsensors $QT_VERSION qtrefdoc
-qhp.QtSensors.customFilters.Qt.name = QtSensors $QT_VERSION
-qhp.QtSensors.customFilters.Qt.filterAttributes = qtsensors $QT_VERSION
qhp.QtSensors.subprojects = overviews classes qmltypes examples
qhp.QtSensors.subprojects.overviews.title = Overview
qhp.QtSensors.subprojects.overviews.indexTitle = Qt Sensors
-qhp.QtSensors.subprojects.overviews.selectors = fake:page,group,module
+qhp.QtSensors.subprojects.overviews.selectors = doc:page,group,module
qhp.QtSensors.subprojects.classes.title = C++ Classes
qhp.QtSensors.subprojects.classes.indexTitle = Qt Sensors C++ Classes
-qhp.QtSensors.subprojects.classes.selectors = class fake:headerfile
+qhp.QtSensors.subprojects.classes.selectors = class headerfile
qhp.QtSensors.subprojects.classes.sortPages = true
qhp.QtSensors.subprojects.qmltypes.title = QML Types
qhp.QtSensors.subprojects.qmltypes.indexTitle = Qt Sensors QML Types
-qhp.QtSensors.subprojects.qmltypes.selectors = qmlclass
+qhp.QtSensors.subprojects.qmltypes.selectors = qmltype
qhp.QtSensors.subprojects.qmltypes.sortPages = true
qhp.QtSensors.subprojects.examples.title = Examples
qhp.QtSensors.subprojects.examples.indexTitle = Qt Sensors Examples
-qhp.QtSensors.subprojects.examples.selectors = fake:example
+qhp.QtSensors.subprojects.examples.selectors = doc:example
tagfile = ../../../doc/qtsensors/qtsensors.tags
-headerdirs += .. \
- ../../imports/sensors \
- ../../plugins/sensors
-
-sourcedirs += .. \
- ../../imports/sensors \
+{headerdirs,sourcedirs} += .. \
+ ../../sensorsquick \
../../plugins/sensors
exampledirs += ../../../examples/sensors \
@@ -51,7 +43,10 @@ examplesinstallpath = sensors
imagedirs += images
-depends += qtcore qtdoc qtgui
+depends += qtcore qtdoc qtgui qtquick qtcmake
+
+# Highlighted examples
+manifestmeta.highlighted.names = "QtSensors/Sensors Showcase"
navigation.landingpage = "Qt Sensors"
navigation.cppclassespage = "Qt Sensors C++ Classes"
diff --git a/src/sensors/doc/snippets/sensorgestures/creating.cpp b/src/sensors/doc/snippets/sensorgestures/creating.cpp
deleted file mode 100644
index 78f7a737..00000000
--- a/src/sensors/doc/snippets/sensorgestures/creating.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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 <QObject>
-#include <QString>
-#include <QSensorGestureManager>
-
-class MyObject : public QObject
-{
- void create();
-public slots:
- void gestureDetected(const QString &);
-};
-
-void MyObject::create()
-{
-//! [Receiving sensor gesture signals]
-
-// Create a QSensorGestureManager
- QSensorGestureManager gestureManager;
-
-// Get a list of known recognizers
- QStringList recognizersList = gestureManager.gestureIds();
-
-// Create a QSensorGeture object for each of those gesture recognizers
- QSensorGesture *gesture = new QSensorGesture( gestureManager.gestureIds(), this);
-// Connect the known signals up.
- connect(gesture, SIGNAL(detected(QString)), this, SLOT(gestureDetected(QString)));
-//! [Receiving sensor gesture signals]
-}
-
-void MyObject::gestureDetected(const QString &gesture)
-{
- Q_UNUSED(gesture);
-}
-
diff --git a/src/sensors/doc/snippets/sensorgestures/main.cpp b/src/sensors/doc/snippets/sensorgestures/main.cpp
deleted file mode 100644
index dee1ecb6..00000000
--- a/src/sensors/doc/snippets/sensorgestures/main.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
-
-int main(int /*argc*/, char ** /*argv*/)
-{
- return 0;
-}
-
diff --git a/src/sensors/doc/snippets/sensorgestures/myplugin.h b/src/sensors/doc/snippets/sensorgestures/myplugin.h
deleted file mode 100644
index 0cf1a92b..00000000
--- a/src/sensors/doc/snippets/sensorgestures/myplugin.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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 MYPLUGIN_H
-#define MYPLUGIN_H
-
-#include <QObject>
-#include <qsensorgestureplugininterface.h>
-#include <qsensorgesturerecognizer.h>
-
-class MySensorGestureRecognizer : public QSensorGestureRecognizer
-{
- Q_OBJECT
- public:
-
- MySensorGestureRecognizer(QObject *parent = 0);
- ~MySensorGestureRecognizer();
-
- void create() override;
-
- QString id() const override;
- bool start() override;
- bool stop() override;
- bool isActive() override;
-
-Q_SIGNALS:
-// all signals will get exported to QSensorGesture
- void mySignal();
-};
-
-class MySensorGesturePlugin : public QObject, public QSensorGesturePluginInterface
-{
- Q_OBJECT
- //Q_PLUGIN_METADATA(IID "com.Nokia.QSensorGesturePluginInterface" FILE "plugin.json")
- Q_INTERFACES(QSensorGesturePluginInterface)
-public:
-
- explicit MySensorGesturePlugin();
- ~MySensorGesturePlugin();
-
- QList<QSensorGestureRecognizer *> createRecognizers() override;
- QStringList supportedIds() const override;
- QString name() const override { return "MyGestures"; }
-};
-
-#endif
diff --git a/src/sensors/doc/snippets/sensorgestures/plugin.cpp b/src/sensors/doc/snippets/sensorgestures/plugin.cpp
deleted file mode 100644
index a94a188e..00000000
--- a/src/sensors/doc/snippets/sensorgestures/plugin.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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 "myplugin.h"
-
-#include <qsensorgestureplugininterface.h>
-#include <qsensorgesturemanager.h>
-
-//! [Plugin]
-
-MySensorGestureRecognizer::MySensorGestureRecognizer(QObject *parent)
- : QSensorGestureRecognizer(parent)
-{
-}
-
-MySensorGestureRecognizer::~MySensorGestureRecognizer()
-{
-}
-
-bool MySensorGestureRecognizer::start()
-{
- Q_EMIT mySignal();
- return true;
-}
-
-bool MySensorGestureRecognizer::stop()
-{
- return true;
-}
-
-bool MySensorGestureRecognizer::isActive()
-{
- return true;
-}
-
-void MySensorGestureRecognizer::create()
-{
-}
-
-QString MySensorGestureRecognizer::id() const
-{
- return QString("QtSensors.mygestures");
-}
-
-
-MySensorGesturePlugin::MySensorGesturePlugin(){}
-MySensorGesturePlugin::~MySensorGesturePlugin(){}
-
-QList <QSensorGestureRecognizer *> MySensorGesturePlugin::createRecognizers()
-{
- QList <QSensorGestureRecognizer *> recognizers;
- MySensorGestureRecognizer *recognizer = new MySensorGestureRecognizer(this);
- recognizers.append(recognizer);
-
- return recognizers;
-}
-
-QStringList MySensorGesturePlugin::supportedIds() const
-{
- return QStringList() << "QtSensors.mygestures";
-}
-
-//! [Plugin]
diff --git a/src/sensors/doc/snippets/sensorgestures/sensorgestures.pro b/src/sensors/doc/snippets/sensorgestures/sensorgestures.pro
deleted file mode 100644
index 7442dd87..00000000
--- a/src/sensors/doc/snippets/sensorgestures/sensorgestures.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-TEMPLATE=app
-TARGET=sensorgesturessdocsnippet
-QT = core sensors
-SOURCES+=main.cpp\
- creating.cpp\
- plugin.cpp
-HEADERS+=myplugin.h
-!win32:*g++*:LIBS+=-rdynamic
diff --git a/src/sensors/doc/snippets/sensors/CMakeLists.txt b/src/sensors/doc/snippets/sensors/CMakeLists.txt
new file mode 100644
index 00000000..27480020
--- /dev/null
+++ b/src/sensors/doc/snippets/sensors/CMakeLists.txt
@@ -0,0 +1,32 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(sensorsdocsnippet LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+find_package(Qt6 COMPONENTS Core Sensors)
+
+qt_add_executable(sensorsdocsnippet
+ creating.cpp
+ main.cpp
+ mybackend.h
+ plugin.cpp
+ start.cpp
+)
+
+target_link_libraries(sensorsdocsnippet PUBLIC
+ Qt::Sensors
+)
+
+if (GCC AND UNIX)
+ target_link_libraries(sensorsdocsnippet PUBLIC
+ rdynamic
+ log
+ )
+endif()
diff --git a/src/sensors/doc/snippets/sensors/creating.cpp b/src/sensors/doc/snippets/sensors/creating.cpp
index 4a5ef06d..4c99066f 100644
--- a/src/sensors/doc/snippets/sensors/creating.cpp
+++ b/src/sensors/doc/snippets/sensors/creating.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QObject>
#include <qaccelerometer.h>
@@ -57,7 +21,7 @@ QAccelerometer *sensor = new QAccelerometer(this);
QOrientationSensor orient_sensor;
//! [Creating a sensor]
- Q_UNUSED(sensor)
+ Q_UNUSED(sensor);
Q_UNUSED(orient_sensor);
{
@@ -69,7 +33,7 @@ Q_UNUSED(magnetometer);
{
//! [3]
-QSensor *magnetometer = new QSensor(QMagnetometer::type, this);
+QSensor *magnetometer = new QSensor(QMagnetometer::sensorType, this);
//! [3]
Q_UNUSED(magnetometer);
}
diff --git a/src/sensors/doc/snippets/sensors/main.cpp b/src/sensors/doc/snippets/sensors/main.cpp
index dee1ecb6..fb6724d5 100644
--- a/src/sensors/doc/snippets/sensors/main.cpp
+++ b/src/sensors/doc/snippets/sensors/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
int main(int /*argc*/, char ** /*argv*/)
{
diff --git a/src/sensors/doc/snippets/sensors/mybackend.h b/src/sensors/doc/snippets/sensors/mybackend.h
index 59c54069..b964e747 100644
--- a/src/sensors/doc/snippets/sensors/mybackend.h
+++ b/src/sensors/doc/snippets/sensors/mybackend.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef MYBACKEND_H
#define MYBACKEND_H
diff --git a/src/sensors/doc/snippets/sensors/plugin.cpp b/src/sensors/doc/snippets/sensors/plugin.cpp
index 1eef5966..27f50d72 100644
--- a/src/sensors/doc/snippets/sensors/plugin.cpp
+++ b/src/sensors/doc/snippets/sensors/plugin.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "mybackend.h"
#include <qsensorplugin.h>
@@ -52,7 +16,7 @@ class MyPluginClass : public QObject, public QSensorPluginInterface, public QSen
public:
void registerSensors() override
{
- QSensorManager::registerBackend(QAccelerometer::type, MyBackend::id, this);
+ QSensorManager::registerBackend(QAccelerometer::sensorType, MyBackend::id, this);
}
QSensorBackend *createBackend(QSensor *sensor) override
diff --git a/src/sensors/doc/snippets/sensors/sensors.pro b/src/sensors/doc/snippets/sensors/sensors.pro
deleted file mode 100644
index 91d49772..00000000
--- a/src/sensors/doc/snippets/sensors/sensors.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-TEMPLATE=app
-TARGET=sensorsdocsnippet
-QT = core sensors
-SOURCES+=main.cpp\
- creating.cpp\
- start.cpp\
- plugin.cpp
-HEADERS+=mybackend.h
-!win32:*g++*:LIBS+=-rdynamic
-OTHER_FILES += *.qml
diff --git a/src/sensors/doc/snippets/sensors/start.cpp b/src/sensors/doc/snippets/sensors/start.cpp
index 3ac5b50e..18c87d06 100644
--- a/src/sensors/doc/snippets/sensors/start.cpp
+++ b/src/sensors/doc/snippets/sensors/start.cpp
@@ -1,43 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-#include <qsensor.h>
+#include <QtSensors/qsensor.h>
+#include <QtCore/QMetaObject>
+#include <QtCore/QMetaproperty>
void start()
{
@@ -52,6 +18,42 @@ qreal x = reading->property("x").value<qreal>();
qreal y = reading->value(1).value<qreal>();
//! [Starting a sensor]
- Q_UNUSED(x)
- Q_UNUSED(y)
+ Q_UNUSED(x);
+ Q_UNUSED(y);
}
+
+class MyObject : public QObject
+{
+ void findSensors()
+ {
+ //! [Find sensors]
+ QList<QSensor*> mySensorList;
+ for (const QByteArray &type : QSensor::sensorTypes()) {
+ qDebug() << "Found a sensor type:" << type;
+ for (const QByteArray &identifier : QSensor::sensorsForType(type)) {
+ qDebug() << " " << "Found a sensor of that type:" << identifier;
+ QSensor* sensor = new QSensor(type, this);
+ sensor->setIdentifier(identifier);
+ mySensorList.append(sensor);
+ }
+ }
+ //! [Find sensors]
+ //! [Print reading properties]
+ for (QSensor* sensor : mySensorList) {
+ const int firstProperty = QSensorReading::staticMetaObject.propertyOffset();
+ // Connect to backend first in case start() hasn't been called yet
+ if (!sensor->connectToBackend())
+ continue;
+ qDebug() << "Sensor" << sensor->identifier() << "reading properties:";
+ QSensorReading *reading = sensor->reading();
+ if (reading) {
+ const QMetaObject *mo = reading->metaObject();
+ for (int i = firstProperty; i < mo->propertyCount(); ++i) {
+ QByteArray name = mo->property(i).name();
+ qDebug() << " " << name << reading->property(name).toByteArray();
+ }
+ }
+ }
+ //! [Print reading properties]
+ }
+};
diff --git a/src/sensors/doc/snippets/sensors/tutorial.cpp b/src/sensors/doc/snippets/sensors/tutorial.cpp
new file mode 100644
index 00000000..e8714961
--- /dev/null
+++ b/src/sensors/doc/snippets/sensors/tutorial.cpp
@@ -0,0 +1,25 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+//! [MySensor]
+class MyReadingPrivate;
+
+class MyReading : public QSensorReading
+ {
+ Q_OBJECT
+ Q_PROPERTY(qreal myprop READ myprop)
+ DECLARE_READING(MyReading)
+public:
+ qreal myprop() const;
+ void setMyprop(qreal myprop);
+ };
+
+class MySensor : public QSensor
+{
+ Q_OBJECT
+public:
+ explicit MySensor(QObject *parent = 0);
+ MyReading *reading() const;
+ static char const * const sensorType;
+ };
+//! [MySensor]
diff --git a/src/sensors/doc/snippets/snippets.pro b/src/sensors/doc/snippets/snippets.pro
deleted file mode 100644
index f73d4a35..00000000
--- a/src/sensors/doc/snippets/snippets.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += sensors
-SUBDIRS += sensorgestures
-
diff --git a/src/sensors/doc/src/compatmap.qdoc b/src/sensors/doc/src/compatmap.qdoc
index 6db9f708..41f91a73 100644
--- a/src/sensors/doc/src/compatmap.qdoc
+++ b/src/sensors/doc/src/compatmap.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Research In Motion
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Research In Motion
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\page compatmap.html
@@ -40,11 +16,11 @@
</tr>
<tr>
<td bgcolor="green"></td>
- <td>The feature is fully supported.</td>
+ <td>The sensor is supported.</td>
</tr>
<tr>
<td bgcolor="gray"></td>
- <td>The feature is not supported.</td>
+ <td>The sensor is not supported.</td>
</tr>
</tbody>
</table>
@@ -56,29 +32,15 @@
<td><b>Android</b></td>
<td><b>Linux</b></td>
<td><b>iOS</b></td>
- <td><b>Universal Windows Platform</b></td>
+ <td><b>Windows</b></td>
<td><b>Generic</b></td>
- <td><b>Sensorfw</b></td>
- <td><b>TI Sensor Tag</b></td>
</tr>
<tr>
<td nowrap="nowrap">Accelerometer</td>
<td bgcolor="green"></td>
- <td bgcolor="green"></td>
- <td bgcolor="green"></td>
- <td bgcolor="green"></td>
<td bgcolor="gray"></td>
<td bgcolor="green"></td>
<td bgcolor="green"></td>
- </tr>
- <tr>
- <td nowrap="nowrap">Altimeter</td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
<td bgcolor="gray"></td>
</tr>
<tr>
@@ -88,8 +50,6 @@
<td bgcolor="gray"></td>
<td bgcolor="green"></td>
<td bgcolor="green"></td>
- <td bgcolor="green"></td>
- <td bgcolor="green"></td>
</tr>
<tr>
<td nowrap="nowrap">Ambient Temperature Sensor</td>
@@ -98,8 +58,6 @@
<td bgcolor="gray"></td>
<td bgcolor="gray"></td>
<td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="green"></td>
</tr>
<tr>
<td nowrap="nowrap">Compass</td>
@@ -108,18 +66,6 @@
<td bgcolor="green"></td>
<td bgcolor="green"></td>
<td bgcolor="gray"></td>
- <td bgcolor="green"></td>
- <td bgcolor="gray"></td>
- </tr>
- <tr>
- <td nowrap="nowrap">Distance</td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
</tr>
<tr>
<td nowrap="nowrap">Gyroscope</td>
@@ -128,48 +74,6 @@
<td bgcolor="green"></td>
<td bgcolor="green"></td>
<td bgcolor="gray"></td>
- <td bgcolor="green"></td>
- <td bgcolor="green"></td>
- </tr>
- <tr>
- <td nowrap="nowrap">Holster Sensor</td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- </tr>
- <tr>
- <td nowrap="nowrap">Humidity Sensor</td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="green"></td>
- </tr>
- <tr>
- <td nowrap="nowrap">IR Proximity Sensor</td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="green"></td>
- <td bgcolor="gray"></td>
- </tr>
- <tr>
- <td nowrap="nowrap">Lid Sensor</td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="green"></td>
- <td bgcolor="gray"></td>
</tr>
<tr>
<td nowrap="nowrap">Light Sensor</td>
@@ -178,8 +82,6 @@
<td bgcolor="gray"></td>
<td bgcolor="gray"></td>
<td bgcolor="gray"></td>
- <td bgcolor="green"></td>
- <td bgcolor="green"></td>
</tr>
<tr>
<td nowrap="nowrap">Magnetometer</td>
@@ -188,8 +90,6 @@
<td bgcolor="green"></td>
<td bgcolor="gray"></td>
<td bgcolor="gray"></td>
- <td bgcolor="green"></td>
- <td bgcolor="green"></td>
</tr>
<tr>
<td nowrap="nowrap">Orientation Sensor</td>
@@ -198,18 +98,14 @@
<td bgcolor="green"></td>
<td bgcolor="green"></td>
<td bgcolor="green"></td>
- <td bgcolor="green"></td>
- <td bgcolor="gray"></td>
</tr>
<tr>
<td nowrap="nowrap">Pressure Sensor</td>
<td bgcolor="green"></td>
<td bgcolor="gray"></td>
+ <td bgcolor="green"></td>
<td bgcolor="gray"></td>
<td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="green"></td>
</tr>
<tr>
<td nowrap="nowrap">Proximity Sensor</td>
@@ -218,8 +114,6 @@
<td bgcolor="green"></td>
<td bgcolor="gray"></td>
<td bgcolor="gray"></td>
- <td bgcolor="green"></td>
- <td bgcolor="gray"></td>
</tr>
<tr>
<td nowrap="nowrap">Rotation Sensor</td>
@@ -228,18 +122,6 @@
<td bgcolor="green"></td>
<td bgcolor="green"></td>
<td bgcolor="green"></td>
- <td bgcolor="green"></td>
- <td bgcolor="gray"></td>
- </tr>
- <tr>
- <td nowrap="nowrap">Tap Sensor</td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
</tr>
<tr>
<td nowrap="nowrap">Tilt Sensor</td>
@@ -248,30 +130,149 @@
<td bgcolor="green"></td>
<td bgcolor="gray"></td>
<td bgcolor="green"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- </tr>
- <tr>
- <td nowrap="nowrap">Sensor Gestures</td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="gray"></td>
- <td bgcolor="green"></td>
- <td bgcolor="gray"></td>
</tr>
+ </tbody>
</table>
\endraw
- 1) Support depends on the underlying platform
+ \raw DocBook
+<db:informaltable cellpadding="2" cellspacing="1" border="1" width="90%">
+ <db:tbody>
+ <db:tr>
+ <db:td>Color</db:td>
+ <db:td>Explanation</db:td>
+ </db:tr>
+ <db:tr>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td>The sensor is supported.</db:td>
+ </db:tr>
+ <db:tr>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td>The sensor is not supported.</db:td>
+ </db:tr>
+ </db:tbody>
+ </db:informaltable>
+
+
+ <db:informaltable cellpadding="2" cellspacing="1" border="1" rules="all" width="90%">
+ <db:tbody>
+ <db:tr>
+ <db:td><db:emphasis role="bold">Feature</db:emphasis></db:td>
+ <db:td><db:emphasis role="bold">Android</db:emphasis></db:td>
+ <db:td><db:emphasis role="bold">Linux</db:emphasis></db:td>
+ <db:td><db:emphasis role="bold">iOS</db:emphasis></db:td>
+ <db:td><db:emphasis role="bold">Windows</db:emphasis></db:td>
+ <db:td><db:emphasis role="bold">Generic</db:emphasis></db:td>
+ </db:tr>
+ <db:tr>
+ <db:td>Accelerometer</db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ </db:tr>
+ <db:tr>
+ <db:td>Ambient Light Sensor</db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ </db:tr>
+ <db:tr>
+ <db:td>Ambient Temperature Sensor</db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ </db:tr>
+ <db:tr>
+ <db:td>Compass</db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ </db:tr>
+ <db:tr>
+ <db:td>Gyroscope</db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ </db:tr>
+ <db:tr>
+ <db:td>Light Sensor</db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ </db:tr>
+ <db:tr>
+ <db:td>Magnetometer</db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ </db:tr>
+ <db:tr>
+ <db:td>Orientation Sensor</db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ </db:tr>
+ <db:tr>
+ <db:td>Pressure Sensor</db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ </db:tr>
+ <db:tr>
+ <db:td>Proximity Sensor</db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ </db:tr>
+ <db:tr>
+ <db:td>Rotation Sensor</db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ </db:tr>
+ <db:tr>
+ <db:td>Tilt Sensor</db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ </db:tr>
+ </db:tbody>
+ </db:informaltable>
+ \endraw
In addition to the table above, each sensor type might support specific features. For example,
a magnetometer might support returning geo values. See QSensor::isFeatureSupported() for
additional details.
- Sensor Gestures are mostly platform independent, and will run if the platform has the sensors required.
- Whether they are supported and work well or not depends on the platform.
-*/
+ \section1 Platform specific notes
+ \section2 Windows
+
+ The Windows backend is supported in Qt installations that were built with MSVC.
+
+*/
diff --git a/src/sensors/doc/src/genericbackend.qdoc b/src/sensors/doc/src/genericbackend.qdoc
index 001fce77..2c314e6d 100644
--- a/src/sensors/doc/src/genericbackend.qdoc
+++ b/src/sensors/doc/src/genericbackend.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Research In Motion
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Research In Motion
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\page genericbackend.html
diff --git a/src/sensors/doc/src/porting.qdoc b/src/sensors/doc/src/porting.qdoc
deleted file mode 100644
index 6f5d7ea4..00000000
--- a/src/sensors/doc/src/porting.qdoc
+++ /dev/null
@@ -1,126 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \page qtsensors-porting.html
- \title Porting Applications from QtMobility Sensors to Qt Sensors
- \brief Explain how to port from QtMobility Sensors to Qt Sensors
- \since Qt 5.1
-
- \tableofcontents
-
- \section1 Overview
-
- The initial release of Qt Sensors (5.0) is generally expected to be source
- compatible with QtMobility Sensors 1.2. This document attempts to explain
- where things need to be changed in order to port applications to Qt Sensors.
-
- \section1 QML
-
- In \c QtMobility, the C++ classes like \c QAccelerometer were directly used as QML types.
- In Qt Sensors, there are now separate classes for the QML types, which have no public
- C++ API.
-
- The new QML types in Qt Sensors fix some issues the former QtMobility QML types had,
- for example:
- \list
- \li The reading types now have proper change notifications.
- \li \c availableDataRates and \c outputRanges of the \c Sensor type are now proper list types.
- \li The \c identifier and \c type properties of \c Sensor can now be used.
- \li The \c lux property of \c LightSensorReading has been renamed to \c illuminance.
- \li The \c QmlSensors singleton now allows to query for sensor types.
- \endlist
-
- For more information, see the \l {Qt Sensors QML Types}{QML API} documentation.
-
- \section1 C++
-
- The C++ API mainly remained the same as in QtMobility.
-
- \section2 Includes
-
- QtMobility Sensors installed headers into a \c Qt Sensors directory. This is
- also the directory that Qt Sensors uses. It is therefore expected that includes
- that worked with QtMobility Sensors should continue to work.
-
- For example:
- \code
- #include <QAccelerometer>
- #include <qaccelerometer.h>
- #include <QtSensors/QAccelerometer>
- #include <QtSensors/qaccelerometer.h>
- \endcode
-
- \section2 Macros and Namespace
-
- QtMobility Sensors was built in a \c QtMobility namespace. This was enabled by
- the use of various macros. Qt Sensors does not normally build into a namespace
- and the macros from QtMobility no longer exist.
-
- \list
- \li QTM_BEGIN_NAMESPACE
- \li QTM_END_NAMESPACE
- \li QTM_USE_NAMESPACE
- \li QTM_PREPEND_NAMESPACE(x)
- \endlist
-
- Note that Qt can be configured to build into a namespace. If Qt is built in this
- way then Qt Sensors is also built into the nominated namespace. However, as this
- is optional, the macros for this are typically defined to do nothing.
-
- \list
- \li QT_BEGIN_NAMESPACE
- \li QT_END_NAMESPACE
- \li QT_USE_NAMESPACE
- \li QT_PREPEND_NAMESPACE(x)
- \endlist
-
- \section2 qtimestamp
-
- qtimestamp was previously defined as an opaque type equivalent to a quint64. It existed
- as a class due to an implementation detail.
-
- In Qt Sensors, the API uses quint64 instead of qtimestamp. qtimestamp still exists as a
- typedef so that applications that refer to qtimestamp can be compiled.
-
- \section1 Project Files
-
- QtMobility Sensors applications used this in their project files to enable the Sensors API.
-
- \code
- CONFIG += mobility
- MOBILITY += sensors
- \endcode
-
- Applications should remove these lines and instead use the following statement to enable
- the Qt Sensors API:
-
- \code
- QT += sensors
- \endcode
-*/
-
diff --git a/src/sensors/doc/src/qt6-changes.qdoc b/src/sensors/doc/src/qt6-changes.qdoc
new file mode 100644
index 00000000..de4f682b
--- /dev/null
+++ b/src/sensors/doc/src/qt6-changes.qdoc
@@ -0,0 +1,94 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ \page qtsensors-changes-qt6.html
+ \title Changes to Qt Sensors
+ \ingroup changes-qt-5-to-6
+ \brief Migrate Qt Sensors to Qt 6.
+
+ Qt 6 is a result of the conscious effort to make the framework more
+ efficient and easy to use.
+
+ We try to maintain binary and source compatibility for all the public
+ APIs in each release. But some changes were inevitable in an effort to
+ make Qt a better framework.
+
+ In this topic we summarize those changes in Qt Sensors, and provide
+ guidance to handle them.
+
+ \section1 Sensor Gesture support
+
+ The Gesture support has been removed. In its current shape the gestures
+ needs rethinking to be of more use for the developers. To track this please
+ see \l {https://bugreports.qt.io/browse/QTBUG-95649}{QTBUG-95649}.
+
+ \section1 Platform notes
+
+ \section2 Windows
+
+ On Windows, sensors are supported in Qt installations that were built with MSVC.
+
+ \section2 sensorfw
+
+ The \l {https://git.sailfishos.org/mer-core/sensorfw}{sensorfw} does not yet have
+ a Qt 6 port and is therefore not yet supported by sensors in Qt 6.
+
+ \section2 TI Sensor Tag
+
+ Support for TI Sensor Tag has been removed.
+
+ \section2 Removed sensors
+
+ QAltimeter, QDistanceSensor, QHolsterSensor and their QML counterparts
+ did no longer have a backend implementation and have been removed.
+
+ QIRProximitySensor, QLidSensor, and QTapSensor have only sensorfw
+ backend, and as such they are not currently listed as supported sensor
+ types.
+
+ \section2 Linux
+
+ The Linux sysfs accelerometer support has been removed. The backend is
+ undocumented and has been without any real activity for almost 10 years.
+
+ \section1 API changes
+
+ \section2 Deleted typedef for qtimestamp
+
+ The typedef for the historical, QtMobility-era, \c qtimestamp has been
+ removed. Use the actual type \c quint64 directly.
+
+ \section2 Renamed \c sensor type string to \c sensorType
+
+ The subclasses of QSensor implement a \c {char const*} string which defines
+ the string that identifies the base sensor. This static \c type field
+ shadowed the baseclass \l QSensor::type() method, leading to unnecessary
+ compilation errors and consequent workarounds. The \c type string has been
+ now renamed as \c sensorType.
+
+ \section2 Renamed LidReading::backLidChanged property to \c backLidClosed
+
+ The property name is now aligned with the \c frontLidClosed property of
+ the same QML type.
+
+ \section2 Added parameter to QSensorBackend::sensorBusy() to be able to also clear
+ the busy state
+
+ The \c QSensor::busy property and its accessor, \c QSensor::isBusy(), can be used
+ to check if the sensor is busy or not. To allow this property to better reflect the
+ sensor backend's state, QSensorBackend::sensorBusy() now accepts a boolean parameter.
+ This \c busy parameter is used to set/unset the backend busy state and notify the
+ QSensor interface attached to it.
+
+ The default value for the QSensorBackend::sensorBusy() parameter is \e true which
+ results in the original behavior (except the added signal emission). This means
+ that in most if not all cases the changes are not mandatory. Instead it is up to the
+ individual sensor backend implementations to decide if the changes are useful.
+
+ \section2 Sensor::type and and QSensor::type properties marked as constant
+
+ The \c type property cannot change after instantiation and is marked as constant
+ in both C++ and QML.
+
+*/
diff --git a/src/sensors/doc/src/qtsensorgestures-cpp.qdoc b/src/sensors/doc/src/qtsensorgestures-cpp.qdoc
deleted file mode 100644
index 164ffafb..00000000
--- a/src/sensors/doc/src/qtsensorgestures-cpp.qdoc
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\page qtsensorgestures-cpp.html
-\title Sensor Gestures C++ Overview
-\brief Explains how to use the QtSensorGestures C++ API
-
-\tableofcontents
-
-\section1 Using QtSensorGestures
-
-With the Sensor Gestures classes, you are able to easily utilize device gesturing using
-sensors, such as the accelerometer and proximity.
-
-A list of currently supported sensor gestures and their descriptions can be found here:
-\l {Qt Sensor Gestures}
-
-Using \c QtSensorGestures is easy. There are two main classes you will need to use:
-
-\list
- \li QSensorGestureManager: can be used for determining which sensor gestures are available.
- \li QSensorGesture : for connecting the sensor gesture signals.
-\endlist
-
-\snippet sensorgestures/creating.cpp Receiving sensor gesture signals
-
-More information about the sensor gesture recognizers can be found in
-\l{QtSensorGestures Plugins}.
-
-\section1 Main Classes
-
-The primary classes that make up the QtSensorGestures API:
-
-\annotatedlist sensorgestures_main
-
-The primary classes that make up the \c QtSensorGesturesRecognizers API:
-
-\annotatedlist sensorgestures_recognizer
-
-Details of the \c QSensorGesturePlugins available
-
-\annotatedlist sensorgesture_plugins_topics
-
-*/
-
diff --git a/src/sensors/doc/src/qtsensorgestures-emulator.qdoc b/src/sensors/doc/src/qtsensorgestures-emulator.qdoc
deleted file mode 100644
index 0c8bc659..00000000
--- a/src/sensors/doc/src/qtsensorgestures-emulator.qdoc
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-/*!
-\group sensorgesture_emulator_topics
-\title QtSensorGestures Emulator
-\brief Explains how to develop clients and recognizer plugins using QtSensorGestures
-
-\section1 Overview
-
-The Emulator can be used for both creating client apps using Qt's built-in sensor gestures,
-and for creating customized recognizers.
-
-\section1 Developing Sensor Gesture Clients
-
-For instance, the Emulator can be used for writing a client app that needs
-to use the "slam" gesture.
-
-Under the "Sensors" heading in the Emulator control, you will see an edit
-box for "Sensor gestures" that will contain a list of signals available
-when your client instantiates a QSensorGesture.
-
-Select "slam", and then click the "Send" button
-to send a detected("slam") signal to the client.
-
-*/
diff --git a/src/sensors/doc/src/qtsensorgestures-plugins.qdoc b/src/sensors/doc/src/qtsensorgestures-plugins.qdoc
deleted file mode 100644
index b181c16b..00000000
--- a/src/sensors/doc/src/qtsensorgestures-plugins.qdoc
+++ /dev/null
@@ -1,167 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\group sensorgesture_plugins_topics
-\title QtSensorGestures Plugins
-\brief Explains how to develop recognizer plugins with QtSensorGestures
-
-The QtSensorGestures recognizer plugins are the way to create your own
-sensor gestures.
-
-Creating software to recognize motion gestures using sensors is a huge subject not covered here.
-
-The QSensorGesture API does not limit usage to any of the common classification methods of gesture
-recognition, such as Hidden Markov Models, Neural Networks, Dynamic Time Warping, or even the
-ad-hoc heuristic recognizers of Qt's built-in sensor gesture recognizers. It's basically a
-signaling system for lower level gesture recogition methods and algorithms to communicate to the
-higher level applications.
-
-\tableofcontents
-
-\section1 Overview
-
- The steps for creating a sensor gesture plugin are as follows:
-\list
-\li Sub-class from QSensorGesturePluginInterface
-\li Sub-class from QSensorGestureRecognizer and implement gesture recognizer logic using QtSensors.
-\li Create an instance of that recognizer in the derived QSensorGesturePluginInterface class, and call
- QSensorGestureManager::registerSensorGestureRecognizer(sRec); in your registerRecognizers()
-function. QSensorGestureManager will retain ownership of the recognizer object.
-
-This is the class in which the gesture recognizer system should be implemented from.
-
-\endlist
-
-\snippet sensorgestures/plugin.cpp Plugin
-
-
-\section2 Recognizer Classes
-
-If you are making sensorgestures available through the QtSensorGestures API, these are the
-classes to subclass.
-
-\annotatedlist sensorgestures_recognizer
-
-\target Qt Sensor Gestures
-\section3 Recognizer Plugins
-
-The Sensor Gesture Recognizers that come with Qt are made using an ad-hoc heuristic approach.
-The user cannot define their own gestures, and must learn how to perform and accommodate the
-pre-defined gestures herein.
-
-A developer may use any method, including computationally- and training-intensive well-
-known classifiers, to produce gesture recognizers. There are currently no classes in Qt for
-gesture training, nor is it possible for the user to define his own sensor-based motion gestures.
-
-A procedure for writing ad-hoc recognizers might include:
-\list
- \li Obtain and gather output from the accelerometer through \c QAccelerometerReading of a gesture being performed.
- \li Use various methods and constraints on the accelerometer data to recognize the various states:
- \list i
- \li Initial "listening" state for a gesture
- \li Start of a possible gesture, moving into a "detecting" state
- \li End of a possible gesture, moving into a "recognizing" state
- \li and finally, if it is recognized, the "recognized" state, or if not recognized, move back to
- the "listening" state.
- \endlist
- \li Test procedure to make sure it is easy to perform, and will not
- produce too many false positive recognitions, or collisions if used with other gestures. Meaning
-that gestures performed get recognized as another gesture instead.
-
-\endlist
-
-Below you will find a list of included plugins and their signals.
-
-For the ShakeGestures plugin:
- \table
- \row
- \li Recognizer Id
- \li Signals
- \row
- \li QtSensors.shake
- \li shake
-\endtable
-
-For the QtSensorGestures plugin:
- \table
- \row
- \li Recognizer Id
- \li Signals
- \li Description
- \li Images
- \row
- \li QtSensors.cover
- \li cover
- \li Hand covers up phone display for one second, when it's face up, using the Proximity and Orientation sensors.
- \li \image sensorgesture-cover.png
- \row
- \li QtSensors.doubletap
- \li doubletap
- \li Double tap of finger on phone, using the DoubleTap sensor.
- \li \image sensorgesture-doubletap.png
- \row
- \li QtSensors.hover
- \li hover
- \li Hand hovers about 4 cm above the phone for more than 1 second, then is removed when face up,
- using the IR Proximity sensor.
- \li \image sensorgesture-hover.png
- \row
- \li QtSensors.pickup
- \li pickup
- \li Phone is resting face up on a flat curface, and is then picked up and brought up into viewing position. Uses the Accelerometer sensor.
- \li \image sensorgesture-faceup.png
- \row
- \li QtSensors.shake2
- \li shakeLeft, shakeRight, shakeUp, shakeDown
- \li Shake phone in a certain direction, using the Accelerometer sensor.
- \li \image sensorgesture-shake.png
- \row
- \li QtSensors.slam
- \li slam
- \li Phone is held in a top up position with a side facing forward for a moment. Swing it quickly with a downward motion
- like it is being used to point at something with the top corner. Uses the Accelerometer and Orientation sensors.
- \li \image sensorgesture-slam_1.png
- \image sensorgesture-slam_2.png
- \row
- \li QtSensors.turnover
- \li turnover
- \li Phone is turned face down and placed on a surface, using Proximity and Orientation sensors.
- \li \image sensorgesture-facedown.png
- \row
- \li QtSensors.twist
- \li twistLeft, twistRight
- \li Phone is held face up and then twisted left or right (left side up or right side up) and back, using the Accelerometer and Orientation sensors.
- \li \image sensorgesture-twist.png
- \row
- \li QtSensors.whip
- \li whip
- \li Move phone quickly down and then back up. Uses the Accelerometer and Orientation sensors.
- \li \image sensorgesture-whip.png
- \endtable
-
-*/
diff --git a/src/sensors/doc/src/qtsensors-backend.qdoc b/src/sensors/doc/src/qtsensors-backend.qdoc
index 7e62186d..35945f61 100644
--- a/src/sensors/doc/src/qtsensors-backend.qdoc
+++ b/src/sensors/doc/src/qtsensors-backend.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\page sensors-backend-topics.html
@@ -89,9 +65,9 @@ An example follows.
Sensors was designed so that multiple sensors could exist for a given type. Why?
Consider this example.
-The N900 has an accelerometer built-in. It also features bluetooth and can pair
-with a gaming controller that features an accelerometer. To a developer writing
-a game these two devices are conceptually the same type.
+An Android device has an accelerometer built-in. It also features bluetooth and
+can pair with a gaming controller that features an accelerometer. To a developer
+writing a game these two devices are conceptually the same type.
\section1 Default Sensor for a Type
@@ -109,21 +85,28 @@ instead.
\section1 Sensors.conf
-The config file that determines the default sensor for a type is called Sensors.conf.
-If present, it is located in /etc/xdg/QtProject. It has the standard formatting
-of an ini file.
+The config file that determines the default sensor for a type is called
+\e Sensors.conf. The configuration file is looked for from \e QtProject
+directory under the directories given by
+QStandardPaths::standardLocations(QStandardPaths::ConfigLocation).
+An example of a complete file path is:
+\badcode
+/etc/xdg/QtProject/Sensors.conf
+\endcode
+The first found configuration file is used.
+The configuration file has the standard formatting of an ini file.
The settings live in the Default group and the general format is:
\code
type = identifier
\endcode
-An example: Sensors.conf ensures that the N900 accelerometer is used by default,
-not considering the order in which backends were registered.
+An example: Sensors.conf ensures that the \e sensorfw accelerometer is used by
+default, ignoring the order in which backends were registered.
\code
[Default]
-QAccelerometer = n900.accelerometer
+QAccelerometer=sensorfw.accelerometer
\endcode
If Sensors.conf specifies an identifier that is not registered, the system will
diff --git a/src/sensors/doc/src/qtsensors-cpp.qdoc b/src/sensors/doc/src/qtsensors-cpp.qdoc
index d732a0dd..b70f8276 100644
--- a/src/sensors/doc/src/qtsensors-cpp.qdoc
+++ b/src/sensors/doc/src/qtsensors-cpp.qdoc
@@ -1,34 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\page qtsensors-cpp.html
\title Qt Sensors C++ Overview
\brief Explains how to use the Qt Sensors C++ API.
+\ingroup explanation
\tableofcontents
@@ -103,8 +80,18 @@ This code does not require any compile-time links to \l QAccelerometer or
\snippet sensors/start.cpp Starting a sensor
-You can discover all of this information at runtime too. The sensor_explorer example
-shows you information about available sensors.
+You can discover all of this information at runtime too.
+
+\section1 Discovering Sensors And Reading Properties At Runtime
+
+Sometimes it may be that the available sensors are not known at development time.
+It is possible to find out which sensors are available as illustrated below:
+
+\snippet sensors/start.cpp Find sensors
+
+Furthermore it is possible to discover the reading details for these sensors, as illustrated below:
+
+\snippet sensors/start.cpp Print reading properties
\section1 Front End, Back End
diff --git a/src/sensors/doc/src/qtsensors-modules.qdoc b/src/sensors/doc/src/qtsensors-modules.qdoc
new file mode 100644
index 00000000..7a4d29ba
--- /dev/null
+++ b/src/sensors/doc/src/qtsensors-modules.qdoc
@@ -0,0 +1,58 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+
+/*!
+ \module QtSensors
+ \title Qt Sensors C++ Classes
+ \qtcmakepackage Sensors
+ \ingroup modules
+ \qtvariable sensors
+
+ \brief Provides classes for reading sensor data.
+
+ Mobile devices contain sensor hardware that allow detecting changes in various physical
+ properties of the device itself or its immediate environment. Examples of device properties
+ include the angle at which the device is held, whereas environmental properties include for
+ example the current level of ambient light.
+*/
+
+/*!
+ \qmlmodule QtSensors
+ \title Qt Sensors QML Types
+ \ingroup qmlmodules
+
+ \brief Provides QML types for reading sensor data.
+
+ \section1 QML Sensors Module API
+
+ QmlSensors is a module API that provides information about currently
+ available sensors types, identifiers, and the default sensors.
+
+ \qml
+ import QtSensors
+ // ...
+ Component.onCompleted: {
+ var types = QmlSensors.sensorTypes();
+ console.log(types.join(", "));
+ }
+ \endqml
+
+ The documentation for the module API can be found in QmlSensors.
+
+ \section1 QML Sensor Types
+
+ These types represent specific types of sensors.
+
+ Note that most properties come from the abstract \l{Sensor}{Sensor} element.
+
+ \annotatedlist qml-sensors_type
+
+ \section1 QML Reading Types
+
+ The data from a sensor comes via a reading class.
+
+ \annotatedlist qml-sensors_reading
+
+ \section1 All QML Types
+*/
diff --git a/src/sensors/doc/src/qtsensors-tutorial.qdoc b/src/sensors/doc/src/qtsensors-tutorial.qdoc
new file mode 100644
index 00000000..147b8504
--- /dev/null
+++ b/src/sensors/doc/src/qtsensors-tutorial.qdoc
@@ -0,0 +1,36 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ \page qtsensors-tutorial.html
+ \title How to create your own Sensor
+ \brief Steps for creating your own sensors
+
+ The Qt Sensors module provides access to sensor hardware via QML and C++
+ interfaces.
+
+ The API is supported on \l{Qt for Android}{Android}, \l{Qt for iOS}{iOS}, and
+ \l {Qt for Windows}{Windows (MSVC)}.
+
+ \section1 Creating your own sensor using C++ API
+
+ Using a Qt module's C++ API requires linking against the module library, either
+ directly or through other dependencies.
+ \section2 Creating a sensor
+
+ To create your own sensor you can use the following steps:
+
+ \list
+ \li Create your own MySensor and MySensorReading classes
+ \snippet sensors/tutorial.cpp MySensor
+ \li Create a MySensorBackend by inheriting from QSensorBackend
+ \li Create MySensorBackendFactory factory class for instantiating that
+ backend by inheriting a class QSensorBackendFactory
+ \li Register the backend factory by calling
+ QSensorManager::registerBackend ("MySensorType", "MySensorId", &myfactory)
+ \li Instantiate the new MySensor and start using it
+ \endlist
+
+ As an another option the sensors are put into a \l {Creating a sensor plugin}
+ that you can use on demand.
+*/
diff --git a/src/sensors/doc/src/qtsensors.qdoc b/src/sensors/doc/src/qtsensors.qdoc
index 782eef75..c25349fd 100644
--- a/src/sensors/doc/src/qtsensors.qdoc
+++ b/src/sensors/doc/src/qtsensors.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\page qtsensors-index.html
@@ -31,93 +7,67 @@
\brief Provides access to sensors via QML and C++ interfaces.
\since 5.1
- The Qt Sensors API provides access to sensor hardware via QML and C++ interfaces.
- The Qt Sensors API also provides a motion gesture recognition API for devices.
-
- Currently the API is supported on \l{Qt for Android}{Android},
- \l{Qt for iOS}{iOS}, \l{https://sailfishos.org}{SailFish}, and
- \l{Qt for UWP}{Universal Windows Platform (UWP)}.
-
- \section1 Information for Application Writers
-
- Applications can access Qt Sensors using QML or C++.
-
- \table
- \row
- \li \l {Qt Sensors QML Types}{QML Types}
- \li Information about the Qt Sensors QML API
- \row
- \li \l {Qt Sensors C++ Classes}{C++ Classes}
- \li Information about the Qt Sensors C++ API
- \row
- \li \l{Qt Sensors C++ Overview}
- \li High-level information on how to use the C++ API.
- \row
- \li \l {Sensor Gestures C++ Overview}
- \li High-level information specific to sensor gestures
- \row
- \li \l {Qt Sensors Examples}{Examples}
- \li Examples demonstrating the use of the Qt Sensors APIs
- \endtable
-
- \section1 Information for Backend Implementors
-
- \table
- \row
- \li \l {Qt Sensors Backend}{Backend}
- \li Information about the Qt Sensors back end
- \row
- \li \l {Qt Sensors - Grue Sensor Example}
- \li The Qt Sensors - Grue Sensor Example demonstrates creation of a sensor backend
- \endtable
-
- \section1 Compatibility with QtMobility Sensors API
-
- Qt Sensors 5.0 (the initial release) is generally expected to be source compatible
- with QtMobility Sensors 1.2.
-
- \table
- \row
- \li \l {Porting Applications from QtMobility Sensors to Qt Sensors}{Porting Guide}
- \li Information about the steps needed to port applications to the Qt Sensors API.
- \endtable
-
- \omit
- \section1 Information for Qt SensorGestures API
-
- Qt SensorGestures provides a motion gesture recognition API for devices.
-
- \table
- \row
- \li \l {SensorGesture}{QML API}
- \li Information about the Qt SensorGestures QML API
- \row
- \li \l {QtSensorGestures C++ API}{C++ API}
- \li Information about the Qt SensorGestures C++ API
- \endtable
-
- \section1 Information for Qt SensorGestures Recognizer Plugin Implementors
-
- \table
- \row
- \li \l {QtSensorGestures Plugins}{Plugins}
- \li Information about the Qt SensorGestures recognizer plugins.
- \row
- \li \l {QtSensorGestures Emulator}{Emulator}
- \li Information about Qt SensorGestures use in the Emulator.
- \endtable
- \endomit
-
- \section1 Platform-specific Information
- \table
- \row
- \li \l {Compatibility Map}{Compatibility Map}
- \li Compatibility map of all supported platforms.
- \row
- \li \l {Generic Backend}{Generic Backend}
- \li Information about the generic sensor backend.
- \row
- \li \l {Sensorfw Backend}{Sensorfw Backend}
- \li Information about the Sensorfw sensor backend.
- \endtable
+ The Qt Sensors module provides access to sensor hardware via QML and C++
+ interfaces.
+
+ Currently, the API is supported on \l{Qt for Android}{Android},
+ \l{Qt for iOS}{iOS}, and \l {Qt for Windows}{Windows (MSVC)}.
+
+ \section1 Using the Module
+
+ \section2 QML API
+
+ \include {module-use.qdocinc} {using the qml api} {QtSensors}
+
+ \section2 C++ API
+
+ \include {module-use.qdocinc} {using the c++ api}
+
+ \section3 Building with CMake
+
+ \include {module-use.qdocinc} {building with cmake} {Sensors}
+
+ \section3 Building with qmake
+
+ \include {module-use.qdocinc} {building_with_qmake} {sensors}
+
+ \section1 Articles and Guides
+
+ \list
+ \li \l {Qt Sensors C++ Overview}
+ \li \l {Generic Backend} {Generic Backend}
+ \li \l {Qt Sensors Backend}
+ \li \l {Compatibility Map} {Compatibility Map}
+ \li \l {How to create your own Sensor}
+ \endlist
+
+ \section1 Examples
+
+ \list
+ \li \l {Qt Sensors Examples} {Examples}
+ \endlist
+
+ \section1 API Reference
+
+ \list
+ \li \l {Qt Sensors QML Types} {QML Types}
+ \li \l {Qt Sensors C++ Classes} {C++ Classes}
+ \endlist
+
+ \section1 Module Evolution
+ \l{Changes to Qt Sensors} lists important changes in the module API
+ and functionality that were made for the Qt 6 series of Qt.
+
+ \section1 Licenses and Attributions
+
+ The Qt Sensors module is available under commercial licenses from
+ \l{The Qt Company}. In addition, it is available under free software licenses:
+ The \l{GNU Lesser General Public License, version 3}, or
+ the \l{GNU General Public License, version 2}.
+ See \l{Qt Licensing} for further details.
+
+ Furthermore, Qt Sensors in Qt \QtVersion may contain third-party
+ modules under following permissive licenses:
+
+ \generatelist{groupsbymodule attributions-qtsensors}
*/
diff --git a/src/sensors/doc/src/qtsensors5.qdoc b/src/sensors/doc/src/qtsensors5.qdoc
deleted file mode 100644
index 403f3282..00000000
--- a/src/sensors/doc/src/qtsensors5.qdoc
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-/*!
- \module QtSensors
- \title Qt Sensors C++ Classes
- \ingroup modules
- \qtvariable sensors
-
- \brief Provides classes for reading sensor data.
-
- Mobile devices contain sensor hardware that allow detecting changes in various physical
- properties of the device itself or its immediate environment. Examples of device properties
- include the angle at which the device is held, whereas environmental properties include for
- example the current level of ambient light.
-*/
-
-/*!
- \qmlmodule QtSensors 5.\QtMinorVersion
- \title Qt Sensors QML Types
- \ingroup qmlmodules
-
- \brief Provides types for reading sensor data.
-
- \section1 QML Module API
-
- If the module is imported into a namespace, some additional methods become available.
-
- \qml \QtMinorVersion
- import QtSensors 5.\1
- // ...
- Component.onCompleted: {
- var types = QmlSensors.sensorTypes();
- console.log(types.join(", "));
- }
- \endqml
-
- The documentation for the module API can be found in QmlSensors.
-
- \section1 QML Sensor Types
-
- These types represent specific types of sensors.
-
- Note that most properties come from the abstract \l{Sensor}{Sensor} element.
-
- \annotatedlist qml-sensors_type
-
- \section1 QML Reading Types
-
- The data from a sensor comes via a reading class.
-
- \annotatedlist qml-sensors_reading
-
- \section1 All QML Types
-*/
diff --git a/src/sensors/doc/src/sensor-examples.qdoc b/src/sensors/doc/src/sensor-examples.qdoc
index 769d8f69..8e8d8d75 100644
--- a/src/sensors/doc/src/sensor-examples.qdoc
+++ b/src/sensors/doc/src/sensor-examples.qdoc
@@ -1,35 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\group qtsensors-examples
\title Qt Sensors Examples
\brief Examples for the Qt Sensors module
- \ingroup all-examples
These are the Qt Sensors examples.
diff --git a/src/sensors/doc/src/sensorfwbackend.qdoc b/src/sensors/doc/src/sensorfwbackend.qdoc
index 21539bdb..4e3a980d 100644
--- a/src/sensors/doc/src/sensorfwbackend.qdoc
+++ b/src/sensors/doc/src/sensorfwbackend.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Jolla Mobile
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Jolla Mobile
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\page senorfwbackend.html
diff --git a/src/sensors/gestures/qsensorgesture.cpp b/src/sensors/gestures/qsensorgesture.cpp
deleted file mode 100644
index 8d5e2ddf..00000000
--- a/src/sensors/gestures/qsensorgesture.cpp
+++ /dev/null
@@ -1,250 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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 <QDir>
-#include <QPluginLoader>
-#include <QDebug>
-
-#include "qsensorgesture.h"
-#include "qsensorgesture_p.h"
-#include "qsensorgesturemanager.h"
-
-#include <private/qmetaobjectbuilder_p.h>
-
-/*!
- \class QSensorGesture
- \ingroup sensorgestures_main
- \inmodule QtSensors
- \since 5.1
-
- \brief The QSensorGesture class represents one or more sensor gesture recognizers.
-
- In addition to the QSensorGesture::detected() signal, Sensor Gesture Recognizers can
- have their own specific signals, and may be discovered through
- QSensorGesture::gestureSignals().
-
- \b {Note that QSensorGesture uses a custom meta-object in order to provide
- recognizer-specific signals. This means it is not possible to sub-class
- QSensorGesture and use Q_OBJECT. Also qobject_cast<QSensorGesture*>(ptr) will
- not work.}
-
- \sa QSensorGestureRecognizer
-
- You may use QSensorGestureManager to obtain the systems known sensor gesture ids.
-
- \sa QSensorGestureManager
- */
-
-/*!
- \fn void QSensorGesture::detected(QString)
- Signals when the gesture has been recognized.
- */
-
-/*!
- Constructs the sensor gesture, and initializes the \a ids list of recognizers,
- with parent \a parent
- */
-QSensorGesture::QSensorGesture(const QStringList &ids, QObject *parent) :
- QObject(parent)
-{
- d_ptr = new QSensorGesturePrivate();
- Q_FOREACH (const QString &id, ids) {
- QSensorGestureRecognizer * rec = QSensorGestureManager::sensorGestureRecognizer(id);
- if (rec != 0) {
- d_ptr->m_sensorRecognizers.append(rec);
- d_ptr->availableIds.append(id);
- } else {
- d_ptr->invalidIds.append(id);
- //add to not available things
- }
- }
-
- d_ptr->meta = 0;
-
- QMetaObjectBuilder builder;
- builder.setSuperClass(&QObject::staticMetaObject);
- builder.setClassName("QSensorGesture");
-
- Q_FOREACH (QSensorGestureRecognizer *recognizer, d_ptr->m_sensorRecognizers) {
- Q_FOREACH (const QString &gesture, recognizer->gestureSignals()) {
- QMetaMethodBuilder b = builder.addSignal(gesture.toLatin1());
- if (!d_ptr->localGestureSignals.contains(QLatin1String(b.signature())))
- d_ptr->localGestureSignals.append(QLatin1String(b.signature()));
- }
- recognizer->createBackend();
- }
- d_ptr->meta = builder.toMetaObject();
-
- if (d_ptr->m_sensorRecognizers.count() > 0) {
- d_ptr->valid = true;
- }
-}
-
-/*!
- Destroy the QSensorGesture
- */
-QSensorGesture::~QSensorGesture()
-{
- stopDetection();
- if (d_ptr->meta)
- free(d_ptr->meta);
- delete d_ptr;
-}
-
-/*!
- Returns the gesture recognizer ids that were found.
- */
-QStringList QSensorGesture::validIds() const
-{
- return d_ptr->availableIds;
-}
-
-/*!
- Returns the gesture recognizer ids that were not found.
- */
-QStringList QSensorGesture::invalidIds() const
-{
- return d_ptr->invalidIds;
-}
-
-/*!
- Starts the gesture detection routines in the recognizer.
- */
-void QSensorGesture::startDetection()
-{
- if (d_ptr->m_sensorRecognizers.count() < 1)
- return;
- if (d_ptr->isActive)
- return;
-
- Q_FOREACH (QSensorGestureRecognizer *recognizer, d_ptr->m_sensorRecognizers) {
-
- Q_ASSERT(recognizer !=0);
-
- connect(recognizer,SIGNAL(detected(QString)),
- this,SIGNAL(detected(QString)),Qt::UniqueConnection);
-
- //connect recognizer signals
- Q_FOREACH (QString method, recognizer->gestureSignals()) {
- method.prepend(QLatin1String("2"));
- connect(recognizer, method.toLatin1(),
- this, method.toLatin1(), Qt::UniqueConnection);
- }
-
- recognizer->startBackend();
- }
- d_ptr->isActive = true;
-}
-
-/*!
- Stops the gesture detection routines.
- */
-void QSensorGesture::stopDetection()
-{
- if (d_ptr->m_sensorRecognizers.count() < 1)
- return;
-
- if (!d_ptr->isActive)
- return;
-
- Q_FOREACH (QSensorGestureRecognizer *recognizer, d_ptr->m_sensorRecognizers) {
- disconnect(recognizer,SIGNAL(detected(QString)),
- this,SIGNAL(detected(QString)));
- //disconnect recognizer signals
- Q_FOREACH (QString method,recognizer->gestureSignals()) {
- method.prepend(QLatin1String("2"));
- disconnect(recognizer, method.toLatin1(),
- this, method.toLatin1());
- }
-
- recognizer->stopBackend();
- }
- d_ptr->isActive = false;
-}
-
-/*!
- Returns all the possible gestures signals that may be emitted.
- */
-QStringList QSensorGesture::gestureSignals() const
-{
- if (d_ptr->m_sensorRecognizers.count() > 0) {
- return d_ptr->localGestureSignals;
- }
- return QStringList();
-}
-
-/*!
- Returns whether this gesture is active or not.
- */
-
-bool QSensorGesture::isActive()
-{
- return d_ptr->isActive;
-}
-
-/*!
- \internal
-*/
-const QMetaObject* QSensorGesture::metaObject() const
-{
- return d_ptr->meta;
-}
-/*!
- \internal
-*/
-int QSensorGesture::qt_metacall(QMetaObject::Call c, int id, void **a)
-{
- id = QObject::qt_metacall(c, id, a);
-
- if (id < 0 || !d_ptr->meta)
- return id;
-
- QMetaObject::activate(this, d_ptr->meta, id, a);
- return id;
-}
-
-QSensorGesturePrivate::QSensorGesturePrivate(QObject *parent)
- : QObject(parent),isActive(0), valid(0)
-{
-}
-
-QSensorGesturePrivate::~QSensorGesturePrivate()
-{
-
-}
diff --git a/src/sensors/gestures/qsensorgesture.h b/src/sensors/gestures/qsensorgesture.h
deleted file mode 100644
index 53de7630..00000000
--- a/src/sensors/gestures/qsensorgesture.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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 QSENSORGESTURE_H
-#define QSENSORGESTURE_H
-
-#include <QtCore/QObject>
-#include <QtCore/QStringList>
-#include <QtSensors/qsensorsglobal.h>
-
-#include <QtCore/QList>
-#include <QtCore/QMap>
-#include <QtCore/QVector>
-
-#include <QtCore/qmetatype.h>
-
-QT_BEGIN_NAMESPACE
-
-class QSensorGesturePrivate;
-
-class Q_SENSORS_EXPORT QSensorGesture : public QObject
-{
- //Do not use Q_OBJECT here
-public:
- explicit QSensorGesture(const QStringList &ids, QObject *parent = Q_NULLPTR);
- ~QSensorGesture();
-
- bool isActive();
-
- QStringList validIds() const;
- QStringList invalidIds() const;
-
- QStringList gestureSignals() const;
-
- void startDetection();
- void stopDetection();
-
-private:
- QSensorGesturePrivate * d_ptr;
-
- // ### fixme: Qt 6: Make public to enable Qt for Python bindings
-private:
- // Pretend to be a Q_OBJECT
- const QMetaObject *metaObject() const override;
- int qt_metacall(QMetaObject::Call, int, void **) override;
-
-Q_SIGNALS:
- // these signals are created at runtime, along with
- // gesture recognizer specific signals.
- void detected(QString);
-};
-
-QT_END_NAMESPACE
-
-
-#endif // QSENSORGESTURE_H
diff --git a/src/sensors/gestures/qsensorgesture_p.h b/src/sensors/gestures/qsensorgesture_p.h
deleted file mode 100644
index 9ec80c8b..00000000
--- a/src/sensors/gestures/qsensorgesture_p.h
+++ /dev/null
@@ -1,85 +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 QSENSORGESTURE_P_H
-#define QSENSORGESTURE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-#include <QtSensors/QSensor>
-#include <QtSensors/QAccelerometer>
-#include <QtSensors/QAccelerometerFilter>
-#include <QTimer>
-
-#include "qsensorgesture.h"
-#include "qsensorgesturemanager.h"
-#include <QtCore/private/qmetaobjectbuilder_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QSensorGesturePrivate : public QObject
-{
-
-public:
- QSensorGesturePrivate(QObject *parent = 0);
- ~QSensorGesturePrivate();
-
- QList<QSensorGestureRecognizer *> m_sensorRecognizers;
-
- QByteArray metadata;
- QMetaObject* meta;
- bool isActive;
- QStringList localGestureSignals;
- QStringList availableIds;
- QStringList invalidIds;
- bool valid;
-};
-
-
-QT_END_NAMESPACE
-
-#endif // QSENSORGESTURE_P_H
diff --git a/src/sensors/gestures/qsensorgesturemanager.cpp b/src/sensors/gestures/qsensorgesturemanager.cpp
deleted file mode 100644
index e99be929..00000000
--- a/src/sensors/gestures/qsensorgesturemanager.cpp
+++ /dev/null
@@ -1,138 +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 "qsensorgesturemanager.h"
-#include "qsensorgesturemanagerprivate_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QSensorGestureManager
- \ingroup sensorgestures_main
- \inmodule QtSensors
- \since 5.1
-
- \brief The QSensorGestureManager class manages sensor gestures, registers and creates sensor gesture plugins.
-
- Sensor Gesture plugins register their recognizers using the registerSensorGestureRecognizer() function.
-
- \snippet sensorgestures/creating.cpp Receiving sensor gesture signals
-*/
-
-/*!
- \fn QSensorGestureManager::newSensorGestureAvailable()
- Signals when a new sensor gesture becomes available for use.
- */
-
-/*!
- Constructs the QSensorGestureManager as a child of \a parent
- */
-QSensorGestureManager::QSensorGestureManager(QObject *parent)
- : QObject(parent)
-{
- QSensorGestureManagerPrivate *d = QSensorGestureManagerPrivate::instance();
- if (!d) return; // hardly likely but just in case...
- connect(d,SIGNAL(newSensorGestureAvailable()),
- this,SIGNAL(newSensorGestureAvailable()));
-}
-
-/*!
- Destroy the QSensorGestureManager
-*/
-QSensorGestureManager::~QSensorGestureManager()
-{
-}
-
-/*!
- Registers the sensor recognizer \a recognizer for use.
- QSensorGestureManager retains ownership of the recognizer object.
- Returns true unless the gesture has already been registered, in
- which case the object is deleted.
-
- */
-
- bool QSensorGestureManager::registerSensorGestureRecognizer(QSensorGestureRecognizer *recognizer)
- {
- QSensorGestureManagerPrivate *d = QSensorGestureManagerPrivate::instance();
- if (!d) { // hardly likely but just in case...
- delete recognizer;
- return false;
- }
- bool ok = d->registerSensorGestureRecognizer(recognizer);
- if (!ok)
- delete recognizer;
-
- return ok;
- }
-
-
- /*!
- Returns the list of the currently registered gestures.
- Includes all the standard built-ins as well as available plugins.
- */
- QStringList QSensorGestureManager::gestureIds() const
- {
- QSensorGestureManagerPrivate *d = QSensorGestureManagerPrivate::instance();
- if (!d) return QStringList(); // hardly likely but just in case...
- return d->gestureIds();
- }
-
- /*!
- Returns the list of all the gesture signals for the registered \a gestureId gesture recognizer id.
- */
- QStringList QSensorGestureManager::recognizerSignals(const QString &gestureId) const
- {
- QSensorGestureRecognizer *recognizer = sensorGestureRecognizer(gestureId);
- if (recognizer != 0)
- return recognizer->gestureSignals();
- else
- return QStringList();
- }
-
-/*!
- Returns the sensor gesture object for the recognizer \a id.
- */
-QSensorGestureRecognizer *QSensorGestureManager::sensorGestureRecognizer(const QString &id)
-{
- QSensorGestureManagerPrivate *d = QSensorGestureManagerPrivate::instance();
- if (!d) return 0; // hardly likely but just in case...
- return d->sensorGestureRecognizer(id);
-}
-
-QT_END_NAMESPACE
diff --git a/src/sensors/gestures/qsensorgesturemanager.h b/src/sensors/gestures/qsensorgesturemanager.h
deleted file mode 100644
index 1ddc84c2..00000000
--- a/src/sensors/gestures/qsensorgesturemanager.h
+++ /dev/null
@@ -1,77 +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 QSENSORGESTUREMANAGER_P_H
-#define QSENSORGESTUREMANAGER_P_H
-
-#include <QtCore/QObject>
-#include <QtCore/QStringList>
-
-#include <QtSensors/qsensorgesture.h>
-#include <QtSensors/qsensorgesturerecognizer.h>
-
-QT_BEGIN_NAMESPACE
-
-class QSensorGestureManagerPrivate;
-class Q_SENSORS_EXPORT QSensorGestureManager : public QObject
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QSensorGestureManager)
-
-public:
- explicit QSensorGestureManager(QObject *parent = Q_NULLPTR);
-
- ~QSensorGestureManager();
-
- bool registerSensorGestureRecognizer(QSensorGestureRecognizer *recognizer);
-
- QStringList gestureIds() const;
- QStringList recognizerSignals(const QString &recognizerId) const;
-
- static QSensorGestureRecognizer *sensorGestureRecognizer(const QString &id);
-
-Q_SIGNALS:
- void newSensorGestureAvailable();
-
-};
-
-
-QT_END_NAMESPACE
-
-#endif // QSENSORGESTUREMANAGER_P_H
diff --git a/src/sensors/gestures/qsensorgesturemanagerprivate.cpp b/src/sensors/gestures/qsensorgesturemanagerprivate.cpp
deleted file mode 100644
index 81e87de0..00000000
--- a/src/sensors/gestures/qsensorgesturemanagerprivate.cpp
+++ /dev/null
@@ -1,244 +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 <QDir>
-#include <QLibraryInfo>
-
-#include <QtCore/private/qfactoryloader_p.h>
-
-#include "qsensorgesturerecognizer.h"
-#include "qsensorgesturemanagerprivate_p.h"
-#include "qsensorgestureplugininterface.h"
-
-#ifdef SIMULATOR_BUILD
-#include "simulatorgesturescommon_p.h"
-#endif
-
-Q_GLOBAL_STATIC(QSensorGestureManagerPrivate, sensorGestureManagerPrivate)
-
-QT_BEGIN_NAMESPACE
-
-QSensorGestureManagerPrivate::QSensorGestureManagerPrivate(QObject *parent) :
- QObject(parent)
-{
-#ifdef SIMULATOR_BUILD
- SensorGesturesConnection *connection = new SensorGesturesConnection(this);
- connect(connection,SIGNAL(sensorGestureDetected()),
- this,SLOT(sensorGestureDetected()));
-
- connect(this,SIGNAL(newSensorGestures(QStringList)),
- connection,SLOT(newSensorGestures(QStringList)));
-
- connect(this,SIGNAL(removeSensorGestures(QStringList)),
- connection,SLOT(removeSensorGestures(QStringList)));
-#endif
-
- loader = new QFactoryLoader("org.qt-project.QSensorGesturePluginInterface", QLatin1String("/sensorgestures"));
- loadPlugins();
-}
-
-QSensorGestureManagerPrivate::~QSensorGestureManagerPrivate()
-{
-// qDeleteAll(registeredSensorGestures);
-// delete loader;
-}
-
-
- void QSensorGestureManagerPrivate::initPlugin(QObject *plugin)
-{
- if (QSensorGesturePluginInterface *pInterface
- = qobject_cast<QSensorGesturePluginInterface *>(plugin)) {
-
- Q_FOREACH (const QString &id, pInterface->supportedIds()) {
-
- if (!knownIds.contains(id))
- knownIds.append(id);
- else
- qWarning() << id <<"from the plugin"
- << pInterface->name()
- << "is already known.";
-
- }
- plugins << plugin;
- } else {
- qWarning() << "Could not load "<< plugin;
- }
-}
-
-
-/*!
- Internal
- Loads the sensorgesture plugins.
- */
-void QSensorGestureManagerPrivate::loadPlugins()
-{
- Q_FOREACH (QObject *plugin, QPluginLoader::staticInstances()) {
- initPlugin(plugin);
- }
- QList<QJsonObject> meta = loader->metaData();
- for (int i = 0; i < meta.count(); i++) {
- QObject *plugin = loader->instance(i);
- initPlugin(plugin);
- }
-}
-
-
-/*!
- Internal
- creates the requested recognizer.
- */
-
-bool QSensorGestureManagerPrivate::loadRecognizer(const QString &recognizerId)
-{
- //if no plugin is used return true if this is a registered recognizer
-
- if (registeredSensorGestures.contains(recognizerId))
- return true;
-
- for (int i= 0; i < plugins.count(); i++) {
-
- if (QSensorGesturePluginInterface *pInterface
- = qobject_cast<QSensorGesturePluginInterface *>(plugins.at(i))) {
-
- if (pInterface->supportedIds().contains(recognizerId)) {
-
- if (!registeredSensorGestures.contains(recognizerId)) {
- //create these recognizers
- QList <QSensorGestureRecognizer *> recognizers = pInterface->createRecognizers();
-
- Q_FOREACH (QSensorGestureRecognizer *recognizer, recognizers) {
-
- if (registeredSensorGestures.contains(recognizer->id())) {
- qWarning() << "Ignoring recognizer " << recognizer->id() << "from plugin" << pInterface->name() << "because it is already registered";
- delete recognizer;
- } else {
- registeredSensorGestures.insert(recognizer->id(),recognizer);
- }
- }
- }
- return true;
- }
- }
- }
- return false;
-}
-
-bool QSensorGestureManagerPrivate::registerSensorGestureRecognizer(QSensorGestureRecognizer *recognizer)
-{
- if (!knownIds.contains(recognizer->id())) {
- knownIds.append(recognizer->id());
- Q_ASSERT (!registeredSensorGestures.contains(recognizer->id()));
- recognizer->setParent(0);
- registeredSensorGestures.insert(recognizer->id(),recognizer);
- Q_EMIT newSensorGestureAvailable();
-
- return true;
- }
- return false;
-}
-
-QSensorGestureRecognizer *QSensorGestureManagerPrivate::sensorGestureRecognizer(const QString &id)
-{
- QSensorGestureRecognizer *recognizer = 0;
-
- if (loadRecognizer(id)) {
- recognizer= registeredSensorGestures.value(id);
- }
-
- return recognizer;
-}
-
-QStringList QSensorGestureManagerPrivate::gestureIds()
-{
- return knownIds;
-}
-
-#ifdef SIMULATOR_BUILD
-void QSensorGestureManagerPrivate::sensorGestureDetected()
-{
- QString str = get_qtSensorGestureData();
-
- Q_FOREACH (const QString &id, gestureIds()) {
- QSensorGestureRecognizer *recognizer = sensorGestureRecognizer(id);
- if (recognizer != 0) {
- Q_FOREACH (const QString &sig, recognizer->gestureSignals()) {
- if (!sig.contains(QLatin1String("detected"))) { //weed out detected signals
- QString tmp;
- tmp = sig.left(sig.length() - 2);
- if (str == tmp) {
- // named signal for c++
- QMetaObject::invokeMethod(recognizer, str.toLocal8Bit(), Qt::DirectConnection);
- // detected signal for qml and c++
- QMetaObject::invokeMethod(recognizer, "detected", Qt::DirectConnection,
- Q_ARG(QString, str));
- break;
-
- }
- }
- }
- }
- }
-}
-
-void QSensorGestureManagerPrivate::recognizerStarted(const QSensorGestureRecognizer *recognizer)
-{
- QStringList list = recognizer->gestureSignals();
- list.removeOne(QLatin1String("detected(QString)"));
- Q_EMIT newSensorGestures(list);
-}
-
-void QSensorGestureManagerPrivate::recognizerStopped(const QSensorGestureRecognizer *recognizer)
-{
- QStringList list = recognizer->gestureSignals();
- list.removeOne(QLatin1String("detected(QString)"));
- Q_EMIT removeSensorGestures(list);
-}
-
-#endif
-
-QSensorGestureManagerPrivate * QSensorGestureManagerPrivate::instance()
-{
- QSensorGestureManagerPrivate *priv = sensorGestureManagerPrivate();
- // It's safe to return 0 because this is checked when used
- //if (!priv) qFatal("Cannot return from QSensorGestureManagerPrivate::instance() because sensorGestureManagerPrivate() returned 0.");
- return priv;
-}
-
-
-QT_END_NAMESPACE
diff --git a/src/sensors/gestures/qsensorgesturemanagerprivate_p.h b/src/sensors/gestures/qsensorgesturemanagerprivate_p.h
deleted file mode 100644
index 2ca4d648..00000000
--- a/src/sensors/gestures/qsensorgesturemanagerprivate_p.h
+++ /dev/null
@@ -1,111 +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 QSENSORGESTUREMANAGERPRIVATE_P_H
-#define QSENSORGESTUREMANAGERPRIVATE_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 <QObject>
-#include <QMap>
-#include <QStringList>
-#include <QDebug>
-#include <QSharedPointer>
-#include <QPluginLoader>
-
-#include "qsensorgesture.h"
-#include "qsensorgesturerecognizer.h"
-
-QT_BEGIN_NAMESPACE
-
-class QFactoryLoader;
-
-class QSensorGestureManagerPrivate : public QObject
-{
- Q_OBJECT
-public:
- explicit QSensorGestureManagerPrivate(QObject *parent = 0);
- ~QSensorGestureManagerPrivate();
-
- QMap<QString, QSensorGestureRecognizer *> registeredSensorGestures;
-
- QList <QObject *> plugins;
-
- QFactoryLoader *loader;
- void loadPlugins();
- bool loadRecognizer(const QString &id);
-
- QSensorGestureRecognizer *sensorGestureRecognizer(const QString &id);
-
- bool registerSensorGestureRecognizer(QSensorGestureRecognizer *recognizer);
- QStringList gestureIds();
- QStringList knownIds;
- void initPlugin(QObject *o);
-#ifdef SIMULATOR_BUILD
- void recognizerStarted(const QSensorGestureRecognizer *);
- void recognizerStopped(const QSensorGestureRecognizer *);
-#endif
-
- static QSensorGestureManagerPrivate * instance();
-Q_SIGNALS:
- void newSensorGestureAvailable();
-
-#ifdef SIMULATOR_BUILD
-Q_SIGNALS:
- void newSensorGestures(QStringList);
- void removeSensorGestures(QStringList);
-
-private slots:
- void sensorGestureDetected();
-
-#endif
-};
-
-QT_END_NAMESPACE
-
-#endif // QSENSORGESTUREMANAGERPRIVATE_P_H
diff --git a/src/sensors/gestures/qsensorgestureplugininterface.cpp b/src/sensors/gestures/qsensorgestureplugininterface.cpp
deleted file mode 100644
index c80862e3..00000000
--- a/src/sensors/gestures/qsensorgestureplugininterface.cpp
+++ /dev/null
@@ -1,97 +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 "qsensorgestureplugininterface.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QSensorGesturePluginInterface
- \ingroup sensorgestures_recognizer
- \inmodule QtSensors
-
- \brief The QSensorGesturePluginInterface class is the pure virtual interface to sensor gesture
- plugins.
-
- \since 5.1
-
- The QSensorGesturePluginInterface class is implemented in sensor gesture plugins to register
- sensor gesture recognizers with QSensorGestureManager.
-
- \sa {QtSensorGestures Plugins}
-*/
-
-/*!
- \fn QSensorGesturePluginInterface::createRecognizers()
-
- Called by the manager to create the recognizers.
- Plugins should initialize and register their recognizers using
- QSensorGestureManager::registerSensorGestureRecognizer() here.
-
- \sa QSensorGestureManager
-*/
-
-/*!
- \fn QSensorGesturePluginInterface::supportedIds() const
-
- Returns a list of the recognizer Id's that this plugin supports.
- */
-
-
-/*!
- \fn QSensorGesturePluginInterface::name() const
-
- Returns this plugins name.
- */
-
-/*!
- Construct the QSensorGesturePluginInterface.
-*/
-QSensorGesturePluginInterface::QSensorGesturePluginInterface()
-{
-}
-
-/*!
- Destroy the QSensorGesturePluginInterface.
-*/
-QSensorGesturePluginInterface::~QSensorGesturePluginInterface()
-{
-}
-
-QT_END_NAMESPACE
diff --git a/src/sensors/gestures/qsensorgestureplugininterface.h b/src/sensors/gestures/qsensorgestureplugininterface.h
deleted file mode 100644
index 3de9ab84..00000000
--- a/src/sensors/gestures/qsensorgestureplugininterface.h
+++ /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$
-**
-****************************************************************************/
-
-#ifndef QSENSORGESTUREPLUGININTERFACE_H
-#define QSENSORGESTUREPLUGININTERFACE_H
-
-#include <QtCore/QObject>
-#include <QtCore/QtGlobal>
-#include <QtCore/qplugin.h>
-#include <QtSensors/qsensorgesture.h>
-#include <QtSensors/qsensorgesturerecognizer.h>
-
-QT_BEGIN_NAMESPACE
-
-class QSensorGestureRecognizer;
-
-class Q_SENSORS_EXPORT QSensorGesturePluginInterface
-{
-public:
- QSensorGesturePluginInterface();
- virtual ~QSensorGesturePluginInterface();
- virtual QList <QSensorGestureRecognizer *> createRecognizers() = 0;
- virtual QStringList supportedIds() const = 0;
- virtual QString name() const = 0;
-};
-
-Q_DECLARE_INTERFACE(QSensorGesturePluginInterface, "org.qt-project.QSensorGesturePluginInterface")
-
-QT_END_NAMESPACE
-
-#endif // QSENSORGESTUREPLUGININTERFACE_H
diff --git a/src/sensors/gestures/qsensorgesturerecognizer.cpp b/src/sensors/gestures/qsensorgesturerecognizer.cpp
deleted file mode 100644
index c992ac01..00000000
--- a/src/sensors/gestures/qsensorgesturerecognizer.cpp
+++ /dev/null
@@ -1,218 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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 "qsensorgesturerecognizer.h"
-#include "qsensorgesture_p.h"
-
-#include "qsensorgesturemanager.h"
-#ifdef SIMULATOR_BUILD
-#include "qsensorgesturemanagerprivate_p.h"
-#endif
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QSensorGestureRecognizer
- \ingroup sensorgestures_recognizer
- \inmodule QtSensors
- \since 5.1
-
- \brief The QSensorGestureRecognizer class is the base class for a sensor gesture
- recognizer.
-
- QSensorGesture recognizer developers should sub-class this to implement their own recognizer.
-
- All sensor gesture recognizers have a detected(QString) signal. Implementors can use this
- and send recognizer specific gestures, such as detected("shake_left") or implement custom signals
- such as shakeLeft().
-
- These custom signals will be available in the QSensorGesture object at runtime.
-
- \sa QSensorGestureRecognizer::gestureSignals()
-
- */
-
-/*!
- \fn void QSensorGestureRecognizer::create()
-
- Called by QSensorGesture object constructor to create the recognizers backend.
-
- Implementors would use this to instantiate QSensors and connect signals.
-
- */
-
-/*!
- \fn QString QSensorGestureRecognizer::id() const
- Returns the identifier for this recognizer.
- */
-/*!
- \fn bool QSensorGestureRecognizer::start()
-
- Called by QSensorGesture::startDetection() to start this recognizer.
- Implementors should start the sensors.
- Returns true if the operation is successful.
-
- */
-/*!
- \fn bool QSensorGestureRecognizer::stop()
-
- Called by QSensorGesture::stopDetection() to stop this recognizer.
- Returns true if the call succeeds, otherwise false.
-
- Implementors should stop the sensors.
-
- */
-/*!
- \fn bool QSensorGestureRecognizer::isActive()
-
- Returns true if this recognizer is active, otherwise false.
- */
-
-/*!
- \fn QSensorGestureRecognizer::detected(const QString &)
- Signals when a gesture is recognized. Implementors can use this signal to send
- recognizer-specific gestures, such as \c detected("shake_left") or implement
- custom signals such as \c shakeLeft().
-
- The custom signals are available in the QSensorGesture object at runtime.
- */
-
-class QSensorGestureRecognizerPrivate
-{
-public:
- bool initialized;
- int count;
-};
-
-
-/*!
- Constructs the QSensorGestureRecognizer with \a parent as parent.
- */
-QSensorGestureRecognizer::QSensorGestureRecognizer(QObject *parent)
- :QObject(parent),
- d_ptr(new QSensorGestureRecognizerPrivate())
-{
-}
-
-/*!
- Destroy the QSensorGestureRecognizer
-*/
-QSensorGestureRecognizer::~QSensorGestureRecognizer()
-{
- delete d_ptr;
-}
-
-/*!
- Returns a list of signals that this recognizer supports.
-
- Note that all signals declared will be exported to the QSensorGesture
- object. If you need to use signals that are not exported, you should use a private class
- to do so.
-
- */
-QStringList QSensorGestureRecognizer::gestureSignals() const
-{
- QStringList list;
- bool ok = false;
- for (int i = 0; i < this->metaObject()->methodCount(); i++) {
- //weed out objectsignals and slots
- const QByteArray sig(this->metaObject()->method(i).methodSignature());
- if (this->metaObject()->indexOfSignal(sig) != -1) {
- if (sig.contains("detected"))
- ok = true;
- if (ok)
- list.append(QString::fromLatin1(sig));
- }
- }
- return list;
-}
-
-/*!
- Calls QSensorGestureRecognizer::create() if the recognizer is valid.
-*/
-void QSensorGestureRecognizer::createBackend()
-{
- if (d_ptr->initialized) {
- return;
- }
- d_ptr->initialized = true;
- create();
-}
-
-/*!
- Calls QSensorGestureRecognizer::start() if the recognizer isn't already initialized.
- This is called by the QSensorGesture object, so please use that instead.
-
-\sa QSensorGesture::startDetection()
-
-*/
-void QSensorGestureRecognizer::startBackend()
-{
- if (!d_ptr->initialized) {
- qWarning() << "Not starting. Gesture Recognizer not initialized";
- return;
- }
- if (d_ptr->count++ == 0) {
- start();
-#ifdef SIMULATOR_BUILD
- QSensorGestureManagerPrivate::instance()->recognizerStarted(this);
-#endif
- }
-}
-
-/*!
- Calls QSensorGestureRecognizer::stop() if no other clients are using it.
- This is called by the QSensorGesture object, so please use that instead.
-
-\sa QSensorGesture::stopDetection()
-*/
-void QSensorGestureRecognizer::stopBackend()
-{
- if (!d_ptr->initialized) {
- qWarning() << "Not stopping. Gesture Recognizer not initialized";
- return;
- }
- if (--d_ptr->count == 0) {
- stop();
-#ifdef SIMULATOR_BUILD
- QSensorGestureManagerPrivate::instance()->recognizerStopped(this);
-#endif
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/sensors/gestures/qsensorgesturerecognizer.h b/src/sensors/gestures/qsensorgesturerecognizer.h
deleted file mode 100644
index 27181983..00000000
--- a/src/sensors/gestures/qsensorgesturerecognizer.h
+++ /dev/null
@@ -1,83 +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 QSENSORGESTURERECOGNIZER_H
-#define QSENSORGESTURERECOGNIZER_H
-
-#include <QtCore/QDebug>
-#include <QtCore/QTimer>
-#include <QtCore/QStringList>
-
-#include <QtSensors/qsensorgesture.h>
-
-QT_BEGIN_NAMESPACE
-
-class QSensorGestureRecognizerPrivate;
-class Q_SENSORS_EXPORT QSensorGestureRecognizer : public QObject
-{
- Q_OBJECT
-public:
- explicit QSensorGestureRecognizer(QObject *parent = Q_NULLPTR);
- virtual ~QSensorGestureRecognizer();
-
- virtual QString id() const = 0;
-
- virtual bool isActive() = 0;
-
- void startBackend();
- void stopBackend();
- void createBackend();
-
- QStringList gestureSignals() const;
-
-Q_SIGNALS:
- void detected(const QString &);
-
-protected:
- virtual void create() = 0;
- virtual bool start() = 0;
- virtual bool stop() = 0;
-
-private:
- QSensorGestureRecognizerPrivate * d_ptr;
-};
-
-QT_END_NAMESPACE
-
-#endif // QSENSORGESTURERECOGNIZER_H
diff --git a/src/sensors/gestures/simulatorgesturescommon.cpp b/src/sensors/gestures/simulatorgesturescommon.cpp
deleted file mode 100644
index b7860423..00000000
--- a/src/sensors/gestures/simulatorgesturescommon.cpp
+++ /dev/null
@@ -1,121 +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 "simulatorgesturescommon_p.h"
-
-#include <QtSimulator/version.h>
-#include <QtSimulator/QtSimulator>
-
-#include <QDebug>
-#include <QStringList>
-
-using namespace Simulator;
-
-
-Q_GLOBAL_STATIC(QString, qtSensorGestureData)
-
-SensorGesturesConnection::SensorGesturesConnection(QObject *parent)
- : QObject(parent)
-{
- mConnection = new Connection(Connection::Client, QLatin1String("QtSimulator_Mobility_ServerName1.3.0.0"),
- 0xbeef+1, Version(1,0,0,0), this);
- mWorker = mConnection->connectToServer(Connection::simulatorHostName(true), 0xbeef+1);
-
- if (!mWorker) {
- qWarning() << "Could not connect to server";
- return;
- }
-
- mWorker->addReceiver(this);
- mWorker->call("setRequestsSensorGestures");
-}
-
-SensorGesturesConnection::~SensorGesturesConnection()
-{
- mWorker->call("setSensorGestures", QStringList());
- delete mWorker;
-}
-
-void SensorGesturesConnection::setSensorGestureData(const QString &data)
-{
- QString gesture = data;
- if (data.contains(QLatin1String("detected"))) {
- gesture.remove(QLatin1String("detected("));
- gesture.remove(QLatin1String(")"));
- }
- *qtSensorGestureData() = gesture;
-}
-
-void SensorGesturesConnection::newSensorGestureDetected()
-{
- emit sensorGestureDetected();
-}
-
-void SensorGesturesConnection::newSensorGestures(const QStringList &gestures)
-{
- if (!mWorker) return;
-
- Q_FOREACH (const QString &gest, gestures) {
- if (!gest.contains(QLatin1String("detected"))) {
- QString tmp = gest.left(gest.length()-2);
- if (!allGestures.contains(tmp)) {
- allGestures.append(tmp);
- }
- }
- }
-
- mWorker->call("setSensorGestures", allGestures);
-}
-
-void SensorGesturesConnection::removeSensorGestures(const QStringList &gestures)
-{
- Q_FOREACH (const QString &gest, gestures) {
- QString tmp = gest.left(gest.length()-2);
- if (allGestures.contains(tmp)) {
- allGestures.removeOne(tmp);
- }
- }
- mWorker->call("setSensorGestures", allGestures);
-}
-
-QString get_qtSensorGestureData()
-{
- return *qtSensorGestureData();
-}
-
diff --git a/src/sensors/gestures/simulatorgesturescommon_p.h b/src/sensors/gestures/simulatorgesturescommon_p.h
deleted file mode 100644
index 63022238..00000000
--- a/src/sensors/gestures/simulatorgesturescommon_p.h
+++ /dev/null
@@ -1,92 +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 SIMULATORGESTURESCOMMON_H
-#define SIMULATORGESTURESCOMMON_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 <QtSimulator/connection.h>
-#include <QtSimulator/connectionworker.h>
-#include <QStringList>
-
-class QTimer;
-
-namespace Simulator
-{
- class Connection;
- class ConnectionWorker;
-}
-
-class SensorGesturesConnection : public QObject
-{
- Q_OBJECT
-public:
- explicit SensorGesturesConnection(QObject *parent = 0);
- virtual ~SensorGesturesConnection();
-
-Q_SIGNALS:
- void sensorGestureDetected();
-
-public slots:
- void setSensorGestureData(const QString &);
- void newSensorGestureDetected();
- void newSensorGestures(const QStringList &gestures);
- void removeSensorGestures(const QStringList &gestures);
-
-private:
- Simulator::Connection *mConnection;
- Simulator::ConnectionWorker *mWorker;
- QStringList allGestures;
-
-};
-
-QString get_qtSensorGestureData();
-
-#endif //SIMULATORGESTURESCOMMON_H
-
diff --git a/src/sensors/make_sensor.pl b/src/sensors/make_sensor.pl
index bfa81472..74213f09 100755
--- a/src/sensors/make_sensor.pl
+++ b/src/sensors/make_sensor.pl
@@ -1,42 +1,25 @@
#!/usr/bin/perl
-#############################################################################
-##
-## 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$
-##
-#############################################################################
+# Copyright (C) 2021 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+# About this script
+#
+# The make_sensor.pl creates new sensor frontend placeholder implementations.
+# Both C++ and QML classes are generated. As the script makes assumptions on the
+# naming conventions and source file locations, the main
+# intended use case is adding new sensor frontends to the QtSensors module.
+#
+# To run the script, provide the sensor name starting with 'Q' as an argument
+# (here "QFlow"):
+#
+# perl make_sensor.pl QFlow
+#
+# This will generate the following files:
+# ../sensorsquick/qmlflow_p.h
+# ../sensorsquick/qmlflow.cpp
+# qflow_p.h
+# qflow.h
+# qflow.cpp
use strict;
use warnings;
@@ -75,8 +58,8 @@ $qmlfilebase = "qml".$qmlfilebase;
my $pheader = $filebase."_p.h";
my $header = $filebase.".h";
my $source = $filebase.".cpp";
-my $qmlsource = "../imports/sensors/".$qmlfilebase.".cpp";
-my $qmlheader = "../imports/sensors/".$qmlfilebase.".h";
+my $qmlsource = "../sensorsquick/".$qmlfilebase.".cpp";
+my $qmlheader = "../sensorsquick/".$qmlfilebase."_p.h";
my $pguard = uc($pheader);
$pguard =~ s/\./_/g;
@@ -93,45 +76,53 @@ if (! -e $qmlheader) {
#ifndef '.$qmlguard.'
#define '.$qmlguard.'
-#include "qmlsensor.h"
+#include "qmlsensor_p.h"
QT_BEGIN_NAMESPACE
class '.$sensor.';
-class '.$qmlsensor.' : public QmlSensor
+class Q_SENSORSQUICK_EXPORT '.$qmlsensor.' : public QmlSensor
{
Q_OBJECT
+ QML_NAMED_ELEMENT('.$no_q_sensor.')
+ QML_ADDED_IN_VERSION(6,2) // CHANGE VERSION
public:
explicit '.$qmlsensor.'(QObject *parent = 0);
~'.$qmlsensor.'();
-private:
QSensor *sensor() const override;
+
+private:
QmlSensorReading *createReading() const override;
'.$sensor.' *m_sensor;
};
-class '.$qmlreading.' : public QmlSensorReading
+class Q_SENSORSQUICK_EXPORT '.$qmlreading.' : public QmlSensorReading
{
Q_OBJECT
- Q_PROPERTY(qreal prop1 READ prop1 NOTIFY prop1Changed)
+ Q_PROPERTY(qreal myprop READ myprop NOTIFY mypropChanged BINDABLE bindableMyprop)
+ QML_NAMED_ELEMENT('.$no_q_reading.')
+ QML_UNCREATABLE("Cannot create '.$no_q_reading.'")
+ QML_ADDED_IN_VERSION(6,2) // CHANGE VERSION
public:
explicit '.$qmlreading.'('.$sensor.' *sensor);
~'.$qmlreading.'();
- qreal prop1() const;
+ qreal myprop() const;
+ QBindable<qreal> bindableMyprop() const;
Q_SIGNALS:
- void prop1Changed();
+ void mypropChanged();
private:
QSensorReading *reading() const override;
void readingUpdate() override;
'.$sensor.' *m_sensor;
- qreal m_prop1;
+ Q_OBJECT_BINDABLE_PROPERTY('.$qmlreading.', qreal,
+ m_myprop, &'.$qmlreading.'::mypropChanged);
};
QT_END_NAMESPACE
@@ -144,7 +135,7 @@ if (! -e $qmlsource) {
print "Creating $qmlsource\n";
open OUT, ">$qmlsource" or die $!;
print OUT '
-#include "qml'.lc($no_q_sensor).'.h"
+#include "qml'.lc($no_q_sensor).'_p.h"
#include <'.$sensor.'>
/*!
@@ -152,7 +143,7 @@ if (! -e $qmlsource) {
\instantiates '.$qmlsensor.'
\ingroup qml-sensors_type
\inqmlmodule QtSensors
- \since QtSensors 5.[INSERT VERSION HERE]
+ \since QtSensors 6.[INSERT VERSION HERE]
\inherits Sensor
\brief The '.$no_q_sensor.' element reports on fubbleness.
@@ -189,7 +180,7 @@ QSensor *'.$qmlsensor.'::sensor() const
\instantiates '.$qmlreading.'
\ingroup qml-sensors_reading
\inqmlmodule QtSensors
- \since QtSensors 5.[INSERT VERSION HERE]
+ \since QtSensors 6.[INSERT VERSION HERE]
\inherits SensorReading
\brief The '.$no_q_reading.' element holds the most recent '.$no_q_sensor.' reading.
@@ -202,9 +193,7 @@ QSensor *'.$qmlsensor.'::sensor() const
*/
'.$qmlreading.'::'.$qmlreading.'('.$sensor.' *sensor)
- : QmlSensorReading(sensor)
- , m_sensor(sensor)
- , m_prop1(0)
+ : m_sensor(sensor)
{
}
@@ -213,15 +202,20 @@ QSensor *'.$qmlsensor.'::sensor() const
}
/*!
- \qmlproperty qreal '.$no_q_reading.'::prop1
+ \qmlproperty qreal '.$no_q_reading.'::myprop
This property holds the fubble of the device.
- Please see '.$reading.'::prop1 for information about this property.
+ Please see '.$reading.'::myprop for information about this property.
*/
-qreal '.$qmlreading.'::prop1() const
+qreal '.$qmlreading.'::myprop() const
{
- return m_prop1;
+ return m_myprop;
+}
+
+QBindable<qreal> '.$qmlreading.'::bindableMyprop() const
+{
+ return &m_myprop;
}
QSensorReading *'.$qmlreading.'::reading() const
@@ -231,11 +225,7 @@ QSensorReading *'.$qmlreading.'::reading() const
void '.$qmlreading.'::readingUpdate()
{
- qreal prop1 = m_sensor->reading()->prop1();
- if (m_prop1 != prop1) {
- m_prop1 = prop1;
- Q_EMIT prop1Changed();
- }
+ m_myprop = m_sensor->reading()->myprop();
}
';
close OUT;
@@ -323,7 +313,7 @@ public:
explicit '.$sensor.'(QObject *parent = 0);
~'.$sensor.'();
'.$reading.' *reading() const;
- static char const * const type;
+ static char const * const sensorType;
private:
Q_DISABLE_COPY('.$sensor.')
@@ -351,7 +341,7 @@ IMPLEMENT_READING('.$reading.')
\class '.$reading.'
\ingroup sensors_reading
\inmodule QtSensors
- \since 5.[INSERT VERSION HERE]
+ \since 6.[INSERT VERSION HERE]
\brief The '.$reading.' class holds readings from the [X] sensor.
@@ -389,7 +379,7 @@ void '.$reading.'::setMyprop(qreal myprop)
\class '.$filter.'
\ingroup sensors_filter
\inmodule QtSensors
- \since 5.[INSERT VERSION HERE]
+ \since 6.[INSERT VERSION HERE]
\brief The '.$filter.' class is a convenience wrapper around QSensorFilter.
@@ -410,13 +400,13 @@ bool '.$filter.'::filter(QSensorReading *reading)
return filter(static_cast<'.$reading.'*>(reading));
}
-char const * const '.$sensor.'::type("'.$sensor.'");
+char const * const '.$sensor.'::sensorType("'.$sensor.'");
/*!
\class '.$sensor.'
\ingroup sensors_type
\inmodule QtSensors
- \since 5.[INSERT VERSION HERE]
+ \since 6.[INSERT VERSION HERE]
\brief The '.$sensor.' class is a convenience wrapper around QSensor.
@@ -433,7 +423,7 @@ char const * const '.$sensor.'::type("'.$sensor.'");
Construct the sensor as a child of \a parent.
*/
'.$sensor.'::'.$sensor.'(QObject *parent)
- : QSensor('.$sensor.'::type, parent)
+ : QSensor('.$sensor.'::sensorType, parent)
{
}
@@ -469,8 +459,7 @@ exit 0;
sub get_arg
{
if (scalar(@ARGV) == 0) {
- croak "Missing arg(s)";
+ croak "Missing sensor name argument (e.g. 'QFlow')";
}
return shift(@ARGV);
}
-
diff --git a/src/sensors/qaccelerometer.cpp b/src/sensors/qaccelerometer.cpp
index 4f89f997..685b3e16 100644
--- a/src/sensors/qaccelerometer.cpp
+++ b/src/sensors/qaccelerometer.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qaccelerometer.h"
#include "qaccelerometer_p.h"
@@ -155,7 +119,7 @@ bool QAccelerometerFilter::filter(QSensorReading *reading)
return filter(static_cast<QAccelerometerReading*>(reading));
}
-char const * const QAccelerometer::type("QAccelerometer");
+char const * const QAccelerometer::sensorType("QAccelerometer");
/*!
\enum QAccelerometer::AccelerationMode
@@ -205,7 +169,7 @@ char const * const QAccelerometer::type("QAccelerometer");
Construct the sensor as a child of \a parent.
*/
QAccelerometer::QAccelerometer(QObject *parent)
- : QSensor(QAccelerometer::type, *new QAccelerometerPrivate, parent)
+ : QSensor(QAccelerometer::sensorType, *new QAccelerometerPrivate, parent)
{
}
diff --git a/src/sensors/qaccelerometer.h b/src/sensors/qaccelerometer.h
index a44971f2..ac2e29fb 100644
--- a/src/sensors/qaccelerometer.h
+++ b/src/sensors/qaccelerometer.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QACCELEROMETER_H
#define QACCELEROMETER_H
@@ -77,11 +41,10 @@ class QAccelerometerPrivate;
class Q_SENSORS_EXPORT QAccelerometer : public QSensor
{
Q_OBJECT
- Q_ENUMS(AccelerationMode)
Q_PROPERTY(AccelerationMode accelerationMode READ accelerationMode WRITE setAccelerationMode
NOTIFY accelerationModeChanged)
public:
- explicit QAccelerometer(QObject *parent = Q_NULLPTR);
+ explicit QAccelerometer(QObject *parent = nullptr);
virtual ~QAccelerometer();
// Keep this enum in sync with QmlAccelerometer::AccelerationMode
@@ -90,12 +53,13 @@ public:
Gravity,
User
};
+ Q_ENUM(AccelerationMode)
AccelerationMode accelerationMode() const;
void setAccelerationMode(AccelerationMode accelerationMode);
QAccelerometerReading *reading() const;
- static char const * const type;
+ static char const * const sensorType;
Q_SIGNALS:
void accelerationModeChanged(AccelerationMode accelerationMode);
@@ -108,4 +72,3 @@ private:
QT_END_NAMESPACE
#endif
-
diff --git a/src/sensors/qaccelerometer_p.h b/src/sensors/qaccelerometer_p.h
index fece405b..c39c1947 100644
--- a/src/sensors/qaccelerometer_p.h
+++ b/src/sensors/qaccelerometer_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QACCELEROMETER_P_H
#define QACCELEROMETER_P_H
diff --git a/src/sensors/qaltimeter.cpp b/src/sensors/qaltimeter.cpp
deleted file mode 100644
index 7092870d..00000000
--- a/src/sensors/qaltimeter.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Research In Motion
-** 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 <qaltimeter.h>
-#include "qaltimeter_p.h"
-
-QT_BEGIN_NAMESPACE
-
-IMPLEMENT_READING(QAltimeterReading)
-
-/*!
- \class QAltimeterReading
- \ingroup sensors_reading
- \inmodule QtSensors
- \since 5.1
-
- \brief The QAltimeterReading class holds readings from the altimeter sensor.
-
- The altitude is reported in meters relative to mean sea level.
-*/
-
-/*!
- \property QAltimeterReading::altitude
- \brief The altitude in meters relative to mean sea level.
-*/
-
-qreal QAltimeterReading::altitude() const
-{
- return d->altitude;
-}
-
-/*!
- Sets the altitude to \a altitude.
-*/
-void QAltimeterReading::setAltitude(qreal altitude)
-{
- d->altitude = altitude;
-}
-
-// =====================================================================
-
-/*!
- \class QAltimeterFilter
- \ingroup sensors_filter
- \inmodule QtSensors
- \since 5.1
-
- \brief The QAltimeterFilter class is a convenience wrapper around QSensorFilter.
-
- The only difference is that the filter() method features a pointer to QAltimeterReading
- instead of QSensorReading.
-*/
-
-/*!
- \fn QAltimeterFilter::filter(QAltimeterReading *reading)
-
- Called when \a reading changes. Returns false to prevent the reading from propagating.
-
- \sa QSensorFilter::filter()
-*/
-
-bool QAltimeterFilter::filter(QSensorReading *reading)
-{
- return filter(static_cast<QAltimeterReading*>(reading));
-}
-
-char const * const QAltimeter::type("QAltimeter");
-
-/*!
- \class QAltimeter
- \ingroup sensors_type
- \inmodule QtSensors
- \since 5.1
-
- \brief The QAltimeter class is a convenience wrapper around QSensor.
-
- The only behavioural difference is that this class sets the type properly.
-
- This class also features a reading() function that returns a QAltimeterReading instead of a QSensorReading.
-
- For details about how the sensor works, see \l QAltimeterReading.
-
- \sa QAltimeterReading
-*/
-
-/*!
- Construct the sensor as a child of \a parent.
-*/
-QAltimeter::QAltimeter(QObject *parent)
- : QSensor(QAltimeter::type, parent)
-{
-}
-
-/*!
- Destroy the sensor. Stops the sensor if it has not already been stopped.
-*/
-QAltimeter::~QAltimeter()
-{
-}
-
-/*!
- \fn QAltimeter::reading() const
-
- Returns the reading class for this sensor.
-
- \sa QSensor::reading()
-*/
-
-QAltimeterReading *QAltimeter::reading() const
-{
- return static_cast<QAltimeterReading*>(QSensor::reading());
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qaltimeter.cpp"
diff --git a/src/sensors/qaltimeter.h b/src/sensors/qaltimeter.h
deleted file mode 100644
index 50c9e83b..00000000
--- a/src/sensors/qaltimeter.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Research In Motion
-** 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 QALTIMETER_H
-#define QALTIMETER_H
-
-#include <QtSensors/qsensor.h>
-
-QT_BEGIN_NAMESPACE
-
-class QAltimeterReadingPrivate;
-
-class Q_SENSORS_EXPORT QAltimeterReading : public QSensorReading
-{
- Q_OBJECT
- Q_PROPERTY(qreal altitude READ altitude)
- DECLARE_READING(QAltimeterReading)
-public:
- qreal altitude() const;
- void setAltitude(qreal altitude);
-};
-
-class Q_SENSORS_EXPORT QAltimeterFilter : public QSensorFilter
-{
-public:
- virtual bool filter(QAltimeterReading *reading) = 0;
-private:
- bool filter(QSensorReading *reading) override;
-};
-
-class Q_SENSORS_EXPORT QAltimeter : public QSensor
-{
- Q_OBJECT
-public:
- explicit QAltimeter(QObject *parent = Q_NULLPTR);
- ~QAltimeter();
- QAltimeterReading *reading() const;
- static char const * const type;
-
-private:
- Q_DISABLE_COPY(QAltimeter)
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/sensors/qaltimeter_p.h b/src/sensors/qaltimeter_p.h
deleted file mode 100644
index b1231c24..00000000
--- a/src/sensors/qaltimeter_p.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Research In Motion
-** 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 QALTIMETER_P_H
-#define QALTIMETER_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.
-//
-
-QT_BEGIN_NAMESPACE
-
-class QAltimeterReadingPrivate
-{
-public:
- QAltimeterReadingPrivate()
- : altitude(0)
- {
- }
-
- qreal altitude;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/sensors/qambientlightsensor.cpp b/src/sensors/qambientlightsensor.cpp
index dd86ae2e..c7bec4c7 100644
--- a/src/sensors/qambientlightsensor.cpp
+++ b/src/sensors/qambientlightsensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qambientlightsensor.h"
#include "qambientlightsensor_p.h"
@@ -131,7 +95,7 @@ bool QAmbientLightFilter::filter(QSensorReading *reading)
return filter(static_cast<QAmbientLightReading*>(reading));
}
-char const * const QAmbientLightSensor::type("QAmbientLightSensor");
+char const * const QAmbientLightSensor::sensorType("QAmbientLightSensor");
/*!
\class QAmbientLightSensor
@@ -154,7 +118,7 @@ char const * const QAmbientLightSensor::type("QAmbientLightSensor");
Construct the sensor as a child of \a parent.
*/
QAmbientLightSensor::QAmbientLightSensor(QObject *parent)
- : QSensor(QAmbientLightSensor::type, parent)
+ : QSensor(QAmbientLightSensor::sensorType, parent)
{
}
diff --git a/src/sensors/qambientlightsensor.h b/src/sensors/qambientlightsensor.h
index 9d1acec9..962cf4aa 100644
--- a/src/sensors/qambientlightsensor.h
+++ b/src/sensors/qambientlightsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QAMBIENTLIGHTSENSOR_H
#define QAMBIENTLIGHTSENSOR_H
@@ -49,7 +13,6 @@ class QAmbientLightReadingPrivate;
class Q_SENSORS_EXPORT QAmbientLightReading : public QSensorReading
{
Q_OBJECT
- Q_ENUMS(LightLevel)
Q_PROPERTY(LightLevel lightLevel READ lightLevel)
DECLARE_READING(QAmbientLightReading)
public:
@@ -61,6 +24,7 @@ public:
Bright,
Sunny
};
+ Q_ENUM(LightLevel)
LightLevel lightLevel() const;
void setLightLevel(LightLevel lightLevel);
@@ -78,10 +42,10 @@ class Q_SENSORS_EXPORT QAmbientLightSensor : public QSensor
{
Q_OBJECT
public:
- explicit QAmbientLightSensor(QObject *parent = Q_NULLPTR);
+ explicit QAmbientLightSensor(QObject *parent = nullptr);
virtual ~QAmbientLightSensor();
QAmbientLightReading *reading() const;
- static char const * const type;
+ static char const * const sensorType;
private:
Q_DISABLE_COPY(QAmbientLightSensor)
@@ -90,4 +54,3 @@ private:
QT_END_NAMESPACE
#endif
-
diff --git a/src/sensors/qambientlightsensor_p.h b/src/sensors/qambientlightsensor_p.h
index ed0a8c26..ace40c33 100644
--- a/src/sensors/qambientlightsensor_p.h
+++ b/src/sensors/qambientlightsensor_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QAMBIENTLIGHTSENSOR_P_H
#define QAMBIENTLIGHTSENSOR_P_H
@@ -51,6 +15,8 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
+
QT_BEGIN_NAMESPACE
class QAmbientLightReadingPrivate
diff --git a/src/sensors/qambienttemperaturesensor.cpp b/src/sensors/qambienttemperaturesensor.cpp
index 53cce0a9..7c94a66d 100644
--- a/src/sensors/qambienttemperaturesensor.cpp
+++ b/src/sensors/qambienttemperaturesensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Research In Motion
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Research In Motion
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qambienttemperaturesensor.h>
#include "qambienttemperaturesensor_p.h"
@@ -101,7 +65,7 @@ bool QAmbientTemperatureFilter::filter(QSensorReading *reading)
return filter(static_cast<QAmbientTemperatureReading*>(reading));
}
-char const * const QAmbientTemperatureSensor::type("QAmbientTemperatureSensor");
+char const * const QAmbientTemperatureSensor::sensorType("QAmbientTemperatureSensor");
/*!
\class QAmbientTemperatureSensor
@@ -124,7 +88,7 @@ char const * const QAmbientTemperatureSensor::type("QAmbientTemperatureSensor");
Construct the sensor as a child of \a parent.
*/
QAmbientTemperatureSensor::QAmbientTemperatureSensor(QObject *parent)
- : QSensor(QAmbientTemperatureSensor::type, parent)
+ : QSensor(QAmbientTemperatureSensor::sensorType, parent)
{
}
diff --git a/src/sensors/qambienttemperaturesensor.h b/src/sensors/qambienttemperaturesensor.h
index 4198b15a..f31916fd 100644
--- a/src/sensors/qambienttemperaturesensor.h
+++ b/src/sensors/qambienttemperaturesensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Research In Motion
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Research In Motion
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QAMBIENTTEMPERATURESENSOR_H
#define QAMBIENTTEMPERATURESENSOR_H
@@ -67,10 +31,10 @@ class Q_SENSORS_EXPORT QAmbientTemperatureSensor : public QSensor
{
Q_OBJECT
public:
- explicit QAmbientTemperatureSensor(QObject *parent = Q_NULLPTR);
+ explicit QAmbientTemperatureSensor(QObject *parent = nullptr);
~QAmbientTemperatureSensor();
QAmbientTemperatureReading *reading() const;
- static char const * const type;
+ static char const * const sensorType;
private:
Q_DISABLE_COPY(QAmbientTemperatureSensor)
diff --git a/src/sensors/qambienttemperaturesensor_p.h b/src/sensors/qambienttemperaturesensor_p.h
index 7847925e..177dd267 100644
--- a/src/sensors/qambienttemperaturesensor_p.h
+++ b/src/sensors/qambienttemperaturesensor_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Research In Motion
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Research In Motion
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QAMBIENTTEMPERATURESENSOR_P_H
#define QAMBIENTTEMPERATURESENSOR_P_H
@@ -50,6 +14,8 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
+
QT_BEGIN_NAMESPACE
class QAmbientTemperatureReadingPrivate
diff --git a/src/sensors/qcompass.cpp b/src/sensors/qcompass.cpp
index 5bd2101b..cb689c30 100644
--- a/src/sensors/qcompass.cpp
+++ b/src/sensors/qcompass.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qcompass.h"
#include "qcompass_p.h"
@@ -141,7 +105,7 @@ bool QCompassFilter::filter(QSensorReading *reading)
return filter(static_cast<QCompassReading*>(reading));
}
-char const * const QCompass::type("QCompass");
+char const * const QCompass::sensorType("QCompass");
/*!
\class QCompass
@@ -164,7 +128,7 @@ char const * const QCompass::type("QCompass");
Construct the sensor as a child of \a parent.
*/
QCompass::QCompass(QObject *parent)
- : QSensor(QCompass::type, parent)
+ : QSensor(QCompass::sensorType, parent)
{
}
diff --git a/src/sensors/qcompass.h b/src/sensors/qcompass.h
index 0d22c746..3892298a 100644
--- a/src/sensors/qcompass.h
+++ b/src/sensors/qcompass.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QCOMPASS_H
#define QCOMPASS_H
@@ -72,10 +36,10 @@ class Q_SENSORS_EXPORT QCompass : public QSensor
{
Q_OBJECT
public:
- explicit QCompass(QObject *parent = Q_NULLPTR);
+ explicit QCompass(QObject *parent = nullptr);
virtual ~QCompass();
QCompassReading *reading() const;
- static char const * const type;
+ static char const * const sensorType;
private:
Q_DISABLE_COPY(QCompass)
diff --git a/src/sensors/qcompass_p.h b/src/sensors/qcompass_p.h
index bb45f205..9f8d7b74 100644
--- a/src/sensors/qcompass_p.h
+++ b/src/sensors/qcompass_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QCOMPASS_P_H
#define QCOMPASS_P_H
@@ -51,6 +15,8 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
+
QT_BEGIN_NAMESPACE
class QCompassReadingPrivate
diff --git a/src/sensors/qdistancesensor.cpp b/src/sensors/qdistancesensor.cpp
deleted file mode 100644
index 916218f8..00000000
--- a/src/sensors/qdistancesensor.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
- /****************************************************************************
- **
- ** Copyright (C) 2016 BlackBerry Limited. All rights reserved.
- ** 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 <qdistancesensor.h>
-#include "qdistancesensor_p.h"
-
-QT_BEGIN_NAMESPACE
-
-IMPLEMENT_READING(QDistanceReading)
-
-/*!
- \class QDistanceReading
- \ingroup sensors_reading
- \inmodule QtSensors
- \since 5.4
-
- \brief The QDistanceReading class holds distance reading in cm from the proximity sensor.
-
- The QDistanceReading class holds distance reading in cm from the proximity sensor.
- Note: Some proximity sensor only support two values for distance, a near and far value.
- In this case, the sensor should report its maximum range value to represent the far state,
- and a lesser value to represent the near state.
-
- \section2 QDistanceReading Units
- The distance is measured in cm
-
- The distance sensor is typically located in the front face of a device, and thus will
- measure the distance of an object from the device's front face.
-*/
-
-/*!
- \property QDistanceReading::distance
- \brief distance of object from front face of device
-
- \sa {QDistanceReading Units}
-*/
-
-qreal QDistanceReading::distance() const
-{
- return d->distance;
-}
-
-/*!
- Sets distance to \a distance.
-*/
-void QDistanceReading::setDistance(qreal distance)
-{
- d->distance = distance;
-}
-
-// =====================================================================
-
-/*!
- \class QDistanceFilter
- \ingroup sensors_filter
- \inmodule QtSensors
- \since 5.4
-
- \brief The QDistanceFilter class is a convenience wrapper around QSensorFilter.
-
- The only difference is that the filter() method features a pointer to QDistanceReading
- instead of QSensorReading.
-*/
-
-/*!
- \fn QDistanceFilter::filter(QDistanceReading *reading)
-
- Called when \a reading changes. Returns false to prevent the reading from propagating.
-
- \sa QSensorFilter::filter()
-*/
-
-bool QDistanceFilter::filter(QSensorReading *reading)
-{
- return filter(static_cast<QDistanceReading*>(reading));
-}
-
-char const * const QDistanceSensor::type("QDistanceSensor");
-
-/*!
- \class QDistanceSensor
- \ingroup sensors_type
- \inmodule QtSensors
- \since 5.4
-
- \brief The QDistanceSensor class is a convenience wrapper around QSensor.
-
- The only behavioral difference is that this class sets the type properly.
-
- This class also features a reading() function that returns a QDistanceReading instead of a QSensorReading.
-
- For details about how the sensor works, see \l QDistanceReading.
-
- \sa QDistanceReading
-*/
-
-/*!
- Construct the sensor as a child of \a parent.
-*/
-QDistanceSensor::QDistanceSensor(QObject *parent)
- : QSensor(QDistanceSensor::type, parent)
-{
-}
-
-/*!
- Destroy the sensor. Stops the sensor if it has not already been stopped.
-*/
-QDistanceSensor::~QDistanceSensor()
-{
-}
-
-/*!
- \fn QDistanceSensor::reading() const
-
- Returns the reading class for this sensor.
-
- \sa QSensor::reading()
-*/
-
-QDistanceReading *QDistanceSensor::reading() const
-{
- return static_cast<QDistanceReading*>(QSensor::reading());
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qdistancesensor.cpp"
diff --git a/src/sensors/qdistancesensor.h b/src/sensors/qdistancesensor.h
deleted file mode 100644
index a6aef947..00000000
--- a/src/sensors/qdistancesensor.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 BlackBerry Limited. All rights reserved.
-** 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 QDISTANCESENSOR_H
-#define QDISTANCESENSOR_H
-
-#include <QtSensors/qsensor.h>
-
-QT_BEGIN_NAMESPACE
-
-class QDistanceReadingPrivate;
-
-class Q_SENSORS_EXPORT QDistanceReading : public QSensorReading
-{
- Q_OBJECT
- Q_PROPERTY(qreal distance READ distance)
- DECLARE_READING(QDistanceReading)
-public:
- qreal distance() const;
- void setDistance(qreal distance);
-};
-
-class Q_SENSORS_EXPORT QDistanceFilter : public QSensorFilter
-{
-public:
- virtual bool filter(QDistanceReading *reading) = 0;
-private:
- bool filter(QSensorReading *reading) override;
-};
-
-class Q_SENSORS_EXPORT QDistanceSensor : public QSensor
-{
- Q_OBJECT
-public:
- explicit QDistanceSensor(QObject *parent = Q_NULLPTR);
- ~QDistanceSensor();
- QDistanceReading *reading() const;
- static char const * const type;
-
-private:
- Q_DISABLE_COPY(QDistanceSensor)
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/sensors/qdistancesensor_p.h b/src/sensors/qdistancesensor_p.h
deleted file mode 100644
index 262fdb1e..00000000
--- a/src/sensors/qdistancesensor_p.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 BlackBerry Limited. All rights reserved.
-** 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 QDISTANCESENSOR_P_H
-#define QDISTANCESENSOR_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.
-//
-
-QT_BEGIN_NAMESPACE
-
-class QDistanceReadingPrivate
-{
-public:
- QDistanceReadingPrivate()
- : distance(0.0)
- {
- }
-
- /*
- * Note that this class is copied so you may need to implement
- * a copy constructor if you have complex types or pointers
- * as values.
- */
-
- qreal distance;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/sensors/qgyroscope.cpp b/src/sensors/qgyroscope.cpp
index 585da99b..8ffd6934 100644
--- a/src/sensors/qgyroscope.cpp
+++ b/src/sensors/qgyroscope.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qgyroscope.h"
#include "qgyroscope_p.h"
@@ -153,7 +117,7 @@ bool QGyroscopeFilter::filter(QSensorReading *reading)
return filter(static_cast<QGyroscopeReading*>(reading));
}
-char const * const QGyroscope::type("QGyroscope");
+char const * const QGyroscope::sensorType("QGyroscope");
/*!
\class QGyroscope
@@ -176,7 +140,7 @@ char const * const QGyroscope::type("QGyroscope");
Construct the sensor as a child of \a parent.
*/
QGyroscope::QGyroscope(QObject *parent)
- : QSensor(QGyroscope::type, parent)
+ : QSensor(QGyroscope::sensorType, parent)
{
}
diff --git a/src/sensors/qgyroscope.h b/src/sensors/qgyroscope.h
index 7d7e287e..43c1a452 100644
--- a/src/sensors/qgyroscope.h
+++ b/src/sensors/qgyroscope.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QGYROSCOPE_H
#define QGYROSCOPE_H
@@ -76,10 +40,10 @@ class Q_SENSORS_EXPORT QGyroscope : public QSensor
{
Q_OBJECT
public:
- explicit QGyroscope(QObject *parent = Q_NULLPTR);
+ explicit QGyroscope(QObject *parent = nullptr);
virtual ~QGyroscope();
QGyroscopeReading *reading() const;
- static char const * const type;
+ static char const * const sensorType;
private:
Q_DISABLE_COPY(QGyroscope)
diff --git a/src/sensors/qgyroscope_p.h b/src/sensors/qgyroscope_p.h
index b8158421..dcc552cd 100644
--- a/src/sensors/qgyroscope_p.h
+++ b/src/sensors/qgyroscope_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QGYROSCOPE_P_H
#define QGYROSCOPE_P_H
@@ -51,6 +15,8 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
+
QT_BEGIN_NAMESPACE
class QGyroscopeReadingPrivate
diff --git a/src/sensors/qholstersensor.cpp b/src/sensors/qholstersensor.cpp
deleted file mode 100644
index 8bb14748..00000000
--- a/src/sensors/qholstersensor.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Research In Motion
-** 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 <qholstersensor.h>
-#include "qholstersensor_p.h"
-
-QT_BEGIN_NAMESPACE
-
-IMPLEMENT_READING(QHolsterReading)
-
-/*!
- \class QHolsterReading
- \ingroup sensors_reading
- \inmodule QtSensors
- \since 5.1
-
- \brief The QHolsterReading class holds readings from the holster sensor.
-
- \section2 QHolsterReading Units
- The holster sensor can detect if a device is holstered or not. A holster is a pocket,
- similar to a gun holster, specifically made for the device. If the device is inside of this
- pocket, it is holstered. The holster supports the device in detecting whether the device is
- holstered or not.
-*/
-
-/*!
- \property QHolsterReading::holstered
- \brief A value indicating whether the device is holstered.
-
- \sa {QHolsterReading Units}
-*/
-
-bool QHolsterReading::holstered() const
-{
- return d->holstered;
-}
-
-/*!
- Sets the holstered value to \a holstered.
-*/
-void QHolsterReading::setHolstered(bool holstered)
-{
- d->holstered = holstered;
-}
-
-// =====================================================================
-
-/*!
- \class QHolsterFilter
- \ingroup sensors_filter
- \inmodule QtSensors
- \since 5.1
-
- \brief The QHolsterFilter class is a convenience wrapper around QSensorFilter.
-
- The only difference is that the filter() method features a pointer to QHolsterReading
- instead of QSensorReading.
-*/
-
-/*!
- \fn QHolsterFilter::filter(QHolsterReading *reading)
-
- Called when \a reading changes. Returns false to prevent the reading from propagating.
-
- \sa QSensorFilter::filter()
-*/
-
-bool QHolsterFilter::filter(QSensorReading *reading)
-{
- return filter(static_cast<QHolsterReading*>(reading));
-}
-
-char const * const QHolsterSensor::type("QHolsterSensor");
-
-/*!
- \class QHolsterSensor
- \ingroup sensors_type
- \inmodule QtSensors
- \since 5.1
-
- \brief The QHolsterSensor class is a convenience wrapper around QSensor.
-
- The only behavioural difference is that this class sets the type properly.
-
- This class also features a reading() function that returns a QHolsterReading instead of a QSensorReading.
-
- For details about how the sensor works, see \l QHolsterReading.
-
- \sa QHolsterReading
-*/
-
-/*!
- Construct the sensor as a child of \a parent.
-*/
-QHolsterSensor::QHolsterSensor(QObject *parent)
- : QSensor(QHolsterSensor::type, parent)
-{
-}
-
-/*!
- Destroy the sensor. Stops the sensor if it has not already been stopped.
-*/
-QHolsterSensor::~QHolsterSensor()
-{
-}
-
-/*!
- \fn QHolsterSensor::reading() const
-
- Returns the reading class for this sensor.
-
- \sa QSensor::reading()
-*/
-
-QHolsterReading *QHolsterSensor::reading() const
-{
- return static_cast<QHolsterReading*>(QSensor::reading());
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qholstersensor.cpp"
diff --git a/src/sensors/qholstersensor.h b/src/sensors/qholstersensor.h
deleted file mode 100644
index 43d02899..00000000
--- a/src/sensors/qholstersensor.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Research In Motion
-** 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 QHOLSTERSENSOR_H
-#define QHOLSTERSENSOR_H
-
-#include <QtSensors/qsensor.h>
-
-QT_BEGIN_NAMESPACE
-
-class QHolsterReadingPrivate;
-
-class Q_SENSORS_EXPORT QHolsterReading : public QSensorReading
-{
- Q_OBJECT
- Q_PROPERTY(bool holstered READ holstered)
- DECLARE_READING(QHolsterReading)
-public:
- bool holstered() const;
- void setHolstered(bool holstered);
-};
-
-class Q_SENSORS_EXPORT QHolsterFilter : public QSensorFilter
-{
-public:
- virtual bool filter(QHolsterReading *reading) = 0;
-private:
- bool filter(QSensorReading *reading) override;
-};
-
-class Q_SENSORS_EXPORT QHolsterSensor : public QSensor
-{
- Q_OBJECT
-public:
- explicit QHolsterSensor(QObject *parent = Q_NULLPTR);
- ~QHolsterSensor();
- QHolsterReading *reading() const;
- static char const * const type;
-
-private:
- Q_DISABLE_COPY(QHolsterSensor)
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/sensors/qholstersensor_p.h b/src/sensors/qholstersensor_p.h
deleted file mode 100644
index 3d8b9801..00000000
--- a/src/sensors/qholstersensor_p.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Research In Motion
-** 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 QHOLSTERSENSOR_P_H
-#define QHOLSTERSENSOR_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.
-//
-
-QT_BEGIN_NAMESPACE
-
-class QHolsterReadingPrivate
-{
-public:
- QHolsterReadingPrivate()
- : holstered(false)
- {
- }
-
- bool holstered;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/sensors/qhumiditysensor.cpp b/src/sensors/qhumiditysensor.cpp
index e566c6a6..9c0db944 100644
--- a/src/sensors/qhumiditysensor.cpp
+++ b/src/sensors/qhumiditysensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Canonical 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Canonical Ltd
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qhumiditysensor.h>
#include "qhumiditysensor_p.h"
@@ -129,7 +93,7 @@ bool QHumidityFilter::filter(QSensorReading *reading)
return filter(static_cast<QHumidityReading*>(reading));
}
-char const * const QHumiditySensor::type("QHumiditySensor");
+char const * const QHumiditySensor::sensorType("QHumiditySensor");
/*!
@@ -153,7 +117,7 @@ char const * const QHumiditySensor::type("QHumiditySensor");
Construct the sensor as a child of \a parent.
*/
QHumiditySensor::QHumiditySensor(QObject *parent)
- : QSensor(QHumiditySensor::type, parent)
+ : QSensor(QHumiditySensor::sensorType, parent)
{
}
diff --git a/src/sensors/qhumiditysensor.h b/src/sensors/qhumiditysensor.h
index f24d2be2..76a83b2c 100644
--- a/src/sensors/qhumiditysensor.h
+++ b/src/sensors/qhumiditysensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Canonical 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Canonical Ltd
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QHUMIDITYSENSOR_H
#define QHUMIDITYSENSOR_H
@@ -75,11 +39,11 @@ class Q_SENSORS_EXPORT QHumiditySensor : public QSensor
{
Q_OBJECT
public:
- explicit QHumiditySensor(QObject *parent = Q_NULLPTR);
+ explicit QHumiditySensor(QObject *parent = nullptr);
~QHumiditySensor();
QHumidityReading *reading() const;
- static char const * const type;
+ static char const * const sensorType;
private:
Q_DECLARE_PRIVATE(QHumiditySensor)
diff --git a/src/sensors/qhumiditysensor_p.h b/src/sensors/qhumiditysensor_p.h
index 95b070ea..1d357c98 100644
--- a/src/sensors/qhumiditysensor_p.h
+++ b/src/sensors/qhumiditysensor_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Canonical 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Canonical Ltd
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QHUMIDITYSENSOR_P_H
#define QHUMIDITYSENSOR_P_H
diff --git a/src/sensors/qirproximitysensor.cpp b/src/sensors/qirproximitysensor.cpp
index 2be5a43a..4d205d05 100644
--- a/src/sensors/qirproximitysensor.cpp
+++ b/src/sensors/qirproximitysensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qirproximitysensor.h>
#include "qirproximitysensor_p.h"
@@ -49,6 +13,7 @@ IMPLEMENT_READING(QIRProximityReading)
\ingroup sensors_reading
\inmodule QtSensors
\since 5.1
+ \internal
\brief The QIRProximityReading class holds readings from the IR proximity sensor.
@@ -101,6 +66,7 @@ void QIRProximityReading::setReflectance(qreal reflectance)
\ingroup sensors_filter
\inmodule QtSensors
\since 5.1
+ \internal
\brief The QIRProximityFilter class is a convenience wrapper around QSensorFilter.
@@ -121,13 +87,14 @@ bool QIRProximityFilter::filter(QSensorReading *reading)
return filter(static_cast<QIRProximityReading*>(reading));
}
-char const * const QIRProximitySensor::type("QIRProximitySensor");
+char const * const QIRProximitySensor::sensorType("QIRProximitySensor");
/*!
\class QIRProximitySensor
\ingroup sensors_type
\inmodule QtSensors
\since 5.1
+ \internal
\brief The QIRProximitySensor class is a convenience wrapper around QSensor.
@@ -144,7 +111,7 @@ char const * const QIRProximitySensor::type("QIRProximitySensor");
Construct the sensor as a child of \a parent.
*/
QIRProximitySensor::QIRProximitySensor(QObject *parent)
- : QSensor(QIRProximitySensor::type, parent)
+ : QSensor(QIRProximitySensor::sensorType, parent)
{
}
diff --git a/src/sensors/qirproximitysensor.h b/src/sensors/qirproximitysensor.h
index 2941d6e0..ce22ab39 100644
--- a/src/sensors/qirproximitysensor.h
+++ b/src/sensors/qirproximitysensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QIRPROXIMITYSENSOR_H
#define QIRPROXIMITYSENSOR_H
@@ -68,10 +32,10 @@ class Q_SENSORS_EXPORT QIRProximitySensor : public QSensor
{
Q_OBJECT
public:
- explicit QIRProximitySensor(QObject *parent = Q_NULLPTR);
+ explicit QIRProximitySensor(QObject *parent = nullptr);
virtual ~QIRProximitySensor();
QIRProximityReading *reading() const;
- static char const * const type;
+ static char const * const sensorType;
private:
Q_DISABLE_COPY(QIRProximitySensor)
diff --git a/src/sensors/qirproximitysensor_p.h b/src/sensors/qirproximitysensor_p.h
index 02c8275f..fb850928 100644
--- a/src/sensors/qirproximitysensor_p.h
+++ b/src/sensors/qirproximitysensor_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QIRPROXIMITYSENSOR_P_H
#define QIRPROXIMITYSENSOR_P_H
@@ -51,6 +15,8 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
+
QT_BEGIN_NAMESPACE
class QIRProximityReadingPrivate
diff --git a/src/sensors/qlidsensor.cpp b/src/sensors/qlidsensor.cpp
index 893987b7..bc413242 100644
--- a/src/sensors/qlidsensor.cpp
+++ b/src/sensors/qlidsensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Canonical, 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Canonical, Ltd
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qlidsensor.h>
#include "qlidsensor_p.h"
@@ -48,6 +12,7 @@ IMPLEMENT_READING(QLidReading)
\ingroup sensors_reading
\inmodule QtSensors
\since 5.9
+ \internal
\brief The QLidReading class holds readings from the Lid sensor.
@@ -110,6 +75,7 @@ void QLidReading::setFrontLidClosed(bool closed)
\ingroup sensors_filter
\inmodule QtSensors
\since 5.9
+ \internal
\brief The QLidFilter class is a convenience wrapper around QSensorFilter.
@@ -130,13 +96,14 @@ bool QLidFilter::filter(QSensorReading *reading)
return filter(static_cast<QLidReading*>(reading));
}
-char const * const QLidSensor::type("QLidSensor");
+char const * const QLidSensor::sensorType("QLidSensor");
/*!
\class QLidSensor
\ingroup sensors_type
\inmodule QtSensors
\since 5.9
+ \internal
\brief The QLidSensor class is a convenience wrapper around QSensor.
@@ -154,7 +121,7 @@ char const * const QLidSensor::type("QLidSensor");
Construct the sensor as a child of \a parent.
*/
QLidSensor::QLidSensor(QObject *parent)
- : QSensor(QLidSensor::type, parent)
+ : QSensor(QLidSensor::sensorType, parent)
{
}
diff --git a/src/sensors/qlidsensor.h b/src/sensors/qlidsensor.h
index f7992cac..c0861ff9 100644
--- a/src/sensors/qlidsensor.h
+++ b/src/sensors/qlidsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Canonical, 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Canonical, Ltd
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QLIDSENSOR_H
#define QLIDSENSOR_H
@@ -76,10 +40,10 @@ class Q_SENSORS_EXPORT QLidSensor : public QSensor
{
Q_OBJECT
public:
- explicit QLidSensor(QObject *parent = Q_NULLPTR);
+ explicit QLidSensor(QObject *parent = nullptr);
~QLidSensor();
QLidReading *reading() const;
- static char const * const type;
+ static char const * const sensorType;
private:
Q_DISABLE_COPY(QLidSensor)
diff --git a/src/sensors/qlidsensor_p.h b/src/sensors/qlidsensor_p.h
index 93d3b99e..ff14c0bd 100644
--- a/src/sensors/qlidsensor_p.h
+++ b/src/sensors/qlidsensor_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Canonical, 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Canonical, Ltd
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QLIDSENSOR_P_H
#define QLIDSENSOR_P_H
@@ -50,6 +14,8 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
+
QT_BEGIN_NAMESPACE
class QLidReadingPrivate
diff --git a/src/sensors/qlightsensor.cpp b/src/sensors/qlightsensor.cpp
index efff15f9..0803f0e5 100644
--- a/src/sensors/qlightsensor.cpp
+++ b/src/sensors/qlightsensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qlightsensor.h"
#include "qlightsensor_p.h"
@@ -105,7 +69,7 @@ bool QLightFilter::filter(QSensorReading *reading)
return filter(static_cast<QLightReading*>(reading));
}
-char const * const QLightSensor::type("QLightSensor");
+char const * const QLightSensor::sensorType("QLightSensor");
/*!
\class QLightSensor
@@ -128,7 +92,7 @@ char const * const QLightSensor::type("QLightSensor");
Construct the sensor as a child of \a parent.
*/
QLightSensor::QLightSensor(QObject *parent)
- : QSensor(QLightSensor::type, *new QLightSensorPrivate, parent)
+ : QSensor(QLightSensor::sensorType, *new QLightSensorPrivate, parent)
{
}
diff --git a/src/sensors/qlightsensor.h b/src/sensors/qlightsensor.h
index 03f1871e..89dfbcd5 100644
--- a/src/sensors/qlightsensor.h
+++ b/src/sensors/qlightsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QLIGHTSENSOR_H
#define QLIGHTSENSOR_H
@@ -71,10 +35,10 @@ class Q_SENSORS_EXPORT QLightSensor : public QSensor
Q_OBJECT
Q_PROPERTY(qreal fieldOfView READ fieldOfView NOTIFY fieldOfViewChanged)
public:
- explicit QLightSensor(QObject *parent = Q_NULLPTR);
+ explicit QLightSensor(QObject *parent = nullptr);
virtual ~QLightSensor();
QLightReading *reading() const;
- static char const * const type;
+ static char const * const sensorType;
qreal fieldOfView() const;
void setFieldOfView(qreal fieldOfView);
diff --git a/src/sensors/qlightsensor_p.h b/src/sensors/qlightsensor_p.h
index f57b6088..4a570ca2 100644
--- a/src/sensors/qlightsensor_p.h
+++ b/src/sensors/qlightsensor_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QLIGHTSENSOR_P_H
#define QLIGHTSENSOR_P_H
diff --git a/src/sensors/qmagnetometer.cpp b/src/sensors/qmagnetometer.cpp
index ac2231ec..601ebb0a 100644
--- a/src/sensors/qmagnetometer.cpp
+++ b/src/sensors/qmagnetometer.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qmagnetometer.h"
#include "qmagnetometer_p.h"
@@ -199,7 +163,7 @@ bool QMagnetometerFilter::filter(QSensorReading *reading)
return filter(static_cast<QMagnetometerReading*>(reading));
}
-char const * const QMagnetometer::type("QMagnetometer");
+char const * const QMagnetometer::sensorType("QMagnetometer");
/*!
\class QMagnetometer
@@ -222,7 +186,7 @@ char const * const QMagnetometer::type("QMagnetometer");
Construct the sensor as a child of \a parent.
*/
QMagnetometer::QMagnetometer(QObject *parent)
- : QSensor(QMagnetometer::type, *new QMagnetometerPrivate, parent)
+ : QSensor(QMagnetometer::sensorType, *new QMagnetometerPrivate, parent)
{
}
diff --git a/src/sensors/qmagnetometer.h b/src/sensors/qmagnetometer.h
index f8b0fbfb..2e55a504 100644
--- a/src/sensors/qmagnetometer.h
+++ b/src/sensors/qmagnetometer.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QMAGNETOMETER_H
#define QMAGNETOMETER_H
@@ -83,10 +47,10 @@ class Q_SENSORS_EXPORT QMagnetometer : public QSensor
Q_OBJECT
Q_PROPERTY(bool returnGeoValues READ returnGeoValues WRITE setReturnGeoValues NOTIFY returnGeoValuesChanged)
public:
- explicit QMagnetometer(QObject *parent = Q_NULLPTR);
+ explicit QMagnetometer(QObject *parent = nullptr);
virtual ~QMagnetometer();
QMagnetometerReading *reading() const;
- static char const * const type;
+ static char const * const sensorType;
bool returnGeoValues() const;
void setReturnGeoValues(bool returnGeoValues);
diff --git a/src/sensors/qmagnetometer_p.h b/src/sensors/qmagnetometer_p.h
index 634378d5..7052e9e8 100644
--- a/src/sensors/qmagnetometer_p.h
+++ b/src/sensors/qmagnetometer_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QMAGNETOMETER_P_H
#define QMAGNETOMETER_P_H
@@ -59,7 +23,7 @@ class QMagnetometerPrivate : public QSensorPrivate
{
public:
QMagnetometerPrivate()
- : returnGeoValues(false)
+ : returnGeoValues(true)
{
}
diff --git a/src/sensors/qorientationsensor.cpp b/src/sensors/qorientationsensor.cpp
index 91d10749..4e0702f6 100644
--- a/src/sensors/qorientationsensor.cpp
+++ b/src/sensors/qorientationsensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qorientationsensor.h"
#include "qorientationsensor_p.h"
@@ -154,7 +118,7 @@ bool QOrientationFilter::filter(QSensorReading *reading)
return filter(static_cast<QOrientationReading*>(reading));
}
-char const * const QOrientationSensor::type("QOrientationSensor");
+char const * const QOrientationSensor::sensorType("QOrientationSensor");
/*!
\class QOrientationSensor
@@ -177,7 +141,7 @@ char const * const QOrientationSensor::type("QOrientationSensor");
Construct the sensor as a child of \a parent.
*/
QOrientationSensor::QOrientationSensor(QObject *parent)
- : QSensor(QOrientationSensor::type, parent)
+ : QSensor(QOrientationSensor::sensorType, parent)
{
}
diff --git a/src/sensors/qorientationsensor.h b/src/sensors/qorientationsensor.h
index 89823ca2..b9436822 100644
--- a/src/sensors/qorientationsensor.h
+++ b/src/sensors/qorientationsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QORIENTATIONSENSOR_H
#define QORIENTATIONSENSOR_H
@@ -49,7 +13,6 @@ class QOrientationReadingPrivate;
class Q_SENSORS_EXPORT QOrientationReading : public QSensorReading
{
Q_OBJECT
- Q_ENUMS(Orientation)
Q_PROPERTY(Orientation orientation READ orientation)
DECLARE_READING(QOrientationReading)
public:
@@ -62,6 +25,7 @@ public:
FaceUp,
FaceDown
};
+ Q_ENUM(Orientation)
Orientation orientation() const;
void setOrientation(Orientation orientation);
@@ -79,10 +43,10 @@ class Q_SENSORS_EXPORT QOrientationSensor : public QSensor
{
Q_OBJECT
public:
- explicit QOrientationSensor(QObject *parent = Q_NULLPTR);
+ explicit QOrientationSensor(QObject *parent = nullptr);
virtual ~QOrientationSensor();
QOrientationReading *reading() const;
- static char const * const type;
+ static char const * const sensorType;
private:
Q_DISABLE_COPY(QOrientationSensor)
@@ -91,4 +55,3 @@ private:
QT_END_NAMESPACE
#endif
-
diff --git a/src/sensors/qorientationsensor_p.h b/src/sensors/qorientationsensor_p.h
index 69b70157..4c39817c 100644
--- a/src/sensors/qorientationsensor_p.h
+++ b/src/sensors/qorientationsensor_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QORIENTATIONSENSOR_P_H
#define QORIENTATIONSENSOR_P_H
@@ -51,6 +15,8 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
+
QT_BEGIN_NAMESPACE
class QOrientationReadingPrivate
diff --git a/src/sensors/qpressuresensor.cpp b/src/sensors/qpressuresensor.cpp
index 643f1fa1..393e861f 100644
--- a/src/sensors/qpressuresensor.cpp
+++ b/src/sensors/qpressuresensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Research In Motion
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Research In Motion
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qpressuresensor.h>
#include "qpressuresensor_p.h"
@@ -131,7 +95,7 @@ bool QPressureFilter::filter(QSensorReading *reading)
return filter(static_cast<QPressureReading*>(reading));
}
-char const * const QPressureSensor::type("QPressureSensor");
+char const * const QPressureSensor::sensorType("QPressureSensor");
/*!
\class QPressureSensor
@@ -154,7 +118,7 @@ char const * const QPressureSensor::type("QPressureSensor");
Construct the sensor as a child of \a parent.
*/
QPressureSensor::QPressureSensor(QObject *parent)
- : QSensor(QPressureSensor::type, parent)
+ : QSensor(QPressureSensor::sensorType, parent)
{
}
diff --git a/src/sensors/qpressuresensor.h b/src/sensors/qpressuresensor.h
index 29ac235f..a3841b03 100644
--- a/src/sensors/qpressuresensor.h
+++ b/src/sensors/qpressuresensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Research In Motion
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Research In Motion
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPRESSURESENSOR_H
#define QPRESSURESENSOR_H
@@ -71,10 +35,10 @@ class Q_SENSORS_EXPORT QPressureSensor : public QSensor
{
Q_OBJECT
public:
- explicit QPressureSensor(QObject *parent = Q_NULLPTR);
+ explicit QPressureSensor(QObject *parent = nullptr);
~QPressureSensor();
QPressureReading *reading() const;
- static char const * const type;
+ static char const * const sensorType;
private:
Q_DISABLE_COPY(QPressureSensor)
diff --git a/src/sensors/qpressuresensor_p.h b/src/sensors/qpressuresensor_p.h
index 2caa1338..668e3956 100644
--- a/src/sensors/qpressuresensor_p.h
+++ b/src/sensors/qpressuresensor_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Research In Motion
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Research In Motion
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPRESSURESENSOR_P_H
#define QPRESSURESENSOR_P_H
@@ -50,6 +14,8 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
+
QT_BEGIN_NAMESPACE
class QPressureReadingPrivate
diff --git a/src/sensors/qproximitysensor.cpp b/src/sensors/qproximitysensor.cpp
index b568e6cd..73b609e3 100644
--- a/src/sensors/qproximitysensor.cpp
+++ b/src/sensors/qproximitysensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qproximitysensor.h"
#include "qproximitysensor_p.h"
@@ -110,7 +74,7 @@ bool QProximityFilter::filter(QSensorReading *reading)
return filter(static_cast<QProximityReading*>(reading));
}
-char const * const QProximitySensor::type("QProximitySensor");
+char const * const QProximitySensor::sensorType("QProximitySensor");
/*!
\class QProximitySensor
@@ -133,7 +97,7 @@ char const * const QProximitySensor::type("QProximitySensor");
Construct the sensor as a child of \a parent.
*/
QProximitySensor::QProximitySensor(QObject *parent)
- : QSensor(QProximitySensor::type, parent)
+ : QSensor(QProximitySensor::sensorType, parent)
{
}
diff --git a/src/sensors/qproximitysensor.h b/src/sensors/qproximitysensor.h
index 46a8b218..5f7dc3c7 100644
--- a/src/sensors/qproximitysensor.h
+++ b/src/sensors/qproximitysensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPROXIMITYSENSOR_H
#define QPROXIMITYSENSOR_H
@@ -68,10 +32,10 @@ class Q_SENSORS_EXPORT QProximitySensor : public QSensor
{
Q_OBJECT
public:
- explicit QProximitySensor(QObject *parent = Q_NULLPTR);
+ explicit QProximitySensor(QObject *parent = nullptr);
virtual ~QProximitySensor();
QProximityReading *reading() const;
- static char const * const type;
+ static char const * const sensorType;
private:
Q_DISABLE_COPY(QProximitySensor)
diff --git a/src/sensors/qproximitysensor_p.h b/src/sensors/qproximitysensor_p.h
index 81f1604d..63dc5311 100644
--- a/src/sensors/qproximitysensor_p.h
+++ b/src/sensors/qproximitysensor_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPROXIMITYSENSOR_P_H
#define QPROXIMITYSENSOR_P_H
@@ -51,6 +15,8 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
+
QT_BEGIN_NAMESPACE
class QProximityReadingPrivate
diff --git a/src/sensors/qrotationsensor.cpp b/src/sensors/qrotationsensor.cpp
index 44424b50..c1536def 100644
--- a/src/sensors/qrotationsensor.cpp
+++ b/src/sensors/qrotationsensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qrotationsensor.h"
#include "qrotationsensor_p.h"
@@ -184,7 +148,7 @@ bool QRotationFilter::filter(QSensorReading *reading)
return filter(static_cast<QRotationReading*>(reading));
}
-char const * const QRotationSensor::type("QRotationSensor");
+char const * const QRotationSensor::sensorType("QRotationSensor");
/*!
\class QRotationSensor
@@ -207,7 +171,7 @@ char const * const QRotationSensor::type("QRotationSensor");
Construct the sensor as a child of \a parent.
*/
QRotationSensor::QRotationSensor(QObject *parent)
- : QSensor(QRotationSensor::type, *new QRotationSensorPrivate, parent)
+ : QSensor(QRotationSensor::sensorType, *new QRotationSensorPrivate, parent)
{
}
diff --git a/src/sensors/qrotationsensor.h b/src/sensors/qrotationsensor.h
index d6c43acc..be9ecb65 100644
--- a/src/sensors/qrotationsensor.h
+++ b/src/sensors/qrotationsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QROTATIONSENSOR_H
#define QROTATIONSENSOR_H
@@ -76,10 +40,10 @@ class Q_SENSORS_EXPORT QRotationSensor : public QSensor
Q_OBJECT
Q_PROPERTY(bool hasZ READ hasZ NOTIFY hasZChanged)
public:
- explicit QRotationSensor(QObject *parent = Q_NULLPTR);
+ explicit QRotationSensor(QObject *parent = nullptr);
virtual ~QRotationSensor();
QRotationReading *reading() const;
- static char const * const type;
+ static char const * const sensorType;
bool hasZ() const;
void setHasZ(bool hasZ);
diff --git a/src/sensors/qrotationsensor_p.h b/src/sensors/qrotationsensor_p.h
index d1f07669..cc6f8a9a 100644
--- a/src/sensors/qrotationsensor_p.h
+++ b/src/sensors/qrotationsensor_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QROTATIONSENSOR_P_H
#define QROTATIONSENSOR_P_H
diff --git a/src/sensors/qsensor.cpp b/src/sensors/qsensor.cpp
index d8bb0bee..72c58fe8 100644
--- a/src/sensors/qsensor.cpp
+++ b/src/sensors/qsensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qsensor.h"
#include "qsensor_p.h"
@@ -280,7 +244,7 @@ void QSensorPrivate::init(const QByteArray &sensorType)
Only use this constructor if there is no derived sensor class available. Note that all
built-in sensors have a derived class, so using this constructor should only be necessary
- when implementing custom sensors, like in the \l {Qt Sensors - Grue Sensor Example}{Grue sensor example}.
+ when implementing custom sensors.
*/
QSensor::QSensor(const QByteArray &type, QObject *parent)
: QObject(*new QSensorPrivate, parent)
@@ -313,7 +277,7 @@ QSensor::~QSensor()
{
Q_D(QSensor);
stop();
- Q_FOREACH (QSensorFilter *filter, d->filters)
+ for (QSensorFilter *filter : d->filters)
filter->setSensor(0);
delete d->backend;
d->backend = 0;
@@ -364,7 +328,10 @@ void QSensor::setIdentifier(const QByteArray &identifier)
qWarning() << "ERROR: Cannot call QSensor::setIdentifier while connected to a backend!";
return;
}
+ if (d->identifier == identifier)
+ return;
d->identifier = identifier;
+ emit identifierChanged();
}
/*!
@@ -560,9 +527,6 @@ void QSensor::setSkipDuplicates(bool skipDuplicates)
continuous range of rates.
A discrete rate is noted by having both values the same.
- See the sensor_explorer example for an example of how to interpret and use
- this information.
-
Note that this information is not mandatory as not all sensors have a rate at which
they run. In such cases, the list will be empty.
@@ -847,7 +811,7 @@ void QSensor::setOutputRange(int index)
return;
}
bool warn = true;
- if (index >= 0 && index < d->outputRanges.count()) {
+ if (index >= 0 && index < d->outputRanges.size()) {
warn = false;
d->outputRange = index;
}
@@ -1362,7 +1326,7 @@ void QSensorReading::copyValuesFrom(QSensorReading *other)
\code
class MyReading : public QSensorReading
{
- Q_OBJECT
+ \Q_OBJECT
Q_PROPERTY(qreal myprop READ myprop)
DECLARE_READING(MyReading)
public:
@@ -1390,6 +1354,3 @@ void QSensorReading::copyValuesFrom(QSensorReading *other)
*/
QT_END_NAMESPACE
-
-#include "moc_qsensor.cpp"
-
diff --git a/src/sensors/qsensor.h b/src/sensors/qsensor.h
index 7dd7ea19..d6ba3311 100644
--- a/src/sensors/qsensor.h
+++ b/src/sensors/qsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSENSOR_H
#define QSENSOR_H
@@ -56,33 +20,29 @@ class QSensorReading;
class QSensorReadingPrivate;
class QSensorFilter;
-// This type is no longer used in the API but third party apps may be using it
-typedef quint64 qtimestamp;
+using qrange = QPair<int,int>;
+using qrangelist = QList<qrange>;
-typedef QPair<int,int> qrange;
-typedef QList<qrange> qrangelist;
struct qoutputrange
{
qreal minimum;
qreal maximum;
qreal accuracy;
};
-typedef QList<qoutputrange> qoutputrangelist;
+
+using qoutputrangelist = QList<qoutputrange>;
class Q_SENSORS_EXPORT QSensor : public QObject
{
friend class QSensorBackend;
-
Q_OBJECT
- Q_ENUMS(Feature)
- Q_ENUMS(AxesOrientationMode)
- Q_PROPERTY(QByteArray identifier READ identifier WRITE setIdentifier)
- Q_PROPERTY(QByteArray type READ type)
+ Q_PROPERTY(QByteArray identifier READ identifier WRITE setIdentifier NOTIFY identifierChanged)
+ Q_PROPERTY(QByteArray type READ type CONSTANT)
Q_PROPERTY(bool connectedToBackend READ isConnectedToBackend)
Q_PROPERTY(qrangelist availableDataRates READ availableDataRates)
Q_PROPERTY(int dataRate READ dataRate WRITE setDataRate NOTIFY dataRateChanged)
Q_PROPERTY(QSensorReading* reading READ reading NOTIFY readingChanged)
- Q_PROPERTY(bool busy READ isBusy)
+ Q_PROPERTY(bool busy READ isBusy NOTIFY busyChanged)
Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged)
Q_PROPERTY(qoutputrangelist outputRanges READ outputRanges)
Q_PROPERTY(int outputRange READ outputRange WRITE setOutputRange)
@@ -108,6 +68,7 @@ public:
PressureSensorTemperature,
Reserved = 257 // Make sure at least 2 bytes are used for the enum to avoid breaking BC later
};
+ Q_ENUM(Feature)
// Keep in sync with QmlSensor::AxesOrientationMode
enum AxesOrientationMode {
@@ -115,8 +76,9 @@ public:
AutomaticOrientation,
UserOrientation
};
+ Q_ENUM(AxesOrientationMode)
- explicit QSensor(const QByteArray &type, QObject *parent = Q_NULLPTR);
+ explicit QSensor(const QByteArray &type, QObject *parent = nullptr);
virtual ~QSensor();
QByteArray identifier() const;
@@ -205,9 +167,10 @@ Q_SIGNALS:
void maxBufferSizeChanged(int maxBufferSize);
void efficientBufferSizeChanged(int efficientBufferSize);
void bufferSizeChanged(int bufferSize);
+ void identifierChanged();
protected:
- explicit QSensor(const QByteArray &type, QSensorPrivate &dd, QObject* parent = Q_NULLPTR);
+ explicit QSensor(const QByteArray &type, QSensorPrivate &dd, QObject* parent = nullptr);
QSensorBackend *backend() const;
private:
@@ -261,7 +224,7 @@ private:
#define DECLARE_READING_D(classname, pclassname)\
public:\
- classname(QObject *parent = Q_NULLPTR);\
+ classname(QObject *parent = nullptr);\
virtual ~classname();\
void copyValuesFrom(QSensorReading *other) override;\
private:\
@@ -272,7 +235,7 @@ private:
#define IMPLEMENT_READING_D(classname, pclassname)\
classname::classname(QObject *parent)\
- : QSensorReading(parent, Q_NULLPTR)\
+ : QSensorReading(parent, nullptr)\
, d(new pclassname)\
{}\
classname::~classname() {}\
@@ -296,4 +259,3 @@ Q_DECLARE_METATYPE(qrangelist)
Q_DECLARE_METATYPE(qoutputrangelist)
#endif
-
diff --git a/src/sensors/qsensor_p.h b/src/sensors/qsensor_p.h
index f3e41e4d..1b547fa1 100644
--- a/src/sensors/qsensor_p.h
+++ b/src/sensors/qsensor_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSENSOR_P_H
#define QSENSOR_P_H
@@ -77,7 +41,7 @@ public:
, error(0)
, alwaysOn(false)
, skipDuplicates(false)
- , axesOrientationMode(QSensor::FixedOrientation)
+ , axesOrientationMode(QSensor::AxesOrientationMode::FixedOrientation)
, currentOrientation(0)
, userOrientation(0)
, bufferSize(1)
diff --git a/src/sensors/qsensorbackend.cpp b/src/sensors/qsensorbackend.cpp
index 31e2e811..beb56cf4 100644
--- a/src/sensors/qsensorbackend.cpp
+++ b/src/sensors/qsensorbackend.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qsensorbackend.h"
#include "qsensorbackend_p.h"
@@ -318,21 +282,27 @@ void QSensorBackend::sensorStopped()
}
/*!
- Inform the front end that the sensor is busy.
- This implicitly calls sensorStopped() and
- is typically called from start().
+ Inform the front end of the sensor's busy state according
+ to the provided \a busy parameter.
+
+ If the sensor is set \e busy this implicitly calls sensorStopped().
+ Busy indication is typically done in start().
Note that the front end must call QSensor::isBusy() to see if
the sensor is busy. If the sensor has stopped due to an error
the sensorError() function should be called to notify the class
of the error condition.
*/
-void QSensorBackend::sensorBusy()
+void QSensorBackend::sensorBusy(bool busy)
{
Q_D(QSensorBackend);
QSensorPrivate *sensorPrivate = d->m_sensor->d_func();
- sensorPrivate->active = false;
- sensorPrivate->busy = true;
+ if (sensorPrivate->busy == busy)
+ return;
+ if (busy)
+ sensorPrivate->active = false;
+ sensorPrivate->busy = busy;
+ emit d->m_sensor->busyChanged();
}
/*!
diff --git a/src/sensors/qsensorbackend.h b/src/sensors/qsensorbackend.h
index 3837c143..e890aec3 100644
--- a/src/sensors/qsensorbackend.h
+++ b/src/sensors/qsensorbackend.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSENSORBACKEND_H
#define QSENSORBACKEND_H
@@ -51,7 +15,7 @@ class Q_SENSORS_EXPORT QSensorBackend : public QObject
{
Q_OBJECT
public:
- explicit QSensorBackend(QSensor *sensor, QObject *parent = Q_NULLPTR);
+ explicit QSensorBackend(QSensor *sensor, QObject *parent = nullptr);
virtual ~QSensorBackend();
virtual void start() = 0;
@@ -80,7 +44,7 @@ public:
// used by the backend to inform us of events
void newReadingAvailable();
void sensorStopped();
- void sensorBusy();
+ void sensorBusy(bool busy = true);
void sensorError(int error);
private:
diff --git a/src/sensors/qsensorbackend_p.h b/src/sensors/qsensorbackend_p.h
index 15835102..5d7ef2d2 100644
--- a/src/sensors/qsensorbackend_p.h
+++ b/src/sensors/qsensorbackend_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Research In Motion
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Research In Motion
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSENSORBACKEND_P_H
#define QSENSORBACKEND_P_H
diff --git a/src/sensors/qsensormanager.cpp b/src/sensors/qsensormanager.cpp
index 425a87b9..8ce509f4 100644
--- a/src/sensors/qsensormanager.cpp
+++ b/src/sensors/qsensormanager.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qsensormanager.h"
#include <QDebug>
@@ -53,7 +17,7 @@ QT_BEGIN_NAMESPACE
typedef QHash<QByteArray,QSensorBackendFactory*> FactoryForIdentifierMap;
typedef QHash<QByteArray,FactoryForIdentifierMap> BackendIdentifiersForTypeMap;
-static QLoggingCategory sensorsCategory("qt.sensors");
+Q_LOGGING_CATEGORY(lcSensorManager, "qt.sensors");
class QSensorManagerPrivate : public QObject
{
@@ -96,19 +60,21 @@ public:
QString config = QString::fromLocal8Bit(QTSENSORS_CONFIG_PATH);
#else
QStringList configs = QStandardPaths::standardLocations(QStandardPaths::ConfigLocation);
- if (configs.count() == 0) return; // QStandardPaths is broken?
- QString config = configs.at(configs.count()-1);
- if (config.isEmpty()) return; // QStandardPaths is broken?
- config += QLatin1String("/QtProject/Sensors.conf");
+ QString config;
+ for (const QString& c : configs) {
+ config = c + QLatin1String("/QtProject/Sensors.conf");
+ if (QFile::exists(config))
+ break;
+ }
#endif
- qCDebug(sensorsCategory) << "Loading config from" << config;
+ qCDebug(lcSensorManager) << "Loading config from" << config;
if (!QFile::exists(config)) {
- qCDebug(sensorsCategory) << "There is no config file" << config;
+ qCDebug(lcSensorManager) << "There is no config file" << config;
return;
}
QFile cfgfile(config);
if (!cfgfile.open(QFile::ReadOnly)) {
- qCWarning(sensorsCategory) << "Can't open config file" << config;
+ qCWarning(lcSensorManager) << "Can't open config file" << config;
return;
}
@@ -121,9 +87,9 @@ public:
isconfig = true;
else if (isconfig) {
//read out setting line
- line.remove(' ');
- QStringList pair = line.split('=');
- if (pair.count() == 2)
+ line.remove(QLatin1String(" "));
+ QStringList pair = line.split(QStringLiteral("="));
+ if (pair.size() == 2)
defaultIdentifierForType.insert(pair[0].toLatin1(), pair[1].toLatin1());
}
}
@@ -159,9 +125,8 @@ public Q_SLOTS:
// until things stop changing.
do {
sensorsChanged = false;
- Q_FOREACH (QSensorChangesInterface *changes, changeListeners) {
+ for (QSensorChangesInterface *changes : changeListeners)
changes->sensorsChanged();
- }
} while (sensorsChanged);
// We're going away now so clear the flag
@@ -176,9 +141,9 @@ Q_GLOBAL_STATIC(QSensorManagerPrivate, sensorManagerPrivate)
static void initPlugin(QObject *o, bool warnOnFail = true)
{
- qCDebug(sensorsCategory) << "Init plugin" << o;
+ qCDebug(lcSensorManager) << "Init plugin" << o;
if (!o) {
- qCWarning(sensorsCategory) << "Null plugin" << o;
+ qCWarning(lcSensorManager) << "Null plugin" << o;
return;
}
@@ -186,7 +151,7 @@ static void initPlugin(QObject *o, bool warnOnFail = true)
if (!d) return; // hardly likely but just in case...
if (d->seenPlugins.contains(o)) {
- qCDebug(sensorsCategory) << "Plugin is seen" << o;
+ qCDebug(lcSensorManager) << "Plugin is seen" << o;
return;
}
@@ -197,11 +162,11 @@ static void initPlugin(QObject *o, bool warnOnFail = true)
QSensorPluginInterface *plugin = qobject_cast<QSensorPluginInterface*>(o);
if (plugin) {
- qCDebug(sensorsCategory) << "Register sensors for " << plugin;
+ qCDebug(lcSensorManager) << "Register sensors for " << plugin;
d->seenPlugins.insert(o);
plugin->registerSensors();
} else if (warnOnFail) {
- qCWarning(sensorsCategory) << "Can't cast to plugin" << o;
+ qCWarning(lcSensorManager) << "Can't cast to plugin" << o;
}
}
@@ -213,14 +178,12 @@ void QSensorManagerPrivate::loadPlugins()
SENSORLOG() << "initializing static plugins";
// Qt-style static plugins
- Q_FOREACH (QObject *plugin, QPluginLoader::staticInstances()) {
- initPlugin(plugin, false/*do not warn on fail*/);
- }
-
+ for (QObject *plugin : QPluginLoader::staticInstances())
+ initPlugin(plugin, false /*do not warn on fail*/);
if (d->loadExternalPlugins) {
SENSORLOG() << "initializing plugins";
- QList<QJsonObject> meta = d->loader->metaData();
- for (int i = 0; i < meta.count(); i++) {
+ QList<QPluginParsedMetaData> meta = d->loader->metaData();
+ for (qsizetype i = 0; i < meta.size(); i++) {
QObject *plugin = d->loader->instance(i);
initPlugin(plugin);
}
@@ -253,19 +216,23 @@ void QSensorManagerPrivate::loadPlugins()
Register a sensor for \a type. The \a identifier must be unique.
The \a factory will be asked to create instances of the backend.
+
+ Sensor identifiers starting with \c generic or \c dummy are given lower
+ priority when choosing the default sensor if other sensors are found.
*/
void QSensorManager::registerBackend(const QByteArray &type, const QByteArray &identifier, QSensorBackendFactory *factory)
{
- Q_ASSERT(type.count());
- Q_ASSERT(identifier.count());
+ Q_ASSERT(type.size());
+ Q_ASSERT(identifier.size());
Q_ASSERT(factory);
QSensorManagerPrivate *d = sensorManagerPrivate();
if (!d) return; // hardly likely but just in case...
if (!d->backendsByType.contains(type)) {
(void)d->backendsByType[type];
d->firstIdentifierForType[type] = identifier;
- } else if (d->firstIdentifierForType[type].startsWith("generic.")) {
- // Don't let a generic backend be the default when some other backend exists!
+ } else if (d->firstIdentifierForType[type].startsWith("generic.") ||
+ d->firstIdentifierForType[type].startsWith("dummy.")) {
+ // Don't let a generic or dummy backend be the default when some other backend exists!
d->firstIdentifierForType[type] = identifier;
}
FactoryForIdentifierMap &factoryByIdentifier = d->backendsByType[type];
@@ -304,7 +271,7 @@ void QSensorManager::unregisterBackend(const QByteArray &type, const QByteArray
(void)factoryByIdentifier.take(identifier); // we don't own this pointer anyway
if (d->firstIdentifierForType[type] == identifier) {
- if (factoryByIdentifier.count()) {
+ if (factoryByIdentifier.size()) {
d->firstIdentifierForType[type] = factoryByIdentifier.begin().key();
if (d->firstIdentifierForType[type].startsWith("generic.")) {
// Don't let a generic backend be the default when some other backend exists!
@@ -320,7 +287,7 @@ void QSensorManager::unregisterBackend(const QByteArray &type, const QByteArray
(void)d->firstIdentifierForType.take(type);
}
}
- if (!factoryByIdentifier.count())
+ if (!factoryByIdentifier.size())
(void)d->backendsByType.take(type);
// Notify the app that the available sensor list has changed.
@@ -361,7 +328,7 @@ QSensorBackend *QSensorManager::createBackend(QSensor *sensor)
if (backend) return backend; // Got it!
// The default failed to instantiate so try any other registered sensors for this type
- Q_FOREACH (const QByteArray &identifier, factoryByIdentifier.keys()) {
+ for (const QByteArray &identifier : factoryByIdentifier.keys()) {
SENSORLOG() << "Trying" << identifier;
if (identifier == defaultIdentifier) continue; // Don't do the default one again
factory = factoryByIdentifier[identifier];
diff --git a/src/sensors/qsensormanager.h b/src/sensors/qsensormanager.h
index 375c9ef1..5957ee7a 100644
--- a/src/sensors/qsensormanager.h
+++ b/src/sensors/qsensormanager.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSENSORMANAGER_H
#define QSENSORMANAGER_H
diff --git a/src/sensors/qsensorplugin.cpp b/src/sensors/qsensorplugin.cpp
index 186539b7..bb85d574 100644
--- a/src/sensors/qsensorplugin.cpp
+++ b/src/sensors/qsensorplugin.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qsensorplugin.h"
diff --git a/src/sensors/qsensorplugin.h b/src/sensors/qsensorplugin.h
index fc3a44d7..3c8f4847 100644
--- a/src/sensors/qsensorplugin.h
+++ b/src/sensors/qsensorplugin.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSENSORPLUGIN_H
#define QSENSORPLUGIN_H
diff --git a/src/sensors/qsensorsglobal.h b/src/sensors/qsensorsglobal.h
index 70985c27..4a6a130c 100644
--- a/src/sensors/qsensorsglobal.h
+++ b/src/sensors/qsensorsglobal.h
@@ -1,60 +1,11 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSENSORSGLOBAL_H
#define QSENSORSGLOBAL_H
#include <QtCore/qglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_STATIC
-# if defined(QT_BUILD_SENSORS_LIB)
-# define Q_SENSORS_EXPORT Q_DECL_EXPORT
-# else
-# define Q_SENSORS_EXPORT Q_DECL_IMPORT
-# endif
-#else
-# define Q_SENSORS_EXPORT
-#endif
-
-QT_END_NAMESPACE
+#include <QtSensors/qtsensorsexports.h>
#endif // QSENSORSGLOBAL_H
diff --git a/src/sensors/qt_cmdline.cmake b/src/sensors/qt_cmdline.cmake
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/sensors/qt_cmdline.cmake
diff --git a/src/sensors/qtapsensor.cpp b/src/sensors/qtapsensor.cpp
index 9889a8c2..378f0e39 100644
--- a/src/sensors/qtapsensor.cpp
+++ b/src/sensors/qtapsensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qtapsensor.h"
#include "qtapsensor_p.h"
@@ -49,6 +13,7 @@ IMPLEMENT_READING(QTapReading)
\ingroup sensors_reading
\inmodule QtSensors
\since 5.1
+ \internal
\brief The QTapReading class represents one reading from the
tap sensor.
@@ -83,11 +48,17 @@ IMPLEMENT_READING(QTapReading)
the detected axis. Previous versions of the API did not allow this. Applications that check
for the _Pos and _Neg flags as values should be updated so they can work with all devices.
- \oldcode
+ For example, if you have code like
+
+ \code
if (reading->tapDirection() == QTapReading::X_Pos) {
...
}
- \newcode
+ \endcode
+
+ you can rewrite it as
+
+ \code
if (reading->tapDirection()&QTapReading::X_Pos) {
...
}
@@ -174,6 +145,7 @@ void QTapReading::setDoubleTap(bool doubleTap)
\ingroup sensors_filter
\inmodule QtSensors
\since 5.1
+ \internal
\brief The QTapFilter class is a convenience wrapper around QSensorFilter.
@@ -194,13 +166,14 @@ bool QTapFilter::filter(QSensorReading *reading)
return filter(static_cast<QTapReading*>(reading));
}
-char const * const QTapSensor::type("QTapSensor");
+char const * const QTapSensor::sensorType("QTapSensor");
/*!
\class QTapSensor
\ingroup sensors_type
\inmodule QtSensors
\since 5.1
+ \internal
\brief The QTapSensor class is a convenience wrapper around QSensor.
@@ -217,7 +190,7 @@ char const * const QTapSensor::type("QTapSensor");
Construct the sensor as a child of \a parent.
*/
QTapSensor::QTapSensor(QObject *parent)
- : QSensor(QTapSensor::type, *new QTapSensorPrivate, parent)
+ : QSensor(QTapSensor::sensorType, *new QTapSensorPrivate, parent)
{
}
diff --git a/src/sensors/qtapsensor.h b/src/sensors/qtapsensor.h
index 31ba67f6..6a76c311 100644
--- a/src/sensors/qtapsensor.h
+++ b/src/sensors/qtapsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTAPSENSOR_H
#define QTAPSENSOR_H
@@ -49,7 +13,6 @@ class QTapReadingPrivate;
class Q_SENSORS_EXPORT QTapReading : public QSensorReading
{
Q_OBJECT
- Q_ENUMS(TapDirection)
Q_PROPERTY(TapDirection tapDirection READ tapDirection)
Q_PROPERTY(bool doubleTap READ isDoubleTap)
DECLARE_READING(QTapReading)
@@ -69,6 +32,7 @@ public:
Y_Both = 0x0222,
Z_Both = 0x0444
};
+ Q_ENUM(TapDirection)
TapDirection tapDirection() const;
void setTapDirection(TapDirection tapDirection);
@@ -93,10 +57,10 @@ class Q_SENSORS_EXPORT QTapSensor : public QSensor
Q_PROPERTY(bool returnDoubleTapEvents READ returnDoubleTapEvents WRITE setReturnDoubleTapEvents
NOTIFY returnDoubleTapEventsChanged)
public:
- explicit QTapSensor(QObject *parent = Q_NULLPTR);
+ explicit QTapSensor(QObject *parent = nullptr);
virtual ~QTapSensor();
QTapReading *reading() const;
- static char const * const type;
+ static char const * const sensorType;
bool returnDoubleTapEvents() const;
void setReturnDoubleTapEvents(bool returnDoubleTapEvents);
@@ -112,4 +76,3 @@ private:
QT_END_NAMESPACE
#endif
-
diff --git a/src/sensors/qtapsensor_p.h b/src/sensors/qtapsensor_p.h
index abfb134a..4a9a37f5 100644
--- a/src/sensors/qtapsensor_p.h
+++ b/src/sensors/qtapsensor_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTAPSENSOR_P_H
#define QTAPSENSOR_P_H
diff --git a/src/sensors/qtiltsensor.cpp b/src/sensors/qtiltsensor.cpp
index 310ed36c..bda3c0a5 100644
--- a/src/sensors/qtiltsensor.cpp
+++ b/src/sensors/qtiltsensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qtiltsensor.h"
#include "qtiltsensor_p.h"
@@ -63,7 +27,8 @@ IMPLEMENT_READING(QTiltReading)
/*!
\property QTiltReading::yRotation
- \brief This property holds the amount of tilt on the Y axis.
+ \brief This property holds the amount of tilt on the Y axis,
+ measured in degrees.
*/
qreal QTiltReading::yRotation() const
{
@@ -71,7 +36,7 @@ qreal QTiltReading::yRotation() const
}
/*!
- Sets yRotation to \a y.
+ Sets yRotation to \a y degrees.
*/
void QTiltReading::setYRotation(qreal y)
{
@@ -80,7 +45,8 @@ void QTiltReading::setYRotation(qreal y)
/*!
\property QTiltReading::xRotation
- \brief This property holds the amount of tilt on the X axis.
+ \brief This property holds the amount of tilt on the X axis,
+ measured in degrees.
*/
qreal QTiltReading::xRotation() const
@@ -89,7 +55,7 @@ qreal QTiltReading::xRotation() const
}
/*!
- Sets xRotation to \a x.
+ Sets xRotation to \a x degrees.
*/
void QTiltReading::setXRotation(qreal x)
{
@@ -123,7 +89,7 @@ bool QTiltFilter::filter(QSensorReading *reading)
return filter(static_cast<QTiltReading*>(reading));
}
-char const * const QTiltSensor::type("QTiltSensor");
+char const * const QTiltSensor::sensorType("QTiltSensor");
/*!
\class QTiltSensor
@@ -133,7 +99,7 @@ char const * const QTiltSensor::type("QTiltSensor");
\brief The QTiltSensor class is a convenience wrapper around QSensor.
- The only behavioural difference is that this class sets the type properly.QMetaObject::invokeMethod(backend(), "calibrate");
+ The only behavioural difference is that this class sets the type properly.
This class also features a reading() function that returns a QTiltReading instead of a QSensorReading.
@@ -148,7 +114,7 @@ char const * const QTiltSensor::type("QTiltSensor");
Construct the sensor as a child of \a parent.
*/
QTiltSensor::QTiltSensor(QObject *parent)
- : QSensor(QTiltSensor::type, parent)
+ : QSensor(QTiltSensor::sensorType, parent)
{
}
@@ -174,7 +140,7 @@ QTiltReading *QTiltSensor::reading() const
}
/*!
- Calibrates the tilt sensor. Uses the current tilt angles as 0.
+ Calibrates the tilt sensor. Uses the current tilt angles as 0 degrees.
*/
void QTiltSensor::calibrate()
{
diff --git a/src/sensors/qtiltsensor.h b/src/sensors/qtiltsensor.h
index 2e0d0a78..50584199 100644
--- a/src/sensors/qtiltsensor.h
+++ b/src/sensors/qtiltsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTILTSENSOR_H
#define QTILTSENSOR_H
@@ -74,10 +38,10 @@ class Q_SENSORS_EXPORT QTiltSensor : public QSensor
{
Q_OBJECT
public:
- explicit QTiltSensor(QObject *parent = Q_NULLPTR);
+ explicit QTiltSensor(QObject *parent = nullptr);
~QTiltSensor();
QTiltReading *reading() const;
- static char const * const type;
+ static char const * const sensorType;
Q_INVOKABLE void calibrate();
diff --git a/src/sensors/qtiltsensor_p.h b/src/sensors/qtiltsensor_p.h
index b6a49b00..838c6042 100644
--- a/src/sensors/qtiltsensor_p.h
+++ b/src/sensors/qtiltsensor_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTILTSENSOR_P_H
#define QTILTSENSOR_P_H
@@ -51,6 +15,8 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
+
QT_BEGIN_NAMESPACE
class QTiltReadingPrivate
diff --git a/src/sensors/sensorlog_p.h b/src/sensors/sensorlog_p.h
index 49e73166..ae3956cb 100644
--- a/src/sensors/sensorlog_p.h
+++ b/src/sensors/sensorlog_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSENSORLOG_P_H
#define QSENSORLOG_P_H
@@ -51,6 +15,8 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
+
QT_BEGIN_NAMESPACE
#ifdef ENABLE_RUNTIME_SENSORLOG
diff --git a/src/sensors/sensors.pro b/src/sensors/sensors.pro
deleted file mode 100644
index 79cb6e45..00000000
--- a/src/sensors/sensors.pro
+++ /dev/null
@@ -1,87 +0,0 @@
-TARGET = QtSensors
-CONFIG += strict_flags
-QT = core-private
-
-CONFIG(debug,debug|release):DEFINES += ENABLE_RUNTIME_SENSORLOG
-!isEmpty(SENSORS_CONFIG_PATH):DEFINES += "QTSENSORS_CONFIG_PATH=\\\"$$SENSORS_CONFIG_PATH\\\""
-
-qtHaveModule(simulator) {
- DEFINES += SIMULATOR_BUILD
- QT_FOR_PRIVATE += simulator
-}
-
-QMAKE_DOCS = $$PWD/doc/qtsensors.qdocconf
-
-ANDROID_LIB_DEPENDENCIES = \
- plugins/sensors/libplugins_sensors_qtsensors_android.so
-
-PUBLIC_HEADERS += \
- qsensorbackend.h\
- qsensormanager.h\
- qsensorplugin.h\
- qsensorsglobal.h
-
-PRIVATE_HEADERS += \
- sensorlog_p.h\
-
-SOURCES += qsensorbackend.cpp\
- qsensormanager.cpp\
- qsensorplugin.cpp
-
-SOURCES += \
- gestures/qsensorgesture.cpp \
- gestures/qsensorgesturerecognizer.cpp \
- gestures/qsensorgesturemanager.cpp \
- gestures/qsensorgesturemanagerprivate.cpp \
- gestures/qsensorgestureplugininterface.cpp
-
-GESTURE_HEADERS += \
- gestures/qsensorgesture.h\
- gestures/qsensorgesture_p.h\
- gestures/qsensorgesturerecognizer.h \
- gestures/qsensorgesturemanager.h \
- gestures/qsensorgesturemanagerprivate_p.h \
- gestures/qsensorgestureplugininterface.h
-
-qtHaveModule(simulator) {
- SOURCES += gestures/simulatorgesturescommon.cpp
- GESTURE_HEADERS += gestures/simulatorgesturescommon_p.h
-}
-
-# 3 files per sensor (including QSensor)
-SENSORS=\
- qsensor\
- qaccelerometer\
- qaltimeter\
- qambientlightsensor\
- qambienttemperaturesensor\
- qcompass\
- qdistancesensor\
- qholstersensor\
- qlightsensor\
- qmagnetometer\
- qorientationsensor\
- qproximitysensor\
- qirproximitysensor\
- qrotationsensor\
- qtapsensor\
- qtiltsensor\
- qgyroscope\
- qpressuresensor \
- qhumiditysensor \
- qlidsensor
-
-for(s,SENSORS) {
- # Client API
- PUBLIC_HEADERS += $${s}.h
- SOURCES += $${s}.cpp
- # Private header
- PRIVATE_HEADERS += $${s}_p.h
-}
-
-HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS $$GESTURE_HEADERS
-
-MODULE_PLUGIN_TYPES = \
- sensors \
- sensorgestures
-load(qt_module)
diff --git a/src/sensorsquick/CMakeLists.txt b/src/sensorsquick/CMakeLists.txt
new file mode 100644
index 00000000..b8ae9f57
--- /dev/null
+++ b/src/sensorsquick/CMakeLists.txt
@@ -0,0 +1,39 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_internal_add_qml_module(SensorsQuick
+ URI "QtSensors"
+ VERSION "${PROJECT_VERSION}"
+ SOURCES
+ qmlaccelerometer.cpp qmlaccelerometer_p.h
+ qmlambientlightsensor.cpp qmlambientlightsensor_p.h
+ qmlambienttemperaturesensor.cpp qmlambienttemperaturesensor_p.h
+ qmlcompass.cpp qmlcompass_p.h
+ qmlgyroscope.cpp qmlgyroscope_p.h
+ qmlhumiditysensor.cpp qmlhumiditysensor_p.h
+ qmlirproximitysensor.cpp qmlirproximitysensor_p.h
+ qmllidsensor.cpp qmllidsensor_p.h
+ qmllightsensor.cpp qmllightsensor_p.h
+ qmlmagnetometer.cpp qmlmagnetometer_p.h
+ qmlorientationsensor.cpp qmlorientationsensor_p.h
+ qmlpressuresensor.cpp qmlpressuresensor_p.h
+ qmlproximitysensor.cpp qmlproximitysensor_p.h
+ qmlrotationsensor.cpp qmlrotationsensor_p.h
+ qmlsensor.cpp qmlsensor_p.h
+ qmlsensorglobal.cpp qmlsensorglobal_p.h
+ qmlsensorrange.cpp qmlsensorrange_p.h
+ qmltapsensor.cpp qmltapsensor_p.h
+ qmltiltsensor.cpp qmltiltsensor_p.h
+ qsensorsquickglobal_p.h
+ DEFINES
+ QT_BUILD_SENSORSQUICK_LIB
+ DEPENDENCIES
+ QtQml
+ PUBLIC_LIBRARIES
+ Qt::Core
+ Qt::Qml
+ Qt::Sensors
+ LIBRARIES
+ Qt::CorePrivate
+ GENERATE_CPP_EXPORTS
+)
diff --git a/src/imports/sensors/qmlaccelerometer.cpp b/src/sensorsquick/qmlaccelerometer.cpp
index 8d78fbfc..70394043 100644
--- a/src/imports/sensors/qmlaccelerometer.cpp
+++ b/src/sensorsquick/qmlaccelerometer.cpp
@@ -1,48 +1,12 @@
-/****************************************************************************
-**
-** 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 "qmlaccelerometer.h"
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qmlaccelerometer_p.h"
#include <QtSensors/QAccelerometer>
/*!
\qmltype Accelerometer
- \instantiates QmlAccelerometer
+//! \instantiates QmlAccelerometer
\ingroup qml-sensors_type
\inqmlmodule QtSensors
\since QtSensors 5.0
@@ -102,7 +66,7 @@ QSensor *QmlAccelerometer::sensor() const
/*!
\qmltype AccelerometerReading
- \instantiates QmlAccelerometerReading
+//! \instantiates QmlAccelerometerReading
\ingroup qml-sensors_reading
\inqmlmodule QtSensors
\since QtSensors 5.0
@@ -118,8 +82,7 @@ QSensor *QmlAccelerometer::sensor() const
*/
QmlAccelerometerReading::QmlAccelerometerReading(QAccelerometer *sensor)
- : QmlSensorReading(sensor)
- , m_sensor(sensor)
+ : m_sensor(sensor)
{
}
@@ -139,6 +102,11 @@ qreal QmlAccelerometerReading::x() const
return m_x;
}
+QBindable<qreal> QmlAccelerometerReading::bindableX() const
+{
+ return &m_x;
+}
+
/*!
\qmlproperty qreal AccelerometerReading::y
This property holds the acceleration on the Y axis.
@@ -151,6 +119,11 @@ qreal QmlAccelerometerReading::y() const
return m_y;
}
+QBindable<qreal> QmlAccelerometerReading::bindableY() const
+{
+ return &m_y;
+}
+
/*!
\qmlproperty qreal AccelerometerReading::z
This property holds the acceleration on the Z axis.
@@ -163,6 +136,11 @@ qreal QmlAccelerometerReading::z() const
return m_z;
}
+QBindable<qreal> QmlAccelerometerReading::bindableZ() const
+{
+ return &m_z;
+}
+
QSensorReading *QmlAccelerometerReading::reading() const
{
return m_sensor->reading();
@@ -170,19 +148,7 @@ QSensorReading *QmlAccelerometerReading::reading() const
void QmlAccelerometerReading::readingUpdate()
{
- qreal aX = m_sensor->reading()->x();
- if (m_x != aX) {
- m_x = aX;
- Q_EMIT xChanged();
- }
- qreal aY = m_sensor->reading()->y();
- if (m_y != aY) {
- m_y = aY;
- Q_EMIT yChanged();
- }
- qreal aZ = m_sensor->reading()->z();
- if (m_z != aZ) {
- m_z = aZ;
- Q_EMIT zChanged();
- }
+ m_x = m_sensor->reading()->x();
+ m_y = m_sensor->reading()->y();
+ m_z = m_sensor->reading()->z();
}
diff --git a/src/sensorsquick/qmlaccelerometer_p.h b/src/sensorsquick/qmlaccelerometer_p.h
new file mode 100644
index 00000000..aae90879
--- /dev/null
+++ b/src/sensorsquick/qmlaccelerometer_p.h
@@ -0,0 +1,94 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QMLACCELEROMETER_P_H
+#define QMLACCELEROMETER_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 "qmlsensor_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QAccelerometer;
+
+class Q_SENSORSQUICK_EXPORT QmlAccelerometer : public QmlSensor
+{
+ Q_OBJECT
+ Q_PROPERTY(AccelerationMode accelerationMode READ accelerationMode WRITE setAccelerationMode
+ NOTIFY accelerationModeChanged REVISION 1)
+ QML_NAMED_ELEMENT(Accelerometer)
+ QML_ADDED_IN_VERSION(5,0)
+public:
+ explicit QmlAccelerometer(QObject *parent = 0);
+ ~QmlAccelerometer();
+
+ // Keep this enum in sync with QAccelerometer::AccelerationMode
+ enum AccelerationMode {
+ Combined,
+ Gravity,
+ User
+ };
+ Q_ENUM(AccelerationMode)
+
+ AccelerationMode accelerationMode() const;
+ void setAccelerationMode(AccelerationMode accelerationMode);
+
+ QSensor *sensor() const override;
+
+signals:
+ Q_REVISION(1) void accelerationModeChanged(AccelerationMode accelerationMode);
+
+private:
+ QAccelerometer *m_sensor;
+ QmlSensorReading *createReading() const override;
+};
+
+class Q_SENSORSQUICK_EXPORT QmlAccelerometerReading : public QmlSensorReading
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal x READ x NOTIFY xChanged BINDABLE bindableX)
+ Q_PROPERTY(qreal y READ y NOTIFY yChanged BINDABLE bindableY)
+ Q_PROPERTY(qreal z READ z NOTIFY zChanged BINDABLE bindableZ)
+ QML_NAMED_ELEMENT(AccelerometerReading)
+ QML_UNCREATABLE("Cannot create AccelerometerReading")
+ QML_ADDED_IN_VERSION(5,0)
+public:
+ explicit QmlAccelerometerReading(QAccelerometer *sensor);
+ ~QmlAccelerometerReading();
+
+ qreal x() const;
+ QBindable<qreal> bindableX() const;
+ qreal y() const;
+ QBindable<qreal> bindableY() const;
+ qreal z() const;
+ QBindable<qreal> bindableZ() const;
+
+Q_SIGNALS:
+ void xChanged();
+ void yChanged();
+ void zChanged();
+
+private:
+ QSensorReading *reading() const override;
+ void readingUpdate() override;
+ QAccelerometer *m_sensor;
+ Q_OBJECT_BINDABLE_PROPERTY(QmlAccelerometerReading, qreal,
+ m_x, &QmlAccelerometerReading::xChanged)
+ Q_OBJECT_BINDABLE_PROPERTY(QmlAccelerometerReading, qreal,
+ m_y, &QmlAccelerometerReading::yChanged)
+ Q_OBJECT_BINDABLE_PROPERTY(QmlAccelerometerReading, qreal,
+ m_z, &QmlAccelerometerReading::zChanged)
+};
+
+QT_END_NAMESPACE
+#endif
diff --git a/src/imports/sensors/qmlambientlightsensor.cpp b/src/sensorsquick/qmlambientlightsensor.cpp
index 5d9ab3b6..475ec98d 100644
--- a/src/imports/sensors/qmlambientlightsensor.cpp
+++ b/src/sensorsquick/qmlambientlightsensor.cpp
@@ -1,48 +1,12 @@
-/****************************************************************************
-**
-** 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 "qmlambientlightsensor.h"
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qmlambientlightsensor_p.h"
#include <QtSensors/QAmbientLightSensor>
/*!
\qmltype AmbientLightSensor
- \instantiates QmlAmbientLightSensor
+//! \instantiates QmlAmbientLightSensor
\ingroup qml-sensors_type
\inqmlmodule QtSensors
\since QtSensors 5.0
@@ -79,7 +43,7 @@ QSensor *QmlAmbientLightSensor::sensor() const
/*!
\qmltype AmbientLightReading
- \instantiates QmlAmbientLightSensorReading
+//! \instantiates QmlAmbientLightSensorReading
\ingroup qml-sensors_reading
\inqmlmodule QtSensors
\since QtSensors 5.0
@@ -95,8 +59,7 @@ QSensor *QmlAmbientLightSensor::sensor() const
*/
QmlAmbientLightSensorReading::QmlAmbientLightSensorReading(QAmbientLightSensor *sensor)
- : QmlSensorReading(sensor)
- , m_sensor(sensor)
+ : m_sensor(sensor)
{
}
@@ -126,6 +89,11 @@ QAmbientLightReading::LightLevel QmlAmbientLightSensorReading::lightLevel() cons
return m_lightLevel;
}
+QBindable<QAmbientLightReading::LightLevel> QmlAmbientLightSensorReading::bindableLightLevel() const
+{
+ return &m_lightLevel;
+}
+
QSensorReading *QmlAmbientLightSensorReading::reading() const
{
return m_sensor->reading();
@@ -133,9 +101,5 @@ QSensorReading *QmlAmbientLightSensorReading::reading() const
void QmlAmbientLightSensorReading::readingUpdate()
{
- QAmbientLightReading::LightLevel ll = m_sensor->reading()->lightLevel();
- if (m_lightLevel != ll) {
- m_lightLevel = ll;
- Q_EMIT lightLevelChanged();
- }
+ m_lightLevel = m_sensor->reading()->lightLevel();
}
diff --git a/src/sensorsquick/qmlambientlightsensor_p.h b/src/sensorsquick/qmlambientlightsensor_p.h
new file mode 100644
index 00000000..83bcd60c
--- /dev/null
+++ b/src/sensorsquick/qmlambientlightsensor_p.h
@@ -0,0 +1,70 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QMLAMBIENTLIGHTSENSOR_P_H
+#define QMLAMBIENTLIGHTSENSOR_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 "qmlsensor_p.h"
+#include <QtSensors/QAmbientLightSensor>
+
+QT_BEGIN_NAMESPACE
+
+class QAmbientLightSensor;
+
+class Q_SENSORSQUICK_EXPORT QmlAmbientLightSensor : public QmlSensor
+{
+ Q_OBJECT
+ QML_NAMED_ELEMENT(AmbientLightSensor)
+ QML_ADDED_IN_VERSION(5,0)
+public:
+ explicit QmlAmbientLightSensor(QObject *parent = 0);
+ ~QmlAmbientLightSensor();
+
+ QSensor *sensor() const override;
+
+private:
+ QAmbientLightSensor *m_sensor;
+ QmlSensorReading *createReading() const override;
+
+};
+
+class Q_SENSORSQUICK_EXPORT QmlAmbientLightSensorReading : public QmlSensorReading
+{
+ Q_OBJECT
+ Q_PROPERTY(QAmbientLightReading::LightLevel lightLevel READ lightLevel
+ NOTIFY lightLevelChanged BINDABLE bindableLightLevel)
+ QML_NAMED_ELEMENT(AmbientLightReading)
+ QML_UNCREATABLE("Cannot create AmbientLightReading")
+ QML_ADDED_IN_VERSION(5,0)
+public:
+
+ explicit QmlAmbientLightSensorReading(QAmbientLightSensor *sensor);
+ ~QmlAmbientLightSensorReading();
+
+ QAmbientLightReading::LightLevel lightLevel() const;
+ QBindable<QAmbientLightReading::LightLevel> bindableLightLevel() const;
+
+Q_SIGNALS:
+ void lightLevelChanged();
+
+private:
+ QSensorReading *reading() const override;
+ void readingUpdate() override;
+ QAmbientLightSensor *m_sensor;
+ Q_OBJECT_BINDABLE_PROPERTY(QmlAmbientLightSensorReading, QAmbientLightReading::LightLevel,
+ m_lightLevel, &QmlAmbientLightSensorReading::lightLevelChanged)
+};
+
+QT_END_NAMESPACE
+#endif
diff --git a/src/sensorsquick/qmlambienttemperaturesensor.cpp b/src/sensorsquick/qmlambienttemperaturesensor.cpp
new file mode 100644
index 00000000..876cda63
--- /dev/null
+++ b/src/sensorsquick/qmlambienttemperaturesensor.cpp
@@ -0,0 +1,95 @@
+// Copyright (C) 2016 Research In Motion
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+#include "qmlambienttemperaturesensor_p.h"
+#include <QtSensors/QAmbientTemperatureSensor>
+
+/*!
+ \qmltype AmbientTemperatureSensor
+//! \instantiates QmlAmbientTemperatureSensor
+ \ingroup qml-sensors_type
+ \inqmlmodule QtSensors
+ \since QtSensors 5.1
+ \inherits Sensor
+ \brief The AmbientTemperatureSensor element reports on the ambient temperature.
+
+ The AmbientTemperatureSensor element reports on the ambient temperature.
+
+ This element wraps the QAmbientTemperatureSensor class. Please see the documentation for
+ QAmbientTemperatureSensor for details.
+
+ \sa AmbientTemperatureReading
+*/
+
+QmlAmbientTemperatureSensor::QmlAmbientTemperatureSensor(QObject *parent)
+ : QmlSensor(parent)
+ , m_sensor(new QAmbientTemperatureSensor(this))
+{
+}
+
+QmlAmbientTemperatureSensor::~QmlAmbientTemperatureSensor()
+{
+}
+
+QmlSensorReading *QmlAmbientTemperatureSensor::createReading() const
+{
+ return new QmlAmbientTemperatureReading(m_sensor);
+}
+
+QSensor *QmlAmbientTemperatureSensor::sensor() const
+{
+ return m_sensor;
+}
+
+/*!
+ \qmltype AmbientTemperatureReading
+//! \instantiates QmlAmbientTemperatureReading
+ \ingroup qml-sensors_reading
+ \inqmlmodule QtSensors
+ \since QtSensors 5.1
+ \inherits SensorReading
+ \brief The AmbientTemperatureReading element holds the most recent temperature reading.
+
+ The AmbientTemperatureReading element holds the most recent temperature reading.
+
+ This element wraps the QAmbientTemperatureReading class. Please see the documentation for
+ QAmbientTemperatureReading for details.
+
+ This element cannot be directly created.
+*/
+
+QmlAmbientTemperatureReading::QmlAmbientTemperatureReading(QAmbientTemperatureSensor *sensor)
+ : m_sensor(sensor)
+ , m_temperature(0)
+{
+}
+
+QmlAmbientTemperatureReading::~QmlAmbientTemperatureReading()
+{
+}
+
+/*!
+ \qmlproperty qreal AmbientTemperatureReading::temperature
+ This property holds the ambient temperature in degree Celsius.
+
+ Please see QAmbientTemperatureReading::temperature for information about this property.
+*/
+
+qreal QmlAmbientTemperatureReading::temperature() const
+{
+ return m_temperature;
+}
+
+QBindable<qreal> QmlAmbientTemperatureReading::bindableTemperature() const
+{
+ return &m_temperature;
+}
+
+QSensorReading *QmlAmbientTemperatureReading::reading() const
+{
+ return m_sensor->reading();
+}
+
+void QmlAmbientTemperatureReading::readingUpdate()
+{
+ m_temperature = m_sensor->reading()->temperature();
+}
diff --git a/src/sensorsquick/qmlambienttemperaturesensor_p.h b/src/sensorsquick/qmlambienttemperaturesensor_p.h
new file mode 100644
index 00000000..898c0617
--- /dev/null
+++ b/src/sensorsquick/qmlambienttemperaturesensor_p.h
@@ -0,0 +1,68 @@
+// Copyright (C) 2016 Research In Motion
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+#ifndef QMLAMBIENTTEMPERATURESENSOR_P_H
+#define QMLAMBIENTTEMPERATURESENSOR_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 "qmlsensor_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QAmbientTemperatureSensor;
+
+class Q_SENSORSQUICK_EXPORT QmlAmbientTemperatureSensor : public QmlSensor
+{
+ Q_OBJECT
+ QML_NAMED_ELEMENT(AmbientTemperatureSensor)
+ QML_ADDED_IN_VERSION(5,1)
+public:
+ explicit QmlAmbientTemperatureSensor(QObject *parent = 0);
+ ~QmlAmbientTemperatureSensor();
+
+ QSensor *sensor() const override;
+
+private:
+ QmlSensorReading *createReading() const override;
+
+ QAmbientTemperatureSensor *m_sensor;
+};
+
+class Q_SENSORSQUICK_EXPORT QmlAmbientTemperatureReading : public QmlSensorReading
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal temperature READ temperature
+ NOTIFY temperatureChanged BINDABLE bindableTemperature)
+ QML_NAMED_ELEMENT(AmbientTemperatureReading)
+ QML_UNCREATABLE("Cannot create AmbientTemperatureReading")
+ QML_ADDED_IN_VERSION(5,1)
+public:
+ explicit QmlAmbientTemperatureReading(QAmbientTemperatureSensor *sensor);
+ ~QmlAmbientTemperatureReading();
+
+ qreal temperature() const;
+ QBindable<qreal> bindableTemperature() const;
+
+Q_SIGNALS:
+ void temperatureChanged();
+
+private:
+ QSensorReading *reading() const override;
+ void readingUpdate() override;
+
+ QAmbientTemperatureSensor *m_sensor;
+ Q_OBJECT_BINDABLE_PROPERTY(QmlAmbientTemperatureReading, qreal,
+ m_temperature, &QmlAmbientTemperatureReading::temperatureChanged)
+};
+
+QT_END_NAMESPACE
+#endif
diff --git a/src/sensorsquick/qmlcompass.cpp b/src/sensorsquick/qmlcompass.cpp
new file mode 100644
index 00000000..c7088d33
--- /dev/null
+++ b/src/sensorsquick/qmlcompass.cpp
@@ -0,0 +1,113 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qmlcompass_p.h"
+#include <QtSensors/QCompass>
+
+/*!
+ \qmltype Compass
+//! \instantiates QmlCompass
+ \ingroup qml-sensors_type
+ \inqmlmodule QtSensors
+ \since QtSensors 5.0
+ \inherits Sensor
+ \brief The Compass element reports on heading using magnetic north as a reference.
+
+ The Compass element reports on heading using magnetic north as a reference.
+
+ This element wraps the QCompass class. Please see the documentation for
+ QCompass for details.
+
+ \sa CompassReading
+*/
+
+QmlCompass::QmlCompass(QObject *parent)
+ : QmlSensor(parent)
+ , m_sensor(new QCompass(this))
+{
+}
+
+QmlCompass::~QmlCompass()
+{
+}
+
+QmlSensorReading *QmlCompass::createReading() const
+{
+ return new QmlCompassReading(m_sensor);
+}
+
+QSensor *QmlCompass::sensor() const
+{
+ return m_sensor;
+}
+
+/*!
+ \qmltype CompassReading
+//! \instantiates QmlCompassReading
+ \ingroup qml-sensors_reading
+ \inqmlmodule QtSensors
+ \since QtSensors 5.0
+ \inherits SensorReading
+ \brief The CompassReading element holds the most recent Compass reading.
+
+ The CompassReading element holds the most recent Compass reading.
+
+ This element wraps the QCompassReading class. Please see the documentation for
+ QCompassReading for details.
+
+ This element cannot be directly created.
+*/
+
+QmlCompassReading::QmlCompassReading(QCompass *sensor)
+ : m_sensor(sensor)
+{
+}
+
+QmlCompassReading::~QmlCompassReading()
+{
+}
+
+/*!
+ \qmlproperty qreal CompassReading::azimuth
+ This property holds the azimuth of the device.
+
+ Please see QCompassReading::azimuth for information about this property.
+*/
+
+qreal QmlCompassReading::azimuth() const
+{
+ return m_azimuth;
+}
+
+QBindable<qreal> QmlCompassReading::bindableAzimuth() const
+{
+ return &m_azimuth;
+}
+
+/*!
+ \qmlproperty qreal CompassReading::calibrationLevel
+ This property holds the calibration level of the reading.
+
+ Please see QCompassReading::calibrationLevel for information about this property.
+*/
+
+qreal QmlCompassReading::calibrationLevel() const
+{
+ return m_calibrationLevel;
+}
+
+QBindable<qreal> QmlCompassReading::bindableCalibrationLevel() const
+{
+ return &m_calibrationLevel;
+}
+
+QSensorReading *QmlCompassReading::reading() const
+{
+ return m_sensor->reading();
+}
+
+void QmlCompassReading::readingUpdate()
+{
+ m_azimuth = m_sensor->reading()->azimuth();
+ m_calibrationLevel = m_sensor->reading()->calibrationLevel();
+}
diff --git a/src/sensorsquick/qmlcompass_p.h b/src/sensorsquick/qmlcompass_p.h
new file mode 100644
index 00000000..312bf13c
--- /dev/null
+++ b/src/sensorsquick/qmlcompass_p.h
@@ -0,0 +1,73 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QMLCOMPASS_P_H
+#define QMLCOMPASS_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 "qmlsensor_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QCompass;
+
+class Q_SENSORSQUICK_EXPORT QmlCompass : public QmlSensor
+{
+ Q_OBJECT
+ QML_NAMED_ELEMENT(Compass)
+ QML_ADDED_IN_VERSION(5,0)
+public:
+ explicit QmlCompass(QObject *parent = 0);
+ ~QmlCompass();
+
+ QSensor *sensor() const override;
+
+private:
+ QCompass *m_sensor;
+ QmlSensorReading *createReading() const override;
+};
+
+class Q_SENSORSQUICK_EXPORT QmlCompassReading : public QmlSensorReading
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal azimuth READ azimuth NOTIFY azimuthChanged BINDABLE bindableAzimuth)
+ Q_PROPERTY(qreal calibrationLevel READ calibrationLevel
+ NOTIFY calibrationLevelChanged BINDABLE bindableCalibrationLevel)
+ QML_NAMED_ELEMENT(CompassReading)
+ QML_UNCREATABLE("Cannot create CompassReading")
+ QML_ADDED_IN_VERSION(5,0)
+public:
+ explicit QmlCompassReading(QCompass *sensor);
+ ~QmlCompassReading();
+
+ qreal azimuth() const;
+ QBindable<qreal> bindableAzimuth() const;
+ qreal calibrationLevel() const;
+ QBindable<qreal> bindableCalibrationLevel() const;
+
+Q_SIGNALS:
+ void azimuthChanged();
+ void calibrationLevelChanged();
+
+private:
+ QSensorReading *reading() const override;
+ void readingUpdate() override;
+ QCompass *m_sensor;
+ Q_OBJECT_BINDABLE_PROPERTY(QmlCompassReading, qreal,
+ m_azimuth, &QmlCompassReading::azimuthChanged)
+ Q_OBJECT_BINDABLE_PROPERTY(QmlCompassReading, qreal,
+ m_calibrationLevel, &QmlCompassReading::calibrationLevelChanged)
+};
+
+QT_END_NAMESPACE
+#endif
diff --git a/src/sensorsquick/qmlgyroscope.cpp b/src/sensorsquick/qmlgyroscope.cpp
new file mode 100644
index 00000000..bb4458f7
--- /dev/null
+++ b/src/sensorsquick/qmlgyroscope.cpp
@@ -0,0 +1,130 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qmlgyroscope_p.h"
+#include <QtSensors/QGyroscope>
+
+/*!
+ \qmltype Gyroscope
+//! \instantiates QmlGyroscope
+ \ingroup qml-sensors_type
+ \inqmlmodule QtSensors
+ \since QtSensors 5.0
+ \inherits Sensor
+ \brief The Gyroscope element reports on rotational acceleration
+ around the X, Y and Z axes.
+
+ This element wraps the QGyroscope class. Please see the documentation for
+ QGyroscope for details.
+
+ \sa GyroscopeReading
+*/
+
+QmlGyroscope::QmlGyroscope(QObject *parent)
+ : QmlSensor(parent)
+ , m_sensor(new QGyroscope(this))
+{
+}
+
+QmlGyroscope::~QmlGyroscope()
+{
+}
+
+QmlSensorReading *QmlGyroscope::createReading() const
+{
+ return new QmlGyroscopeReading(m_sensor);
+}
+
+QSensor *QmlGyroscope::sensor() const
+{
+ return m_sensor;
+}
+
+/*!
+ \qmltype GyroscopeReading
+//! \instantiates QmlGyroscopeReading
+ \ingroup qml-sensors_reading
+ \inqmlmodule QtSensors
+ \since QtSensors 5.0
+ \inherits SensorReading
+ \brief The GyroscopeReading element holds the most recent Gyroscope reading.
+
+ The GyroscopeReading element holds the most recent Gyroscope reading.
+
+ This element wraps the QGyroscopeReading class. Please see the documentation for
+ QGyroscopeReading for details.
+
+ This element cannot be directly created.
+*/
+
+QmlGyroscopeReading::QmlGyroscopeReading(QGyroscope *sensor)
+ : m_sensor(sensor)
+{
+}
+
+QmlGyroscopeReading::~QmlGyroscopeReading()
+{
+}
+
+/*!
+ \qmlproperty qreal GyroscopeReading::x
+ This property holds the angular velocity around the x axis.
+
+ Please see QGyroscopeReading::x for information about this property.
+*/
+
+qreal QmlGyroscopeReading::x() const
+{
+ return m_x;
+}
+
+QBindable<qreal> QmlGyroscopeReading::bindableX() const
+{
+ return &m_x;
+}
+
+/*!
+ \qmlproperty qreal GyroscopeReading::y
+ This property holds the angular velocity around the y axis.
+
+ Please see QGyroscopeReading::y for information about this property.
+*/
+
+qreal QmlGyroscopeReading::y() const
+{
+ return m_y;
+}
+
+QBindable<qreal> QmlGyroscopeReading::bindableY() const
+{
+ return &m_y;
+}
+
+/*!
+ \qmlproperty qreal GyroscopeReading::z
+ This property holds the angular velocity around the z axis.
+
+ Please see QGyroscopeReading::z for information about this property.
+*/
+
+qreal QmlGyroscopeReading::z() const
+{
+ return m_z;
+}
+
+QBindable<qreal> QmlGyroscopeReading::bindableZ() const
+{
+ return &m_z;
+}
+
+QSensorReading *QmlGyroscopeReading::reading() const
+{
+ return m_sensor->reading();
+}
+
+void QmlGyroscopeReading::readingUpdate()
+{
+ m_x = m_sensor->reading()->x();
+ m_y = m_sensor->reading()->y();
+ m_z = m_sensor->reading()->z();
+}
diff --git a/src/sensorsquick/qmlgyroscope_p.h b/src/sensorsquick/qmlgyroscope_p.h
new file mode 100644
index 00000000..02697718
--- /dev/null
+++ b/src/sensorsquick/qmlgyroscope_p.h
@@ -0,0 +1,78 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QMLGYROSCOPE_P_H
+#define QMLGYROSCOPE_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 "qmlsensor_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QGyroscope;
+
+class Q_SENSORSQUICK_EXPORT QmlGyroscope : public QmlSensor
+{
+ Q_OBJECT
+ QML_NAMED_ELEMENT(Gyroscope)
+ QML_ADDED_IN_VERSION(5,0)
+public:
+ explicit QmlGyroscope(QObject *parent = 0);
+ ~QmlGyroscope();
+
+ QSensor *sensor() const override;
+
+private:
+ QGyroscope *m_sensor;
+ QmlSensorReading *createReading() const override;
+};
+
+class Q_SENSORSQUICK_EXPORT QmlGyroscopeReading : public QmlSensorReading
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal x READ x NOTIFY xChanged BINDABLE bindableX)
+ Q_PROPERTY(qreal y READ y NOTIFY yChanged BINDABLE bindableY)
+ Q_PROPERTY(qreal z READ z NOTIFY zChanged BINDABLE bindableZ)
+ QML_NAMED_ELEMENT(GyroscopeReading)
+ QML_UNCREATABLE("Cannot create GyroscopeReading")
+ QML_ADDED_IN_VERSION(5,0)
+public:
+ explicit QmlGyroscopeReading(QGyroscope *sensor);
+ ~QmlGyroscopeReading();
+
+ qreal x() const;
+ QBindable<qreal> bindableX() const;
+ qreal y() const;
+ QBindable<qreal> bindableY() const;
+ qreal z() const;
+ QBindable<qreal> bindableZ() const;
+
+Q_SIGNALS:
+ void xChanged();
+ void yChanged();
+ void zChanged();
+
+private:
+ QSensorReading *reading() const override;
+ void readingUpdate() override;
+ QGyroscope *m_sensor;
+ Q_OBJECT_BINDABLE_PROPERTY(QmlGyroscopeReading, qreal,
+ m_x, &QmlGyroscopeReading::xChanged)
+ Q_OBJECT_BINDABLE_PROPERTY(QmlGyroscopeReading, qreal,
+ m_y, &QmlGyroscopeReading::yChanged)
+ Q_OBJECT_BINDABLE_PROPERTY(QmlGyroscopeReading, qreal,
+ m_z, &QmlGyroscopeReading::zChanged)
+};
+
+QT_END_NAMESPACE
+#endif
diff --git a/src/sensorsquick/qmlhumiditysensor.cpp b/src/sensorsquick/qmlhumiditysensor.cpp
new file mode 100644
index 00000000..915e81b6
--- /dev/null
+++ b/src/sensorsquick/qmlhumiditysensor.cpp
@@ -0,0 +1,115 @@
+// Copyright (C) 2016 Canonical Ltd
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qmlhumiditysensor_p.h"
+#include <QtSensors/QHumiditySensor>
+
+/*!
+ \qmltype HumiditySensor
+//! \instantiates QmlHumiditySensor
+ \ingroup qml-sensors_type
+ \inqmlmodule QtSensors
+ \since QtSensors 5.9
+ \inherits Sensor
+ \brief The HumiditySensor element reports on humidity.
+
+ The HumiditySensor element reports on humidity.
+
+ This element wraps the QHumiditySensor class. Please see the documentation for
+ QHumiditySensor for details.
+
+ \sa HumidityReading
+*/
+
+QmlHumiditySensor::QmlHumiditySensor(QObject *parent)
+ : QmlSensor(parent)
+ , m_sensor(new QHumiditySensor(this))
+{
+}
+
+QmlHumiditySensor::~QmlHumiditySensor()
+{
+}
+
+QmlSensorReading *QmlHumiditySensor::createReading() const
+{
+ return new QmlHumidityReading(m_sensor);
+}
+
+QSensor *QmlHumiditySensor::sensor() const
+{
+ return m_sensor;
+}
+
+/*!
+ \qmltype HumidityReading
+//! \instantiates QmlHumidityReading
+ \ingroup qml-sensors_reading
+ \inqmlmodule QtSensors
+ \since QtSensors 5.9
+ \inherits SensorReading
+ \brief The HumidityReading element holds the most recent HumiditySensor reading.
+
+ The HumidityReading element holds the most recent HumiditySensor reading.
+
+ This element wraps the QHumidityReading class. Please see the documentation for
+ QHumidityReading for details.
+
+ This element cannot be directly created.
+*/
+
+QmlHumidityReading::QmlHumidityReading(QHumiditySensor *sensor)
+ : m_sensor(sensor)
+ , m_relativeHumidity(0)
+ , m_absoluteHumidity(0)
+{
+}
+
+QmlHumidityReading::~QmlHumidityReading()
+{
+}
+
+/*!
+ \qmlproperty qreal HumidityReading::relativeHumidity
+ This property holds the relative humidity as a percentage.
+
+ Please see QHumidityReading::relativeHumidity for information about this property.
+*/
+
+qreal QmlHumidityReading::relativeHumidity() const
+{
+ return m_relativeHumidity;
+}
+
+QBindable<qreal> QmlHumidityReading::bindableRelativeHumidity() const
+{
+ return &m_relativeHumidity;
+}
+
+/*!
+ \qmlproperty qreal HumidityReading::absoluteHumidity
+ This property holds the absolute humidity in grams per cubic meter (g/m3).
+
+ Please see QHumidityReading::absoluteHumidity for information about this property.
+*/
+
+qreal QmlHumidityReading::absoluteHumidity() const
+{
+ return m_absoluteHumidity;
+}
+
+QBindable<qreal> QmlHumidityReading::bindableAbsoluteHumidity() const
+{
+ return &m_absoluteHumidity;
+}
+
+QSensorReading *QmlHumidityReading::reading() const
+{
+ return m_sensor->reading();
+}
+
+void QmlHumidityReading::readingUpdate()
+{
+ m_relativeHumidity = m_sensor->reading()->relativeHumidity();
+ m_absoluteHumidity = m_sensor->reading()->absoluteHumidity();
+}
diff --git a/src/sensorsquick/qmlhumiditysensor_p.h b/src/sensorsquick/qmlhumiditysensor_p.h
new file mode 100644
index 00000000..e01b0dc3
--- /dev/null
+++ b/src/sensorsquick/qmlhumiditysensor_p.h
@@ -0,0 +1,77 @@
+// Copyright (C) 2016 Canonical Ltd
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QMLHUMIDITYSENSOR_P_H
+#define QMLHUMIDITYSENSOR_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 "qmlsensor_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QHumiditySensor;
+
+class Q_SENSORSQUICK_EXPORT QmlHumiditySensor : public QmlSensor
+{
+ Q_OBJECT
+
+ QML_NAMED_ELEMENT(HumiditySensor)
+ QML_ADDED_IN_VERSION(5,9)
+public:
+ explicit QmlHumiditySensor(QObject *parent = nullptr);
+ ~QmlHumiditySensor();
+
+ QSensor *sensor() const override;
+
+private:
+ QmlSensorReading *createReading() const override;
+
+ QHumiditySensor *m_sensor;
+};
+
+class Q_SENSORSQUICK_EXPORT QmlHumidityReading : public QmlSensorReading
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal relativeHumidity READ relativeHumidity
+ NOTIFY relativeHumidityChanged BINDABLE bindableRelativeHumidity)
+ Q_PROPERTY(qreal absoluteHumidity READ absoluteHumidity
+ NOTIFY absoluteHumidityChanged BINDABLE bindableAbsoluteHumidity)
+ QML_NAMED_ELEMENT(HumidityReading)
+ QML_UNCREATABLE("Cannot create HumidityReading")
+ QML_ADDED_IN_VERSION(5,9)
+public:
+ explicit QmlHumidityReading(QHumiditySensor *sensor);
+ ~QmlHumidityReading();
+
+ qreal relativeHumidity() const;
+ QBindable<qreal> bindableRelativeHumidity() const;
+ qreal absoluteHumidity() const;
+ QBindable<qreal> bindableAbsoluteHumidity() const;
+
+Q_SIGNALS:
+ void relativeHumidityChanged();
+ void absoluteHumidityChanged();
+
+private:
+ QSensorReading *reading() const override;
+ void readingUpdate() override;
+
+ QHumiditySensor *m_sensor;
+ Q_OBJECT_BINDABLE_PROPERTY(QmlHumidityReading, qreal,
+ m_relativeHumidity, &QmlHumidityReading::relativeHumidityChanged)
+ Q_OBJECT_BINDABLE_PROPERTY(QmlHumidityReading, qreal,
+ m_absoluteHumidity, &QmlHumidityReading::absoluteHumidityChanged)
+};
+
+QT_END_NAMESPACE
+#endif
diff --git a/src/sensorsquick/qmlirproximitysensor.cpp b/src/sensorsquick/qmlirproximitysensor.cpp
new file mode 100644
index 00000000..84ccc455
--- /dev/null
+++ b/src/sensorsquick/qmlirproximitysensor.cpp
@@ -0,0 +1,96 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qmlirproximitysensor_p.h"
+#include <QtSensors/QIRProximitySensor>
+
+/*!
+ \qmltype IRProximitySensor
+//! \instantiates QmlIRProximitySensor
+ \ingroup qml-sensors_type
+ \inqmlmodule QtSensors
+ \since QtSensors 5.0
+ \inherits Sensor
+ \brief The IRProximitySensor element reports on infra-red reflectance values.
+ \internal
+
+ This element wraps the QIRProximitySensor class. Please see the documentation for
+ QIRProximitySensor for details.
+
+ \sa IRProximityReading
+*/
+
+QmlIRProximitySensor::QmlIRProximitySensor(QObject *parent)
+ : QmlSensor(parent)
+ , m_sensor(new QIRProximitySensor(this))
+{
+}
+
+QmlIRProximitySensor::~QmlIRProximitySensor()
+{
+}
+
+QmlSensorReading *QmlIRProximitySensor::createReading() const
+{
+ return new QmlIRProximitySensorReading(m_sensor);
+}
+
+QSensor *QmlIRProximitySensor::sensor() const
+{
+ return m_sensor;
+}
+
+/*!
+ \qmltype IRProximityReading
+//! \instantiates QmlIRProximitySensorReading
+ \ingroup qml-sensors_reading
+ \inqmlmodule QtSensors
+ \since QtSensors 5.0
+ \inherits SensorReading
+ \brief The IRProximityReading element holds the most recent IR proximity reading.
+ \internal
+
+ The IRProximityReading element holds the most recent IR proximity reading.
+
+ This element wraps the QIRProximityReading class. Please see the documentation for
+ QIRProximityReading for details.
+
+ This element cannot be directly created.
+*/
+
+QmlIRProximitySensorReading::QmlIRProximitySensorReading(QIRProximitySensor *sensor)
+ : m_sensor(sensor)
+{
+}
+
+QmlIRProximitySensorReading::~QmlIRProximitySensorReading()
+{
+}
+
+/*!
+ \qmlproperty qreal IRProximityReading::reflectance
+ This property holds the reflectance value.
+
+ Please see QIRProximityReading::reflectance for information about this property.
+*/
+
+qreal QmlIRProximitySensorReading::reflectance() const
+{
+ return m_reflectance;
+}
+
+QBindable<qreal> QmlIRProximitySensorReading::bindableReflectance() const
+{
+ return &m_reflectance;
+}
+
+
+QSensorReading *QmlIRProximitySensorReading::reading() const
+{
+ return m_sensor->reading();
+}
+
+void QmlIRProximitySensorReading::readingUpdate()
+{
+ m_reflectance = m_sensor->reading()->reflectance();
+}
diff --git a/src/sensorsquick/qmlirproximitysensor_p.h b/src/sensorsquick/qmlirproximitysensor_p.h
new file mode 100644
index 00000000..b1f97d5d
--- /dev/null
+++ b/src/sensorsquick/qmlirproximitysensor_p.h
@@ -0,0 +1,67 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QMLIRPROXIMITYSENSOR_P_H
+#define QMLIRPROXIMITYSENSOR_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 "qmlsensor_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QIRProximitySensor;
+
+class Q_SENSORSQUICK_EXPORT QmlIRProximitySensor : public QmlSensor
+{
+ Q_OBJECT
+ QML_NAMED_ELEMENT(IRProximitySensor)
+ QML_ADDED_IN_VERSION(5,0)
+public:
+ explicit QmlIRProximitySensor(QObject *parent = 0);
+ ~QmlIRProximitySensor();
+
+ QSensor *sensor() const override;
+
+private:
+ QIRProximitySensor *m_sensor;
+ QmlSensorReading *createReading() const override;
+};
+
+class Q_SENSORSQUICK_EXPORT QmlIRProximitySensorReading : public QmlSensorReading
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal reflectance READ reflectance
+ NOTIFY reflectanceChanged BINDABLE bindableReflectance)
+ QML_NAMED_ELEMENT(IRProximityReading)
+ QML_UNCREATABLE("Cannot create IRProximityReading")
+ QML_ADDED_IN_VERSION(5,0)
+public:
+ explicit QmlIRProximitySensorReading(QIRProximitySensor *sensor);
+ ~QmlIRProximitySensorReading();
+
+ qreal reflectance() const;
+ QBindable<qreal> bindableReflectance() const;
+
+Q_SIGNALS:
+ void reflectanceChanged();
+
+private:
+ QSensorReading *reading() const override;
+ void readingUpdate() override;
+ QIRProximitySensor *m_sensor;
+ Q_OBJECT_BINDABLE_PROPERTY(QmlIRProximitySensorReading, qreal,
+ m_reflectance, &QmlIRProximitySensorReading::reflectanceChanged)
+};
+
+QT_END_NAMESPACE
+#endif
diff --git a/src/sensorsquick/qmllidsensor.cpp b/src/sensorsquick/qmllidsensor.cpp
new file mode 100644
index 00000000..be1f600b
--- /dev/null
+++ b/src/sensorsquick/qmllidsensor.cpp
@@ -0,0 +1,116 @@
+// Copyright (C) 2016 Canonical, Ltd
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+#include "qmllidsensor_p.h"
+#include <QtSensors/QLidSensor>
+
+/*!
+ \qmltype LidSensor
+//! \instantiates QmlLidSensor
+ \ingroup qml-sensors_type
+ \inqmlmodule QtSensors
+ \since QtSensors 5.9
+ \inherits Sensor
+ \brief The LidSensor element reports on whether a device is closed.
+ \internal
+
+ The LidSensor element reports on whether a device is closed.
+
+ This element wraps the QLidSensor class. Please see the documentation for
+ QLidSensor for details.
+
+ \sa LidReading
+*/
+
+QmlLidSensor::QmlLidSensor(QObject *parent)
+ : QmlSensor(parent)
+ , m_sensor(new QLidSensor(this))
+{
+}
+
+QmlLidSensor::~QmlLidSensor()
+{
+}
+
+QmlSensorReading *QmlLidSensor::createReading() const
+{
+ return new QmlLidReading(m_sensor);
+}
+
+QSensor *QmlLidSensor::sensor() const
+{
+ return m_sensor;
+}
+
+/*!
+ \qmltype LidReading
+//! \instantiates QmlLidReading
+ \ingroup qml-sensors_reading
+ \inqmlmodule QtSensors
+ \since QtSensors 5.9
+ \inherits SensorReading
+ \brief The LidReading element holds the most recent LidSensor reading.
+ \internal
+
+ The LidReading element holds the most recent LidSensor reading.
+
+ This element wraps the QLidReading class. Please see the documentation for
+ QLidReading for details.
+
+ This element cannot be directly created.
+*/
+
+QmlLidReading::QmlLidReading(QLidSensor *sensor)
+ : m_sensor(sensor)
+ , m_backClosed(false)
+ , m_frontClosed(true)
+{
+}
+
+QmlLidReading::~QmlLidReading()
+{
+}
+
+/*!
+ \qmlproperty qreal LidReading::backLidClosed
+ This property holds whether the back lid is closed.
+
+ Please see QLidReading::backLidClosed for information about this property.
+*/
+
+bool QmlLidReading::backLidClosed() const
+{
+ return m_backClosed;
+}
+
+QBindable<bool> QmlLidReading::bindableBackLidClosed() const
+{
+ return &m_backClosed;
+}
+
+/*!
+ \qmlproperty qreal LidReading::frontLidClosed
+ This property holds whether the front lid is closed.
+
+ Please see QLidReading::frontLidClosed for information about this property.
+*/
+
+bool QmlLidReading::frontLidClosed() const
+{
+ return m_frontClosed;
+}
+
+QBindable<bool> QmlLidReading::bindableFrontLidClosed() const
+{
+ return &m_frontClosed;
+}
+
+QSensorReading *QmlLidReading::reading() const
+{
+ return m_sensor->reading();
+}
+
+void QmlLidReading::readingUpdate()
+{
+ m_backClosed = m_sensor->reading()->backLidClosed();
+ m_frontClosed = m_sensor->reading()->frontLidClosed();
+}
diff --git a/src/sensorsquick/qmllidsensor_p.h b/src/sensorsquick/qmllidsensor_p.h
new file mode 100644
index 00000000..1ddf60a9
--- /dev/null
+++ b/src/sensorsquick/qmllidsensor_p.h
@@ -0,0 +1,75 @@
+// Copyright (C) 2016 Canonical, Ltd
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+#ifndef QMLLIDSENSOR_P_H
+#define QMLLIDSENSOR_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 "qmlsensor_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QLidSensor;
+
+class Q_SENSORSQUICK_EXPORT QmlLidSensor : public QmlSensor
+{
+ Q_OBJECT
+ QML_NAMED_ELEMENT(LidSensor)
+ QML_ADDED_IN_VERSION(5,9)
+public:
+ explicit QmlLidSensor(QObject *parent = 0);
+ ~QmlLidSensor();
+
+ QSensor *sensor() const override;
+
+private:
+ QmlSensorReading *createReading() const override;
+
+ QLidSensor *m_sensor;
+};
+
+class Q_SENSORSQUICK_EXPORT QmlLidReading : public QmlSensorReading
+{
+ Q_OBJECT
+ Q_PROPERTY(bool backLidClosed READ backLidClosed
+ NOTIFY backLidChanged BINDABLE bindableBackLidClosed)
+ Q_PROPERTY(bool frontLidClosed READ frontLidClosed
+ NOTIFY frontLidChanged BINDABLE bindableFrontLidClosed)
+ QML_NAMED_ELEMENT(LidReading)
+ QML_UNCREATABLE("Cannot create LidReading")
+ QML_ADDED_IN_VERSION(5,9)
+public:
+ explicit QmlLidReading(QLidSensor *sensor);
+ ~QmlLidReading();
+
+ bool backLidClosed() const;
+ QBindable<bool> bindableBackLidClosed() const;
+ bool frontLidClosed() const;
+ QBindable<bool> bindableFrontLidClosed() const;
+
+Q_SIGNALS:
+ void backLidChanged(bool closed);
+ bool frontLidChanged(bool closed);
+
+private:
+ QSensorReading *reading() const override;
+ void readingUpdate() override;
+
+ QLidSensor *m_sensor;
+ Q_OBJECT_BINDABLE_PROPERTY(QmlLidReading, bool,
+ m_backClosed, &QmlLidReading::backLidChanged)
+ Q_OBJECT_BINDABLE_PROPERTY(QmlLidReading, bool,
+ m_frontClosed, &QmlLidReading::frontLidChanged)
+};
+
+QT_END_NAMESPACE
+#endif
diff --git a/src/sensorsquick/qmllightsensor.cpp b/src/sensorsquick/qmllightsensor.cpp
new file mode 100644
index 00000000..f80dd630
--- /dev/null
+++ b/src/sensorsquick/qmllightsensor.cpp
@@ -0,0 +1,109 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qmllightsensor_p.h"
+#include <QtSensors/QLightSensor>
+
+/*!
+ \qmltype LightSensor
+//! \instantiates QmlLightSensor
+ \ingroup qml-sensors_type
+ \inqmlmodule QtSensors
+ \since QtSensors 5.0
+ \inherits Sensor
+ \brief The LightSensor element reports on light levels using LUX.
+
+ The LightSensor element reports on light levels using LUX.
+
+ This element wraps the QLightSensor class. Please see the documentation for
+ QLightSensor for details.
+
+ \sa LightReading
+*/
+
+QmlLightSensor::QmlLightSensor(QObject *parent)
+ : QmlSensor(parent)
+ , m_sensor(new QLightSensor(this))
+{
+ connect(m_sensor, SIGNAL(fieldOfViewChanged(qreal)),
+ this, SIGNAL(fieldOfViewChanged(qreal)));
+}
+
+QmlLightSensor::~QmlLightSensor()
+{
+}
+
+QmlSensorReading *QmlLightSensor::createReading() const
+{
+ return new QmlLightSensorReading(m_sensor);
+}
+
+QSensor *QmlLightSensor::sensor() const
+{
+ return m_sensor;
+}
+
+/*!
+ \qmlproperty qreal LightSensor::fieldOfView
+ This property holds a value indicating the field of view.
+
+ Please see QLightSensor::fieldOfView for information about this property.
+*/
+
+qreal QmlLightSensor::fieldOfView() const
+{
+ return m_sensor->fieldOfView();
+}
+
+/*!
+ \qmltype LightReading
+//! \instantiates QmlLightSensorReading
+ \ingroup qml-sensors_reading
+ \inqmlmodule QtSensors
+ \since QtSensors 5.0
+ \inherits SensorReading
+ \brief The LightReading element holds the most recent LightSensor reading.
+
+ The LightReading element holds the most recent LightSensor reading.
+
+ This element wraps the QLightReading class. Please see the documentation for
+ QLightReading for details.
+
+ This element cannot be directly created.
+*/
+
+QmlLightSensorReading::QmlLightSensorReading(QLightSensor *sensor)
+ : m_sensor(sensor)
+{
+}
+
+QmlLightSensorReading::~QmlLightSensorReading()
+{
+}
+
+/*!
+ \qmlproperty qreal LightReading::illuminance
+ This property holds the light level.
+
+ Please see QLightReading::illuminance for information about this property.
+*/
+
+qreal QmlLightSensorReading::illuminance() const
+{
+ return m_illuminance;
+}
+
+QBindable<qreal> QmlLightSensorReading::bindableIlluminance() const
+{
+ return &m_illuminance;
+}
+
+QSensorReading *QmlLightSensorReading::reading() const
+{
+ return m_sensor->reading();
+}
+
+void QmlLightSensorReading::readingUpdate()
+{
+ m_illuminance = m_sensor->reading()->lux();
+}
diff --git a/src/sensorsquick/qmllightsensor_p.h b/src/sensorsquick/qmllightsensor_p.h
new file mode 100644
index 00000000..6758ffba
--- /dev/null
+++ b/src/sensorsquick/qmllightsensor_p.h
@@ -0,0 +1,72 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QMLLIGHTSENSOR_P_H
+#define QMLLIGHTSENSOR_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 "qmlsensor_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QLightSensor;
+
+class Q_SENSORSQUICK_EXPORT QmlLightSensor : public QmlSensor
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal fieldOfView READ fieldOfView NOTIFY fieldOfViewChanged)
+ QML_NAMED_ELEMENT(LightSensor)
+ QML_ADDED_IN_VERSION(5,0)
+public:
+ explicit QmlLightSensor(QObject *parent = 0);
+ ~QmlLightSensor();
+
+ qreal fieldOfView() const;
+ QSensor *sensor() const override;
+
+Q_SIGNALS:
+ void fieldOfViewChanged(qreal fieldOfView);
+
+private:
+ QLightSensor *m_sensor;
+ QmlSensorReading *createReading() const override;
+};
+
+class Q_SENSORSQUICK_EXPORT QmlLightSensorReading : public QmlSensorReading
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal illuminance READ illuminance
+ NOTIFY illuminanceChanged BINDABLE bindableIlluminance)
+ QML_NAMED_ELEMENT(LightReading)
+ QML_UNCREATABLE("Cannot create LightReading")
+ QML_ADDED_IN_VERSION(5,0)
+public:
+ explicit QmlLightSensorReading(QLightSensor *sensor);
+ ~QmlLightSensorReading();
+
+ qreal illuminance() const;
+ QBindable<qreal> bindableIlluminance() const;
+
+Q_SIGNALS:
+ void illuminanceChanged();
+
+private:
+ QSensorReading *reading() const override;
+ void readingUpdate() override;
+ QLightSensor *m_sensor;
+ Q_OBJECT_BINDABLE_PROPERTY(QmlLightSensorReading, qreal,
+ m_illuminance, &QmlLightSensorReading::illuminanceChanged)
+};
+
+QT_END_NAMESPACE
+#endif
diff --git a/src/imports/sensors/qmlmagnetometer.cpp b/src/sensorsquick/qmlmagnetometer.cpp
index dba0ec4e..1bbaa0eb 100644
--- a/src/imports/sensors/qmlmagnetometer.cpp
+++ b/src/sensorsquick/qmlmagnetometer.cpp
@@ -1,48 +1,12 @@
-/****************************************************************************
-**
-** 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 "qmlmagnetometer.h"
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qmlmagnetometer_p.h"
#include <QtSensors/QMagnetometer>
/*!
\qmltype Magnetometer
- \instantiates QmlMagnetometer
+//! \instantiates QmlMagnetometer
\ingroup qml-sensors_type
\inqmlmodule QtSensors
\since QtSensors 5.0
@@ -100,7 +64,7 @@ void QmlMagnetometer::setReturnGeoValues(bool geo)
/*!
\qmltype MagnetometerReading
- \instantiates QmlMagnetometerReading
+//! \instantiates QmlMagnetometerReading
\ingroup qml-sensors_reading
\inqmlmodule QtSensors
\since QtSensors 5.0
@@ -116,8 +80,7 @@ void QmlMagnetometer::setReturnGeoValues(bool geo)
*/
QmlMagnetometerReading::QmlMagnetometerReading(QMagnetometer *sensor)
- : QmlSensorReading(sensor)
- , m_sensor(sensor)
+ : m_sensor(sensor)
{
}
@@ -137,6 +100,11 @@ qreal QmlMagnetometerReading::x() const
return m_x;
}
+QBindable<qreal> QmlMagnetometerReading::bindableX() const
+{
+ return &m_x;
+}
+
/*!
\qmlproperty qreal MagnetometerReading::y
This property holds the raw magnetic flux density on the Y axis.
@@ -149,6 +117,11 @@ qreal QmlMagnetometerReading::y() const
return m_y;
}
+QBindable<qreal> QmlMagnetometerReading::bindableY() const
+{
+ return &m_y;
+}
+
/*!
\qmlproperty qreal MagnetometerReading::z
This property holds the raw magnetic flux density on the Z axis.
@@ -161,6 +134,11 @@ qreal QmlMagnetometerReading::z() const
return m_z;
}
+QBindable<qreal> QmlMagnetometerReading::bindableZ() const
+{
+ return &m_z;
+}
+
/*!
\qmlproperty qreal MagnetometerReading::calibrationLevel
This property holds the accuracy of the reading.
@@ -173,6 +151,11 @@ qreal QmlMagnetometerReading::calibrationLevel() const
return m_calibrationLevel;
}
+QBindable<qreal> QmlMagnetometerReading::bindableCalibrationLevel() const
+{
+ return &m_calibrationLevel;
+}
+
QSensorReading *QmlMagnetometerReading::reading() const
{
return m_sensor->reading();
@@ -180,24 +163,8 @@ QSensorReading *QmlMagnetometerReading::reading() const
void QmlMagnetometerReading::readingUpdate()
{
- qreal magX = m_sensor->reading()->x();
- if (m_x != magX) {
- m_x = magX;
- Q_EMIT xChanged();
- }
- qreal magY = m_sensor->reading()->y();
- if (m_y != magY) {
- m_y = magY;
- Q_EMIT yChanged();
- }
- qreal magZ = m_sensor->reading()->z();
- if (m_z != magZ) {
- m_z = magZ;
- Q_EMIT zChanged();
- }
- qreal calLevel = m_sensor->reading()->calibrationLevel();
- if (m_calibrationLevel != calLevel) {
- m_calibrationLevel = calLevel;
- Q_EMIT calibrationLevelChanged();
- }
+ m_x = m_sensor->reading()->x();
+ m_y = m_sensor->reading()->y();
+ m_z = m_sensor->reading()->z();
+ m_calibrationLevel= m_sensor->reading()->calibrationLevel();
}
diff --git a/src/sensorsquick/qmlmagnetometer_p.h b/src/sensorsquick/qmlmagnetometer_p.h
new file mode 100644
index 00000000..9080f3e7
--- /dev/null
+++ b/src/sensorsquick/qmlmagnetometer_p.h
@@ -0,0 +1,93 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QMLMAGNETOMETER_P_H
+#define QMLMAGNETOMETER_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 "qmlsensor_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QMagnetometer;
+
+class Q_SENSORSQUICK_EXPORT QmlMagnetometer : public QmlSensor
+{
+ Q_OBJECT
+ Q_PROPERTY(bool returnGeoValues READ returnGeoValues WRITE setReturnGeoValues NOTIFY returnGeoValuesChanged)
+ QML_NAMED_ELEMENT(Magnetometer)
+ QML_ADDED_IN_VERSION(5,0)
+public:
+ explicit QmlMagnetometer(QObject *parent = 0);
+ ~QmlMagnetometer();
+
+ bool returnGeoValues() const;
+ void setReturnGeoValues(bool geo);
+
+ QSensor *sensor() const override;
+
+Q_SIGNALS:
+ void returnGeoValuesChanged(bool returnGeoValues);
+
+private:
+ QMagnetometer *m_sensor;
+ QmlSensorReading *createReading() const override;
+};
+
+class Q_SENSORSQUICK_EXPORT QmlMagnetometerReading : public QmlSensorReading
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal x READ x NOTIFY xChanged BINDABLE bindableX)
+ Q_PROPERTY(qreal y READ y NOTIFY yChanged BINDABLE bindableY)
+ Q_PROPERTY(qreal z READ z NOTIFY zChanged BINDABLE bindableZ)
+ Q_PROPERTY(qreal calibrationLevel READ calibrationLevel
+ NOTIFY calibrationLevelChanged BINDABLE bindableCalibrationLevel)
+ QML_NAMED_ELEMENT(MagnetometerReading)
+ QML_UNCREATABLE("Cannot create MagnetometerReading")
+ QML_ADDED_IN_VERSION(5,0)
+public:
+ explicit QmlMagnetometerReading(QMagnetometer *sensor);
+ ~QmlMagnetometerReading();
+
+ qreal x() const;
+ QBindable<qreal> bindableX() const;
+ qreal y() const;
+ QBindable<qreal> bindableY() const;
+ qreal z() const;
+ QBindable<qreal> bindableZ() const;
+ qreal calibrationLevel() const;
+ QBindable<qreal> bindableCalibrationLevel() const;
+
+
+Q_SIGNALS:
+ void xChanged();
+ void yChanged();
+ void zChanged();
+ void calibrationLevelChanged();
+
+private:
+ QSensorReading *reading() const override;
+ void readingUpdate() override;
+ QMagnetometer *m_sensor;
+ Q_OBJECT_BINDABLE_PROPERTY(QmlMagnetometerReading, qreal,
+ m_x, &QmlMagnetometerReading::xChanged)
+ Q_OBJECT_BINDABLE_PROPERTY(QmlMagnetometerReading, qreal,
+ m_y, &QmlMagnetometerReading::yChanged)
+ Q_OBJECT_BINDABLE_PROPERTY(QmlMagnetometerReading, qreal,
+ m_z, &QmlMagnetometerReading::zChanged)
+ Q_OBJECT_BINDABLE_PROPERTY(QmlMagnetometerReading, qreal,
+ m_calibrationLevel, &QmlMagnetometerReading::calibrationLevelChanged)
+};
+
+QT_END_NAMESPACE
+#endif
diff --git a/src/imports/sensors/qmlorientationsensor.cpp b/src/sensorsquick/qmlorientationsensor.cpp
index 25bda074..c40bd474 100644
--- a/src/imports/sensors/qmlorientationsensor.cpp
+++ b/src/sensorsquick/qmlorientationsensor.cpp
@@ -1,48 +1,12 @@
-/****************************************************************************
-**
-** 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 "qmlorientationsensor.h"
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qmlorientationsensor_p.h"
#include <QtSensors/QOrientationSensor>
/*!
\qmltype OrientationSensor
- \instantiates QmlOrientationSensor
+//! \instantiates QmlOrientationSensor
\ingroup qml-sensors_type
\inqmlmodule QtSensors
\since QtSensors 5.0
@@ -79,7 +43,7 @@ QSensor *QmlOrientationSensor::sensor() const
/*!
\qmltype OrientationReading
- \instantiates QmlOrientationSensorReading
+//! \instantiates QmlOrientationSensorReading
\ingroup qml-sensors_reading
\inqmlmodule QtSensors
\since QtSensors 5.0
@@ -95,8 +59,7 @@ QSensor *QmlOrientationSensor::sensor() const
*/
QmlOrientationSensorReading::QmlOrientationSensorReading(QOrientationSensor *sensor)
- : QmlSensorReading(sensor)
- , m_sensor(sensor)
+ : m_sensor(sensor)
{
}
@@ -126,6 +89,11 @@ QOrientationReading::Orientation QmlOrientationSensorReading::orientation() cons
return m_orientation;
}
+QBindable<QOrientationReading::Orientation> QmlOrientationSensorReading::bindableOrientation() const
+{
+ return &m_orientation;
+}
+
QSensorReading *QmlOrientationSensorReading::reading() const
{
return m_sensor->reading();
@@ -133,9 +101,5 @@ QSensorReading *QmlOrientationSensorReading::reading() const
void QmlOrientationSensorReading::readingUpdate()
{
- QOrientationReading::Orientation o = m_sensor->reading()->orientation();
- if (m_orientation != o) {
- m_orientation = o;
- Q_EMIT orientationChanged();
- }
+ m_orientation = m_sensor->reading()->orientation();
}
diff --git a/src/sensorsquick/qmlorientationsensor_p.h b/src/sensorsquick/qmlorientationsensor_p.h
new file mode 100644
index 00000000..9be7b7e5
--- /dev/null
+++ b/src/sensorsquick/qmlorientationsensor_p.h
@@ -0,0 +1,69 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QMLORIENTATIONSENSOR_P_H
+#define QMLORIENTATIONSENSOR_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 "qmlsensor_p.h"
+#include <QtSensors/QOrientationSensor>
+
+QT_BEGIN_NAMESPACE
+
+class QOrientationSensor;
+
+class Q_SENSORSQUICK_EXPORT QmlOrientationSensor : public QmlSensor
+{
+ Q_OBJECT
+ QML_NAMED_ELEMENT(OrientationSensor)
+ QML_ADDED_IN_VERSION(5,0)
+public:
+ explicit QmlOrientationSensor(QObject *parent = 0);
+ ~QmlOrientationSensor();
+
+ QSensor *sensor() const override;
+
+private:
+ QOrientationSensor *m_sensor;
+ QmlSensorReading *createReading() const override;
+};
+
+class Q_SENSORSQUICK_EXPORT QmlOrientationSensorReading : public QmlSensorReading
+{
+ Q_OBJECT
+ Q_PROPERTY(QOrientationReading::Orientation orientation READ orientation
+ NOTIFY orientationChanged BINDABLE bindableOrientation)
+ QML_NAMED_ELEMENT(OrientationReading)
+ QML_UNCREATABLE("Cannot create OrientationReading")
+ QML_ADDED_IN_VERSION(5,0)
+public:
+
+ explicit QmlOrientationSensorReading(QOrientationSensor *sensor);
+ ~QmlOrientationSensorReading();
+
+ QOrientationReading::Orientation orientation() const;
+ QBindable<QOrientationReading::Orientation> bindableOrientation() const;
+
+Q_SIGNALS:
+ void orientationChanged();
+
+private:
+ QSensorReading *reading() const override;
+ void readingUpdate() override;
+ QOrientationSensor *m_sensor;
+ Q_OBJECT_BINDABLE_PROPERTY(QmlOrientationSensorReading, QOrientationReading::Orientation,
+ m_orientation, &QmlOrientationSensorReading::orientationChanged)
+};
+
+QT_END_NAMESPACE
+#endif
diff --git a/src/sensorsquick/qmlpressuresensor.cpp b/src/sensorsquick/qmlpressuresensor.cpp
new file mode 100644
index 00000000..d2e38a33
--- /dev/null
+++ b/src/sensorsquick/qmlpressuresensor.cpp
@@ -0,0 +1,115 @@
+// Copyright (C) 2016 Research In Motion
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+#include "qmlpressuresensor_p.h"
+#include <QtSensors/QPressureSensor>
+
+/*!
+ \qmltype PressureSensor
+//! \instantiates QmlPressureSensor
+ \ingroup qml-sensors_type
+ \inqmlmodule QtSensors
+ \since QtSensors 5.1
+ \inherits Sensor
+ \brief The PressureSensor element reports on atmospheric pressure values.
+
+ The PressureSensor element reports on atmospheric pressure values.
+
+ This element wraps the QPressureSensor class. Please see the documentation for
+ QPressureSensor for details.
+
+ \sa PressureReading
+*/
+
+QmlPressureSensor::QmlPressureSensor(QObject *parent)
+ : QmlSensor(parent)
+ , m_sensor(new QPressureSensor(this))
+{
+}
+
+QmlPressureSensor::~QmlPressureSensor()
+{
+}
+
+QmlSensorReading *QmlPressureSensor::createReading() const
+{
+ return new QmlPressureReading(m_sensor);
+}
+
+QSensor *QmlPressureSensor::sensor() const
+{
+ return m_sensor;
+}
+
+/*!
+ \qmltype PressureReading
+//! \instantiates QmlPressureReading
+ \ingroup qml-sensors_reading
+ \inqmlmodule QtSensors
+ \since QtSensors 5.1
+ \inherits SensorReading
+ \brief The PressureReading element holds the most recent PressureSensor reading.
+
+ The PressureReading element holds the most recent PressureSensor reading.
+
+ This element wraps the QPressureReading class. Please see the documentation for
+ QPressureReading for details.
+
+ This element cannot be directly created.
+*/
+
+QmlPressureReading::QmlPressureReading(QPressureSensor *sensor)
+ : m_sensor(sensor)
+ , m_pressure(0)
+ , m_temperature(0)
+{
+}
+
+QmlPressureReading::~QmlPressureReading()
+{
+}
+
+/*!
+ \qmlproperty qreal PressureReading::pressure
+ This property holds the atmospheric pressure value in Pascals.
+
+ Please see QPressureReading::pressure for information about this property.
+*/
+
+qreal QmlPressureReading::pressure() const
+{
+ return m_pressure;
+}
+
+QBindable<qreal> QmlPressureReading::bindablePressure() const
+{
+ return &m_pressure;
+}
+
+/*!
+ \qmlproperty qreal PressureReading::temperature
+ This property holds the pressure sensor's temperature value in degrees Celsius.
+
+ Please see QPressureReading::temperature for information about this property.
+ \since QtSensors 5.2
+*/
+
+qreal QmlPressureReading::temperature() const
+{
+ return m_temperature;
+}
+
+QBindable<qreal> QmlPressureReading::bindableTemperature() const
+{
+ return &m_temperature;
+}
+
+QSensorReading *QmlPressureReading::reading() const
+{
+ return m_sensor->reading();
+}
+
+void QmlPressureReading::readingUpdate()
+{
+ m_pressure = m_sensor->reading()->pressure();
+ m_temperature = m_sensor->reading()->temperature();
+}
diff --git a/src/sensorsquick/qmlpressuresensor_p.h b/src/sensorsquick/qmlpressuresensor_p.h
new file mode 100644
index 00000000..8b531fba
--- /dev/null
+++ b/src/sensorsquick/qmlpressuresensor_p.h
@@ -0,0 +1,74 @@
+// Copyright (C) 2016 Research In Motion
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+#ifndef QMLPRESSURESENSOR_P_H
+#define QMLPRESSURESENSOR_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 "qmlsensor_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QPressureSensor;
+
+class Q_SENSORSQUICK_EXPORT QmlPressureSensor : public QmlSensor
+{
+ Q_OBJECT
+ QML_NAMED_ELEMENT(PressureSensor)
+ QML_ADDED_IN_VERSION(5,1)
+public:
+ explicit QmlPressureSensor(QObject *parent = 0);
+ ~QmlPressureSensor();
+
+ QSensor *sensor() const override;
+
+private:
+ QmlSensorReading *createReading() const override;
+
+ QPressureSensor *m_sensor;
+};
+
+class Q_SENSORSQUICK_EXPORT QmlPressureReading : public QmlSensorReading
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal pressure READ pressure NOTIFY pressureChanged BINDABLE bindablePressure)
+ Q_PROPERTY(qreal temperature READ temperature
+ NOTIFY temperatureChanged REVISION 1 BINDABLE bindableTemperature)
+ QML_NAMED_ELEMENT(PressureReading)
+ QML_UNCREATABLE("Cannot create PressureReading")
+ QML_ADDED_IN_VERSION(5,1)
+public:
+ explicit QmlPressureReading(QPressureSensor *sensor);
+ ~QmlPressureReading();
+
+ qreal pressure() const;
+ QBindable<qreal> bindablePressure() const;
+ qreal temperature() const;
+ QBindable<qreal> bindableTemperature() const;
+
+Q_SIGNALS:
+ void pressureChanged();
+ Q_REVISION(1) void temperatureChanged();
+
+private:
+ QSensorReading *reading() const override;
+ void readingUpdate() override;
+
+ QPressureSensor *m_sensor;
+ Q_OBJECT_BINDABLE_PROPERTY(QmlPressureReading, qreal,
+ m_pressure, &QmlPressureReading::pressureChanged)
+ Q_OBJECT_BINDABLE_PROPERTY(QmlPressureReading, qreal,
+ m_temperature, &QmlPressureReading::temperatureChanged)
+};
+
+QT_END_NAMESPACE
+#endif
diff --git a/src/sensorsquick/qmlproximitysensor.cpp b/src/sensorsquick/qmlproximitysensor.cpp
new file mode 100644
index 00000000..6019a15a
--- /dev/null
+++ b/src/sensorsquick/qmlproximitysensor.cpp
@@ -0,0 +1,95 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qmlproximitysensor_p.h"
+#include <QtSensors/QProximitySensor>
+
+/*!
+ \qmltype ProximitySensor
+//! \instantiates QmlProximitySensor
+ \ingroup qml-sensors_type
+ \inqmlmodule QtSensors
+ \since QtSensors 5.0
+ \inherits Sensor
+ \brief The ProximitySensor element reports on object proximity.
+
+ The ProximitySensor element reports on object proximity.
+
+ This element wraps the QProximitySensor class. Please see the documentation for
+ QProximitySensor for details.
+
+ \sa ProximityReading
+*/
+
+QmlProximitySensor::QmlProximitySensor(QObject *parent)
+ : QmlSensor(parent)
+ , m_sensor(new QProximitySensor(this))
+{
+}
+
+QmlProximitySensor::~QmlProximitySensor()
+{
+}
+
+QmlSensorReading *QmlProximitySensor::createReading() const
+{
+ return new QmlProximitySensorReading(m_sensor);
+}
+
+QSensor *QmlProximitySensor::sensor() const
+{
+ return m_sensor;
+}
+
+/*!
+ \qmltype ProximityReading
+//! \instantiates QmlProximitySensorReading
+ \ingroup qml-sensors_reading
+ \inqmlmodule QtSensors
+ \since QtSensors 5.0
+ \inherits SensorReading
+ \brief The ProximityReading element holds the most recent ProximitySensor reading.
+
+ The ProximityReading element holds the most recent ProximitySensor reading.
+
+ This element wraps the QProximityReading class. Please see the documentation for
+ QProximityReading for details.
+
+ This element cannot be directly created.
+*/
+
+QmlProximitySensorReading::QmlProximitySensorReading(QProximitySensor *sensor)
+ : m_sensor(sensor)
+{
+}
+
+QmlProximitySensorReading::~QmlProximitySensorReading()
+{
+}
+
+/*!
+ \qmlproperty bool ProximityReading::near
+ This property holds a value indicating if something is near.
+
+ Please see QProximityReading::near for information about this property.
+*/
+
+bool QmlProximitySensorReading::near() const
+{
+ return m_near;
+}
+
+QBindable<bool> QmlProximitySensorReading::bindableNear() const
+{
+ return &m_near;
+}
+
+QSensorReading *QmlProximitySensorReading::reading() const
+{
+ return m_sensor->reading();
+}
+
+void QmlProximitySensorReading::readingUpdate()
+{
+ m_near = m_sensor->reading()->close();
+}
diff --git a/src/sensorsquick/qmlproximitysensor_p.h b/src/sensorsquick/qmlproximitysensor_p.h
new file mode 100644
index 00000000..8ce4fdb8
--- /dev/null
+++ b/src/sensorsquick/qmlproximitysensor_p.h
@@ -0,0 +1,68 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QMLPROXIMITYSENSOR_P_H
+#define QMLPROXIMITYSENSOR_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 "qmlsensor_p.h"
+#ifdef near
+#undef near
+#endif
+QT_BEGIN_NAMESPACE
+
+class QProximitySensor;
+
+class Q_SENSORSQUICK_EXPORT QmlProximitySensor : public QmlSensor
+{
+ Q_OBJECT
+ QML_NAMED_ELEMENT(ProximitySensor)
+ QML_ADDED_IN_VERSION(5,0)
+public:
+ explicit QmlProximitySensor(QObject *parent = 0);
+ ~QmlProximitySensor();
+
+ QSensor *sensor() const override;
+
+private:
+ QProximitySensor *m_sensor;
+ QmlSensorReading *createReading() const override;
+};
+
+class Q_SENSORSQUICK_EXPORT QmlProximitySensorReading : public QmlSensorReading
+{
+ Q_OBJECT
+ Q_PROPERTY(bool near READ near NOTIFY nearChanged BINDABLE bindableNear)
+ QML_NAMED_ELEMENT(ProximityReading)
+ QML_UNCREATABLE("Cannot create ProximityReading")
+ QML_ADDED_IN_VERSION(5,0)
+public:
+ explicit QmlProximitySensorReading(QProximitySensor *sensor);
+ ~QmlProximitySensorReading();
+
+ bool near() const;
+ QBindable<bool> bindableNear() const;
+
+Q_SIGNALS:
+ void nearChanged();
+
+private:
+ QSensorReading *reading() const override;
+ void readingUpdate() override;
+ QProximitySensor *m_sensor;
+ Q_OBJECT_BINDABLE_PROPERTY(QmlProximitySensorReading, bool,
+ m_near, &QmlProximitySensorReading::nearChanged)
+};
+
+QT_END_NAMESPACE
+#endif
diff --git a/src/imports/sensors/qmlrotationsensor.cpp b/src/sensorsquick/qmlrotationsensor.cpp
index ffa47fd9..d21b062f 100644
--- a/src/imports/sensors/qmlrotationsensor.cpp
+++ b/src/sensorsquick/qmlrotationsensor.cpp
@@ -1,48 +1,12 @@
-/****************************************************************************
-**
-** 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 "qmlrotationsensor.h"
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qmlrotationsensor_p.h"
#include <QtSensors/QRotationSensor>
/*!
\qmltype RotationSensor
- \instantiates QmlRotationSensor
+//! \instantiates QmlRotationSensor
\ingroup qml-sensors_type
\inqmlmodule QtSensors
\since QtSensors 5.0
@@ -81,7 +45,7 @@ QSensor *QmlRotationSensor::sensor() const
}
/*!
- \qmlproperty qreal RotationSensor::hasZ
+ \qmlproperty bool RotationSensor::hasZ
This property holds a value indicating if the z angle is available.
Please see QRotationSensor::hasZ for information about this property.
@@ -92,13 +56,9 @@ bool QmlRotationSensor::hasZ() const
return m_sensor->hasZ();
}
-void QmlRotationSensor::_update()
-{
-}
-
/*!
\qmltype RotationReading
- \instantiates QmlRotationSensorReading
+//! \instantiates QmlRotationSensorReading
\ingroup qml-sensors_reading
\inqmlmodule QtSensors
\since QtSensors 5.0
@@ -114,8 +74,7 @@ void QmlRotationSensor::_update()
*/
QmlRotationSensorReading::QmlRotationSensorReading(QRotationSensor *sensor)
- : QmlSensorReading(sensor)
- , m_sensor(sensor)
+ : m_sensor(sensor)
{
}
@@ -135,6 +94,11 @@ qreal QmlRotationSensorReading::x() const
return m_x;
}
+QBindable<qreal> QmlRotationSensorReading::bindableX() const
+{
+ return &m_x;
+}
+
/*!
\qmlproperty qreal RotationReading::y
This property holds the rotation around the y axis.
@@ -147,6 +111,11 @@ qreal QmlRotationSensorReading::y() const
return m_y;
}
+QBindable<qreal> QmlRotationSensorReading::bindableY() const
+{
+ return &m_y;
+}
+
/*!
\qmlproperty qreal RotationReading::z
This property holds the rotation around the z axis.
@@ -159,6 +128,11 @@ qreal QmlRotationSensorReading::z() const
return m_z;
}
+QBindable<qreal> QmlRotationSensorReading::bindableZ() const
+{
+ return &m_z;
+}
+
QSensorReading *QmlRotationSensorReading::reading() const
{
return m_sensor->reading();
@@ -166,19 +140,7 @@ QSensorReading *QmlRotationSensorReading::reading() const
void QmlRotationSensorReading::readingUpdate()
{
- qreal rX = m_sensor->reading()->x();
- if (m_x != rX) {
- m_x = rX;
- Q_EMIT xChanged();
- }
- qreal rY = m_sensor->reading()->y();
- if (m_y != rY) {
- m_y = rY;
- Q_EMIT yChanged();
- }
- qreal rZ = m_sensor->reading()->z();
- if (m_z != rZ) {
- m_z = rZ;
- Q_EMIT zChanged();
- }
+ m_x = m_sensor->reading()->x();
+ m_y = m_sensor->reading()->y();
+ m_z = m_sensor->reading()->z();
}
diff --git a/src/sensorsquick/qmlrotationsensor_p.h b/src/sensorsquick/qmlrotationsensor_p.h
new file mode 100644
index 00000000..1ef008b8
--- /dev/null
+++ b/src/sensorsquick/qmlrotationsensor_p.h
@@ -0,0 +1,83 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QMLROTATIONSENSOR_P_H
+#define QMLROTATIONSENSOR_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 "qmlsensor_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QRotationSensor;
+
+class Q_SENSORSQUICK_EXPORT QmlRotationSensor : public QmlSensor
+{
+ Q_OBJECT
+ Q_PROPERTY(bool hasZ READ hasZ NOTIFY hasZChanged)
+ QML_NAMED_ELEMENT(RotationSensor)
+ QML_ADDED_IN_VERSION(5,0)
+public:
+ explicit QmlRotationSensor(QObject *parent = 0);
+ ~QmlRotationSensor();
+
+ bool hasZ() const;
+ QSensor *sensor() const override;
+
+Q_SIGNALS:
+ void hasZChanged(bool hasZ);
+
+private:
+ QRotationSensor *m_sensor;
+ QmlSensorReading *createReading() const override;
+};
+
+class Q_SENSORSQUICK_EXPORT QmlRotationSensorReading : public QmlSensorReading
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal x READ x NOTIFY xChanged BINDABLE bindableX)
+ Q_PROPERTY(qreal y READ y NOTIFY yChanged BINDABLE bindableY)
+ Q_PROPERTY(qreal z READ z NOTIFY zChanged BINDABLE bindableZ)
+ QML_NAMED_ELEMENT(RotationReading)
+ QML_UNCREATABLE("Cannot create RotationReading")
+ QML_ADDED_IN_VERSION(5,0)
+public:
+ explicit QmlRotationSensorReading(QRotationSensor *sensor);
+ ~QmlRotationSensorReading();
+
+ qreal x() const;
+ QBindable<qreal> bindableX() const;
+ qreal y() const;
+ QBindable<qreal> bindableY() const;
+ qreal z() const;
+ QBindable<qreal> bindableZ() const;
+
+Q_SIGNALS:
+ void xChanged();
+ void yChanged();
+ void zChanged();
+
+private:
+ QSensorReading *reading() const override;
+ void readingUpdate() override;
+ QRotationSensor *m_sensor;
+ Q_OBJECT_BINDABLE_PROPERTY(QmlRotationSensorReading, qreal,
+ m_x, &QmlRotationSensorReading::xChanged)
+ Q_OBJECT_BINDABLE_PROPERTY(QmlRotationSensorReading, qreal,
+ m_y, &QmlRotationSensorReading::yChanged)
+ Q_OBJECT_BINDABLE_PROPERTY(QmlRotationSensorReading, qreal,
+ m_z, &QmlRotationSensorReading::zChanged)
+};
+
+QT_END_NAMESPACE
+#endif
diff --git a/src/imports/sensors/qmlsensor.cpp b/src/sensorsquick/qmlsensor.cpp
index 752cdb18..d507e919 100644
--- a/src/imports/sensors/qmlsensor.cpp
+++ b/src/sensorsquick/qmlsensor.cpp
@@ -1,43 +1,7 @@
-/****************************************************************************
-**
-** 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 "qmlsensor.h"
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qmlsensor_p.h"
#include <QtSensors/QSensor>
#include <QDebug>
#include <QtCore/private/qobject_p.h>
@@ -54,13 +18,13 @@ public:
};
template<typename Item>
-int readonlyListCount(QQmlListProperty<Item> *p)
+qsizetype readonlyListCount(QQmlListProperty<Item> *p)
{
- return static_cast<const QList<Item *> *>(p->data)->count();
+ return static_cast<const QList<Item *> *>(p->data)->size();
}
template<typename Item>
-Item *readonlyListAt(QQmlListProperty<Item> *p, int idx)
+Item *readonlyListAt(QQmlListProperty<Item> *p, qsizetype idx)
{
return static_cast<const QList<Item *> *>(p->data)->at(idx);
};
@@ -75,7 +39,7 @@ QQmlListProperty<Item> readonlyListProperty(const QObject *o, const QList<Item *
/*!
\qmltype Sensor
- \instantiates QmlSensor
+//! \instantiates QmlSensor
\inqmlmodule QtSensors
\since QtSensors 5.0
\brief The Sensor element serves as a base type for sensors.
@@ -90,9 +54,6 @@ QQmlListProperty<Item> readonlyListProperty(const QObject *o, const QList<Item *
QmlSensor::QmlSensor(QObject *parent)
: QObject(*(new QmlSensorPrivate), parent)
- , m_parsed(false)
- , m_active(false)
- , m_reading(0)
{
}
@@ -107,16 +68,14 @@ QmlSensor::~QmlSensor()
Please see QSensor::identifier for information about this property.
*/
-QString QmlSensor::identifier() const
+QByteArray QmlSensor::identifier() const
{
- return m_identifier;
+ return sensor()->identifier();
}
-void QmlSensor::setIdentifier(const QString &identifier)
+void QmlSensor::setIdentifier(const QByteArray &identifier)
{
- if (m_parsed) return;
- m_identifier = identifier;
- Q_EMIT identifierChanged();
+ sensor()->setIdentifier(identifier);
}
/*!
@@ -124,9 +83,9 @@ void QmlSensor::setIdentifier(const QString &identifier)
This property holds the type of the sensor.
*/
-QString QmlSensor::type() const
+QByteArray QmlSensor::type() const
{
- return QString::fromLatin1(sensor()->type());
+ return sensor()->type();
}
/*!
@@ -162,23 +121,19 @@ bool QmlSensor::isBusy() const
void QmlSensor::setActive(bool active)
{
- m_active = active;
- if (!m_parsed) return; // delay (it'll get called again later)!
- bool wasActive = sensor()->isActive();
- if (wasActive == active) return;
- if (active) {
+ if (!m_componentComplete) {
+ m_activateOnComplete = active;
+ return;
+ }
+ if (active)
sensor()->start();
- m_active = sensor()->isActive();
- } else {
+ else
sensor()->stop();
- }
- if (m_active != wasActive)
- emit activeChanged();
}
bool QmlSensor::isActive() const
{
- return m_active;
+ return sensor()->isActive();
}
/*!
@@ -316,6 +271,26 @@ QmlSensorReading *QmlSensor::reading() const
return m_reading;
}
+QBindable<QmlSensorReading*> QmlSensor::bindableReading() const
+{
+ return &m_reading;
+}
+
+/*!
+ \qmlmethod bool Sensor::isFeatureSupported(feature)
+ \since QtSensors 6.7
+ Checks if a specific feature is supported by the backend.
+ Returns \c true if the \a feature is supported, and \c false otherwise.
+ For feature descriptions see \l {QSensor::Feature}.
+
+ Please see QSensor::isFeatureSupported for information.
+*/
+
+bool QmlSensor::isFeatureSupported(Feature feature) const
+{
+ return sensor()->isFeatureSupported(static_cast<QSensor::Feature>(feature));
+}
+
/*!
\qmlproperty Sensor::AxesOrientationMode Sensor::axesOrientationMode
\since QtSensors 5.1
@@ -419,8 +394,7 @@ void QmlSensor::setBufferSize(int bufferSize)
bool QmlSensor::start()
{
- setActive(true);
- return isActive();
+ return sensor()->start();
}
/*!
@@ -442,7 +416,7 @@ void QmlSensor::classBegin()
void QmlSensor::componentComplete()
{
- m_parsed = true;
+ m_componentComplete = true;
connect(sensor(), SIGNAL(sensorError(int)), this, SIGNAL(errorChanged()));
connect(sensor(), SIGNAL(activeChanged()), this, SIGNAL(activeChanged()));
@@ -455,26 +429,18 @@ void QmlSensor::componentComplete()
connect(sensor(), SIGNAL(bufferSizeChanged(int)), this, SIGNAL(bufferSizeChanged(int)));
connect(sensor(), SIGNAL(maxBufferSizeChanged(int)), this, SIGNAL(maxBufferSizeChanged(int)));
connect(sensor(), SIGNAL(efficientBufferSizeChanged(int)), this, SIGNAL(efficientBufferSizeChanged(int)));
-
- // We need to set this on the sensor object now
- sensor()->setIdentifier(m_identifier.toLocal8Bit());
+ connect(sensor(), &QSensor::busyChanged, this, &QmlSensor::busyChanged);
+ connect(sensor(), &QSensor::identifierChanged, this, &QmlSensor::identifierChanged);
// These can change!
- QByteArray oldIdentifier = sensor()->identifier();
int oldDataRate = dataRate();
int oldOutputRange = outputRange();
- bool ok = sensor()->connectToBackend();
- if (ok) {
+ if (sensor()->connectToBackend())
Q_EMIT connectedToBackendChanged();
- m_reading = createReading();
- m_reading->setParent(this);
- }
- if (oldIdentifier != sensor()->identifier()) {
- m_identifier = QString::fromLatin1(sensor()->identifier());
- Q_EMIT identifierChanged();
- }
+ m_reading.setValueBypassingBindings(createReading());
+ m_reading->setParent(this);
if (oldDataRate != dataRate())
Q_EMIT dataRateChanged();
if (oldOutputRange != outputRange())
@@ -502,35 +468,28 @@ void QmlSensor::componentComplete()
// meta-data should become non-empty
if (!description().isEmpty())
Q_EMIT descriptionChanged();
- if (available.count())
+ if (available.size())
Q_EMIT availableDataRatesChanged();
- if (output.count())
+ if (output.size())
Q_EMIT outputRangesChanged();
- _update();
-
connect(sensor(), SIGNAL(readingChanged()), this, SLOT(updateReading()));
- if (m_active) {
- m_active = false;
+ if (m_activateOnComplete)
start();
- }
-}
-
-void QmlSensor::_update()
-{
}
void QmlSensor::updateReading()
{
if (m_reading) {
m_reading->update();
+ m_reading.notify();
Q_EMIT readingChanged();
}
}
/*!
\qmltype SensorReading
- \instantiates QmlSensorReading
+//! \instantiates QmlSensorReading
\inqmlmodule QtSensors
\since QtSensors 5.0
\brief The SensorReading element serves as a base type for sensor readings.
@@ -543,15 +502,6 @@ void QmlSensor::updateReading()
This element cannot be directly created.
*/
-QmlSensorReading::QmlSensorReading(QSensor *)
- : QObject(0)
-{
-}
-
-QmlSensorReading::~QmlSensorReading()
-{
-}
-
/*!
\qmlproperty quint64 SensorReading::timestamp
A timestamp for the reading.
@@ -564,13 +514,15 @@ quint64 QmlSensorReading::timestamp() const
return m_timestamp;
}
+QBindable<quint64> QmlSensorReading::bindableTimestamp() const
+{
+ return &m_timestamp;
+}
+
+
void QmlSensorReading::update()
{
- quint64 ts = reading()->timestamp();
- if (m_timestamp != ts) {
- m_timestamp = ts;
- Q_EMIT timestampChanged();
- }
+ m_timestamp = reading()->timestamp();
readingUpdate();
}
diff --git a/src/imports/sensors/qmlsensor.h b/src/sensorsquick/qmlsensor_p.h
index 3ac82699..d08d797f 100644
--- a/src/imports/sensors/qmlsensor.h
+++ b/src/sensorsquick/qmlsensor_p.h
@@ -1,49 +1,30 @@
-/****************************************************************************
-**
-** 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 QMLSENSOR_H
-#define QMLSENSOR_H
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QMLSENSOR_P_H
+#define QMLSENSOR_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 "qsensorsquickglobal_p.h"
#include <QObject>
+#include <QProperty>
#include <QQmlParserStatus>
+#include <QtQml/qqml.h>
#include <QQmlListProperty>
-#include "qmlsensorrange.h"
+#include <QtSensors/QSensor>
+
+#include "qmlsensorrange_p.h"
QT_BEGIN_NAMESPACE
@@ -53,19 +34,18 @@ class QSensorReading;
class QmlSensorReading;
class QmlSensorPrivate;
-class QmlSensor : public QObject, public QQmlParserStatus
+class Q_SENSORSQUICK_EXPORT QmlSensor : public QObject, public QQmlParserStatus
{
Q_OBJECT
Q_DECLARE_PRIVATE(QmlSensor)
- Q_ENUMS(AxesOrientationMode)
Q_INTERFACES(QQmlParserStatus)
- Q_PROPERTY(QString identifier READ identifier WRITE setIdentifier NOTIFY identifierChanged)
- Q_PROPERTY(QString type READ type NOTIFY typeChanged)
+ Q_PROPERTY(QByteArray identifier READ identifier WRITE setIdentifier NOTIFY identifierChanged)
+ Q_PROPERTY(QByteArray type READ type CONSTANT)
Q_PROPERTY(bool connectedToBackend READ isConnectedToBackend NOTIFY connectedToBackendChanged)
Q_PROPERTY(QQmlListProperty<QmlSensorRange> availableDataRates READ availableDataRates NOTIFY availableDataRatesChanged)
Q_PROPERTY(int dataRate READ dataRate WRITE setDataRate NOTIFY dataRateChanged)
- Q_PROPERTY(QmlSensorReading* reading READ reading NOTIFY readingChanged)
- Q_PROPERTY(bool busy READ isBusy)
+ Q_PROPERTY(QmlSensorReading* reading READ reading NOTIFY readingChanged BINDABLE bindableReading)
+ Q_PROPERTY(bool busy READ isBusy NOTIFY busyChanged)
Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged)
Q_PROPERTY(QQmlListProperty<QmlSensorOutputRange> outputRanges READ outputRanges NOTIFY outputRangesChanged)
Q_PROPERTY(int outputRange READ outputRange WRITE setOutputRange NOTIFY outputRangeChanged)
@@ -80,21 +60,38 @@ class QmlSensor : public QObject, public QQmlParserStatus
Q_PROPERTY(int efficientBufferSize READ efficientBufferSize NOTIFY efficientBufferSizeChanged REVISION 1)
Q_PROPERTY(int bufferSize READ bufferSize WRITE setBufferSize NOTIFY bufferSizeChanged REVISION 1)
+ QML_NAMED_ELEMENT(Sensor)
+ QML_UNCREATABLE("Cannot create Sensor")
+ QML_ADDED_IN_VERSION(5,0)
public:
+ // Keep in sync with QSensor::Feature
+ enum Feature : int {
+ Buffering = QSensor::Buffering,
+ AlwaysOn = QSensor::AlwaysOn,
+ GeoValues = QSensor::GeoValues,
+ FieldOfView = QSensor::FieldOfView,
+ AccelerationMode = QSensor::AccelerationMode,
+ SkipDuplicates = QSensor::SkipDuplicates,
+ AxesOrientation = QSensor::AxesOrientation,
+ PressureSensorTemperature = QSensor::PressureSensorTemperature
+ };
+ Q_ENUM(Feature)
+
// Keep in sync with QSensor::AxesOrientationMode
enum AxesOrientationMode {
FixedOrientation,
AutomaticOrientation,
UserOrientation
};
+ Q_ENUM(AxesOrientationMode)
explicit QmlSensor(QObject *parent = 0);
~QmlSensor();
- QString identifier() const;
- void setIdentifier(const QString &identifier);
+ QByteArray identifier() const;
+ void setIdentifier(const QByteArray &identifier);
- QString type() const;
+ QByteArray type() const;
bool isConnectedToBackend() const;
@@ -121,6 +118,9 @@ public:
int error() const;
QmlSensorReading *reading() const;
+ QBindable<QmlSensorReading*> bindableReading() const;
+
+ Q_INVOKABLE Q_REVISION(6, 7) bool isFeatureSupported(Feature feature) const;
AxesOrientationMode axesOrientationMode() const;
void setAxesOrientationMode(AxesOrientationMode axesOrientationMode);
@@ -137,13 +137,16 @@ public:
int bufferSize() const;
void setBufferSize(int bufferSize);
+ virtual QSensor *sensor() const = 0;
+
+ void componentComplete() override;
+
public Q_SLOTS:
bool start();
void stop();
Q_SIGNALS:
void identifierChanged();
- void typeChanged();
void connectedToBackendChanged();
void availableDataRatesChanged();
void dataRateChanged();
@@ -154,6 +157,7 @@ Q_SIGNALS:
void descriptionChanged();
void errorChanged();
void alwaysOnChanged();
+ void busyChanged();
Q_REVISION(1) void skipDuplicatesChanged(bool skipDuplicates);
Q_REVISION(1) void axesOrientationModeChanged(AxesOrientationMode axesOrientationMode);
Q_REVISION(1) void currentOrientationChanged(int currentOrientation);
@@ -163,33 +167,33 @@ Q_SIGNALS:
Q_REVISION(1) void bufferSizeChanged(int bufferSize);
protected:
- virtual QSensor *sensor() const = 0;
virtual QmlSensorReading *createReading() const = 0;
private Q_SLOTS:
void updateReading();
-protected Q_SLOTS:
- void componentComplete() override;
-
private:
void classBegin() override;
- virtual void _update();
- bool m_parsed;
- bool m_active;
- QString m_identifier;
- QmlSensorReading *m_reading;
+ bool m_componentComplete = false;
+ bool m_activateOnComplete = false;
+ Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS(QmlSensor, QmlSensorReading*,
+ m_reading, nullptr)
};
-class QmlSensorReading : public QObject
+class Q_SENSORSQUICK_EXPORT QmlSensorReading : public QObject
{
Q_OBJECT
- Q_PROPERTY(quint64 timestamp READ timestamp NOTIFY timestampChanged)
+ Q_PROPERTY(quint64 timestamp READ timestamp NOTIFY timestampChanged BINDABLE bindableTimestamp)
+ QML_NAMED_ELEMENT(SensorReading)
+ QML_UNCREATABLE("Cannot create SensorReading")
+ QML_ADDED_IN_VERSION(5,0)
public:
- explicit QmlSensorReading(QSensor *sensor);
- ~QmlSensorReading();
+ explicit QmlSensorReading() = default;
+ ~QmlSensorReading() = default;
quint64 timestamp() const;
+ QBindable<quint64> bindableTimestamp() const;
+
void update();
Q_SIGNALS:
@@ -198,7 +202,8 @@ Q_SIGNALS:
private:
virtual QSensorReading *reading() const = 0;
virtual void readingUpdate() = 0;
- quint64 m_timestamp;
+ Q_OBJECT_BINDABLE_PROPERTY(QmlSensorReading, quint64,
+ m_timestamp, &QmlSensorReading::timestampChanged)
};
QT_END_NAMESPACE
diff --git a/src/sensorsquick/qmlsensorglobal.cpp b/src/sensorsquick/qmlsensorglobal.cpp
new file mode 100644
index 00000000..73f865c4
--- /dev/null
+++ b/src/sensorsquick/qmlsensorglobal.cpp
@@ -0,0 +1,86 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qmlsensorglobal_p.h"
+#include <QtSensors/QSensor>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype QmlSensors
+//! \instantiates QmlSensorGlobal
+ \inqmlmodule QtSensors
+ \since QtSensors 5.0
+ \brief The QmlSensors singleton provides the module API.
+
+ The QmlSensors singleton provides the module API.
+
+ This element cannot be directly created, but its functionality
+ can be accessed as a QML singleton as illustrated below:
+
+ \code
+ import QtSensors
+ import QtSensors as Sensors
+ ...
+ Component.onCompleted: {
+ var types = Sensors.QmlSensors.sensorTypes();
+ console.log(types.join(", "));
+ }
+ \endcode
+*/
+
+QmlSensorGlobal::QmlSensorGlobal(QObject *parent)
+ : QObject(parent)
+ , m_sensor(new QSensor(QByteArray(), this))
+{
+ connect(m_sensor, SIGNAL(availableSensorsChanged()), this, SIGNAL(availableSensorsChanged()));
+}
+
+QmlSensorGlobal::~QmlSensorGlobal()
+{
+}
+
+/*!
+ \qmlmethod list<string> QmlSensors::sensorTypes()
+ Returns a list of the sensor types that have been registered.
+
+ Please see QSensor::sensorTypes() for information.
+*/
+QStringList QmlSensorGlobal::sensorTypes() const
+{
+ QStringList ret;
+ const QList<QByteArray> sensorTypes = QSensor::sensorTypes();
+ ret.reserve(sensorTypes.size());
+ for (const QByteArray &type : sensorTypes)
+ ret << QString::fromLocal8Bit(type);
+ return ret;
+}
+
+/*!
+ \qmlmethod list<string> QmlSensors::sensorsForType(type)
+ Returns a list of the sensor identifiers that have been registered for \a type.
+
+ Please see QSensor::sensorsForType() for information.
+*/
+QStringList QmlSensorGlobal::sensorsForType(const QString &type) const
+{
+ QStringList ret;
+ const QList<QByteArray> sensors = QSensor::sensorsForType(type.toLocal8Bit());
+ ret.reserve(sensors.size());
+ for (const QByteArray &identifier : sensors)
+ ret << QString::fromLocal8Bit(identifier);
+ return ret;
+}
+
+/*!
+ \qmlmethod string QmlSensors::defaultSensorForType(type)
+ Returns the default sensor identifier that has been registered for \a type.
+
+ Please see QSensor::defaultSensorForType() for information.
+*/
+QString QmlSensorGlobal::defaultSensorForType(const QString &type) const
+{
+ return QString::fromLocal8Bit(QSensor::defaultSensorForType(type.toLocal8Bit()));
+}
+
+QT_END_NAMESPACE
diff --git a/src/sensorsquick/qmlsensorglobal_p.h b/src/sensorsquick/qmlsensorglobal_p.h
new file mode 100644
index 00000000..8b5214a2
--- /dev/null
+++ b/src/sensorsquick/qmlsensorglobal_p.h
@@ -0,0 +1,50 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QMLSENSORGLOBAL_P_H
+#define QMLSENSORGLOBAL_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 "qsensorsquickglobal_p.h"
+#include <QtQml/qqml.h>
+#include <QObject>
+#include <QStringList>
+
+QT_BEGIN_NAMESPACE
+
+class QSensor;
+
+class Q_SENSORSQUICK_EXPORT QmlSensorGlobal : public QObject
+{
+ Q_OBJECT
+public:
+ explicit QmlSensorGlobal(QObject *parent = 0);
+ ~QmlSensorGlobal();
+
+ Q_INVOKABLE QStringList sensorTypes() const;
+ Q_INVOKABLE QStringList sensorsForType(const QString &type) const;
+ Q_INVOKABLE QString defaultSensorForType(const QString &type) const;
+ QML_NAMED_ELEMENT(QmlSensors)
+ QML_SINGLETON
+ QML_ADDED_IN_VERSION(5,0)
+
+Q_SIGNALS:
+ void availableSensorsChanged();
+
+private:
+ QSensor *m_sensor;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/sensorsquick/qmlsensorrange.cpp b/src/sensorsquick/qmlsensorrange.cpp
new file mode 100644
index 00000000..2a1d4ae9
--- /dev/null
+++ b/src/sensorsquick/qmlsensorrange.cpp
@@ -0,0 +1,52 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qmlsensorrange_p.h"
+
+QmlSensorRange::QmlSensorRange(QObject *parent)
+ : QObject(parent),
+ min(0),
+ max(0)
+{
+}
+
+QmlSensorRange::~QmlSensorRange()
+{
+}
+
+int QmlSensorRange::minimum() const
+{
+ return min;
+}
+
+int QmlSensorRange::maximum() const
+{
+ return max;
+}
+
+QmlSensorOutputRange::QmlSensorOutputRange(QObject *parent)
+ : QObject(parent),
+ min(0),
+ max(0),
+ acc(0)
+{
+}
+
+QmlSensorOutputRange::~QmlSensorOutputRange()
+{
+}
+
+qreal QmlSensorOutputRange::minimum() const
+{
+ return min;
+}
+
+qreal QmlSensorOutputRange::maximum() const
+{
+ return max;
+}
+
+qreal QmlSensorOutputRange::accuracy() const
+{
+ return acc;
+}
diff --git a/src/sensorsquick/qmlsensorrange_p.h b/src/sensorsquick/qmlsensorrange_p.h
new file mode 100644
index 00000000..324c24db
--- /dev/null
+++ b/src/sensorsquick/qmlsensorrange_p.h
@@ -0,0 +1,77 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QMLSENSORRANGE_P_H
+#define QMLSENSORRANGE_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 <QtQml/qqml.h>
+#include <QObject>
+#include "qsensorsquickglobal_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class Q_SENSORSQUICK_EXPORT QmlSensorRange : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int minimum READ minimum)
+ Q_PROPERTY(int maximum READ maximum)
+ QML_NAMED_ELEMENT(Range)
+ QML_UNCREATABLE("Cannot create Range")
+ QML_ADDED_IN_VERSION(5,0)
+public:
+ explicit QmlSensorRange(QObject *parent = 0);
+ ~QmlSensorRange();
+
+ int minimum() const;
+ void setMinumum(int mini) { min = mini; }
+
+ int maximum() const;
+ void setMaximum(int maxi) { max = maxi; }
+
+private:
+
+ int min;
+ int max;
+};
+
+class Q_SENSORSQUICK_EXPORT QmlSensorOutputRange : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal minimum READ minimum)
+ Q_PROPERTY(qreal maximum READ maximum)
+ Q_PROPERTY(qreal accuracy READ accuracy)
+ QML_NAMED_ELEMENT(OutputRange)
+ QML_UNCREATABLE("Cannot create OutputRange")
+ QML_ADDED_IN_VERSION(5,0)
+public:
+ explicit QmlSensorOutputRange(QObject *parent = 0);
+ ~QmlSensorOutputRange();
+
+ qreal minimum() const;
+ void setMinimum(int mini) { min = mini; }
+
+ qreal maximum() const;
+ void setMaximum(int maxi) { max = maxi; }
+
+ qreal accuracy() const;
+ void setAccuracy(int accu) { acc = accu; }
+
+private:
+ qreal min;
+ qreal max;
+ qreal acc;
+};
+
+QT_END_NAMESPACE
+#endif
diff --git a/src/imports/sensors/qmltapsensor.cpp b/src/sensorsquick/qmltapsensor.cpp
index 76f34c2e..2fa75f00 100644
--- a/src/imports/sensors/qmltapsensor.cpp
+++ b/src/sensorsquick/qmltapsensor.cpp
@@ -1,54 +1,19 @@
-/****************************************************************************
-**
-** 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 "qmltapsensor.h"
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qmltapsensor_p.h"
#include <QtSensors/QTapSensor>
/*!
\qmltype TapSensor
- \instantiates QmlTapSensor
+//! \instantiates QmlTapSensor
\ingroup qml-sensors_type
\inqmlmodule QtSensors
\since QtSensors 5.0
\inherits Sensor
\brief The TapSensor element reports tap and double tap events
along the X, Y and Z axes.
+ \internal
The TapSensor element reports tap and double tap events
along the X, Y and Z axes.
@@ -100,12 +65,13 @@ void QmlTapSensor::setReturnDoubleTapEvents(bool ret)
/*!
\qmltype TapReading
- \instantiates QmlTapSensorReading
+//! \instantiates QmlTapSensorReading
\ingroup qml-sensors_reading
\inqmlmodule QtSensors
\since QtSensors 5.0
\inherits SensorReading
\brief The TapReading element holds the most recent TapSensor reading.
+ \internal
The TapReading element holds the most recent TapSensor reading.
@@ -116,8 +82,7 @@ void QmlTapSensor::setReturnDoubleTapEvents(bool ret)
*/
QmlTapSensorReading::QmlTapSensorReading(QTapSensor *sensor)
- : QmlSensorReading(sensor)
- , m_sensor(sensor)
+ : m_sensor(sensor)
{
}
@@ -147,6 +112,12 @@ QTapReading::TapDirection QmlTapSensorReading::tapDirection() const
return m_tapDirection;
}
+QBindable<QTapReading::TapDirection> QmlTapSensorReading::bindableTapDirection() const
+{
+ return &m_tapDirection;
+}
+
+
/*!
\qmlproperty bool TapReading::doubleTap
This property holds a value indicating if there was a single or double tap.
@@ -159,6 +130,11 @@ bool QmlTapSensorReading::isDoubleTap() const
return m_isDoubleTap;
}
+QBindable<bool> QmlTapSensorReading::bindableDoubleTap() const
+{
+ return &m_isDoubleTap;
+}
+
QSensorReading *QmlTapSensorReading::reading() const
{
return const_cast<QTapSensor*>(m_sensor)->reading();
@@ -166,14 +142,6 @@ QSensorReading *QmlTapSensorReading::reading() const
void QmlTapSensorReading::readingUpdate()
{
- QTapReading::TapDirection td = m_sensor->reading()->tapDirection();
- if (m_tapDirection != td) {
- m_tapDirection = td;
- Q_EMIT tapDirectionChanged();
- }
- bool dTap = m_sensor->reading()->isDoubleTap();
- if (m_isDoubleTap != dTap) {
- m_isDoubleTap = dTap;
- Q_EMIT isDoubleTapChanged();
- }
+ m_tapDirection = m_sensor->reading()->tapDirection();
+ m_isDoubleTap = m_sensor->reading()->isDoubleTap();
}
diff --git a/src/sensorsquick/qmltapsensor_p.h b/src/sensorsquick/qmltapsensor_p.h
new file mode 100644
index 00000000..7537c5db
--- /dev/null
+++ b/src/sensorsquick/qmltapsensor_p.h
@@ -0,0 +1,83 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QMLTAPSENSOR_P_H
+#define QMLTAPSENSOR_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 "qmlsensor_p.h"
+#include <QtSensors/QTapSensor>
+
+QT_BEGIN_NAMESPACE
+
+class QTapSensor;
+
+class Q_SENSORSQUICK_EXPORT QmlTapSensor : public QmlSensor
+{
+ Q_OBJECT
+ Q_PROPERTY(bool returnDoubleTapEvents READ returnDoubleTapEvents WRITE setReturnDoubleTapEvents NOTIFY returnDoubleTapEventsChanged)
+ QML_NAMED_ELEMENT(TapSensor)
+ QML_ADDED_IN_VERSION(5,0)
+public:
+ explicit QmlTapSensor(QObject *parent = 0);
+ ~QmlTapSensor();
+
+ bool returnDoubleTapEvents() const;
+ void setReturnDoubleTapEvents(bool ret);
+
+ QSensor *sensor() const override;
+
+Q_SIGNALS:
+ void returnDoubleTapEventsChanged(bool returnDoubleTapEvents);
+
+private:
+ QTapSensor *m_sensor;
+ QmlSensorReading *createReading() const override;
+};
+
+class Q_SENSORSQUICK_EXPORT QmlTapSensorReading : public QmlSensorReading
+{
+ Q_OBJECT
+ Q_PROPERTY(QTapReading::TapDirection tapDirection READ tapDirection
+ NOTIFY tapDirectionChanged BINDABLE bindableTapDirection)
+ Q_PROPERTY(bool doubleTap READ isDoubleTap
+ NOTIFY isDoubleTapChanged BINDABLE bindableDoubleTap)
+ QML_NAMED_ELEMENT(TapReading)
+ QML_UNCREATABLE("Cannot create TapReading")
+ QML_ADDED_IN_VERSION(5,0)
+public:
+
+ explicit QmlTapSensorReading(QTapSensor *sensor);
+ ~QmlTapSensorReading();
+
+ QTapReading::TapDirection tapDirection() const;
+ QBindable<QTapReading::TapDirection> bindableTapDirection() const;
+ bool isDoubleTap() const;
+ QBindable<bool> bindableDoubleTap() const;
+
+Q_SIGNALS:
+ void tapDirectionChanged();
+ void isDoubleTapChanged();
+
+private:
+ QSensorReading *reading() const override;
+ void readingUpdate() override;
+ QTapSensor *m_sensor;
+ Q_OBJECT_BINDABLE_PROPERTY(QmlTapSensorReading, QTapReading::TapDirection,
+ m_tapDirection, &QmlTapSensorReading::tapDirectionChanged)
+ Q_OBJECT_BINDABLE_PROPERTY(QmlTapSensorReading, bool,
+ m_isDoubleTap, &QmlTapSensorReading::isDoubleTapChanged)
+};
+
+QT_END_NAMESPACE
+#endif
diff --git a/src/sensorsquick/qmltiltsensor.cpp b/src/sensorsquick/qmltiltsensor.cpp
new file mode 100644
index 00000000..9f8e0335
--- /dev/null
+++ b/src/sensorsquick/qmltiltsensor.cpp
@@ -0,0 +1,128 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qmltiltsensor_p.h"
+#include <QtSensors/qtiltsensor.h>
+
+QT_BEGIN_NAMESPACE
+QT_END_NAMESPACE
+
+/*!
+ \qmltype TiltSensor
+//! \instantiates QmlTiltSensor
+ \ingroup qml-sensors_type
+ \inqmlmodule QtSensors
+ \since QtSensors 5.0
+ \inherits Sensor
+ \brief The TiltSensor element reports tilt events
+ along the X and Y axes.
+
+ The TiltSensor element reports tilt events along the X and Y axes.
+
+ This element wraps the QTiltSensor class. Please see the documentation for
+ QTiltSensor for details.
+
+ \sa TiltReading
+*/
+
+QmlTiltSensor::QmlTiltSensor(QObject *parent)
+ : QmlSensor(parent)
+ , m_sensor(new QTiltSensor(this))
+{
+}
+
+QmlTiltSensor::~QmlTiltSensor()
+{
+}
+
+QmlSensorReading *QmlTiltSensor::createReading() const
+{
+ return new QmlTiltSensorReading(m_sensor);
+}
+
+QSensor *QmlTiltSensor::sensor() const
+{
+ return m_sensor;
+}
+
+/*!
+ \qmlmethod TiltSensor::calibrate()
+ Calibrate the tilt sensor.
+
+ Please see QTiltSensor::calibrate() for information about this property.
+*/
+void QmlTiltSensor::calibrate()
+{
+ m_sensor->calibrate();
+}
+
+/*!
+ \qmltype TiltReading
+//! \instantiates QmlTiltSensorReading
+ \ingroup qml-sensors_reading
+ \inqmlmodule QtSensors
+ \since QtSensors 5.0
+ \inherits SensorReading
+ \brief The TiltReading element holds the most recent TiltSensor reading.
+
+ The TiltReading element holds the most recent TiltSensor reading.
+
+ This element wraps the QTiltReading class. Please see the documentation for
+ QTiltReading for details.
+
+ This element cannot be directly created.
+*/
+
+QmlTiltSensorReading::QmlTiltSensorReading(QTiltSensor *sensor)
+ : m_sensor(sensor)
+{
+}
+
+QmlTiltSensorReading::~QmlTiltSensorReading()
+{
+}
+
+/*!
+ \qmlproperty qreal TiltReading::yRotation
+ This property holds the amount of tilt on the Y axis.
+
+ Please see QTiltReading::yRotation for information about this property.
+*/
+
+qreal QmlTiltSensorReading::yRotation() const
+{
+ return m_yRotation;
+}
+
+QBindable<qreal> QmlTiltSensorReading::bindableYRotation() const
+{
+ return &m_yRotation;
+}
+
+/*!
+ \qmlproperty qreal TiltReading::xRotation
+ This property holds the amount of tilt on the X axis.
+
+ Please see QTiltReading::xRotation for information about this property.
+*/
+
+qreal QmlTiltSensorReading::xRotation() const
+{
+ return m_xRotation;
+}
+
+QBindable<qreal> QmlTiltSensorReading::bindableXRotation() const
+{
+ return &m_xRotation;
+}
+
+QSensorReading *QmlTiltSensorReading::reading() const
+{
+ return m_sensor->reading();
+}
+
+void QmlTiltSensorReading::readingUpdate()
+{
+ m_yRotation = m_sensor->reading()->yRotation();
+ m_xRotation = m_sensor->reading()->xRotation();
+}
diff --git a/src/sensorsquick/qmltiltsensor_p.h b/src/sensorsquick/qmltiltsensor_p.h
new file mode 100644
index 00000000..d660229d
--- /dev/null
+++ b/src/sensorsquick/qmltiltsensor_p.h
@@ -0,0 +1,75 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QMLTILTSENSOR_P_H
+#define QMLTILTSENSOR_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 "qmlsensor_p.h"
+#include <QtSensors/QTiltSensor>
+
+QT_BEGIN_NAMESPACE
+
+class QTiltSensor;
+
+class Q_SENSORSQUICK_EXPORT QmlTiltSensor : public QmlSensor
+{
+ Q_OBJECT
+ QML_NAMED_ELEMENT(TiltSensor)
+ QML_ADDED_IN_VERSION(5,0)
+public:
+
+ explicit QmlTiltSensor(QObject *parent = 0);
+ ~QmlTiltSensor();
+ Q_INVOKABLE void calibrate();
+
+ QSensor *sensor() const override;
+
+private:
+ QTiltSensor *m_sensor;
+ QmlSensorReading *createReading() const override;
+};
+
+class Q_SENSORSQUICK_EXPORT QmlTiltSensorReading : public QmlSensorReading
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal yRotation READ yRotation NOTIFY yRotationChanged BINDABLE bindableYRotation)
+ Q_PROPERTY(qreal xRotation READ xRotation NOTIFY xRotationChanged BINDABLE bindableXRotation)
+ QML_NAMED_ELEMENT(TiltReading)
+ QML_UNCREATABLE("Cannot create TiltReading")
+ QML_ADDED_IN_VERSION(5,0)
+public:
+ explicit QmlTiltSensorReading(QTiltSensor *sensor);
+ ~QmlTiltSensorReading();
+
+ qreal yRotation() const;
+ QBindable<qreal> bindableYRotation() const;
+ qreal xRotation() const;
+ QBindable<qreal> bindableXRotation() const;
+
+Q_SIGNALS:
+ void yRotationChanged();
+ void xRotationChanged();
+
+private:
+ QSensorReading *reading() const override;
+ void readingUpdate() override;
+ QTiltSensor *m_sensor;
+ Q_OBJECT_BINDABLE_PROPERTY(QmlTiltSensorReading, qreal,
+ m_yRotation, &QmlTiltSensorReading::yRotationChanged)
+ Q_OBJECT_BINDABLE_PROPERTY(QmlTiltSensorReading, qreal,
+ m_xRotation, &QmlTiltSensorReading::xRotationChanged)
+};
+
+QT_END_NAMESPACE
+#endif
diff --git a/src/sensorsquick/qsensorsquickglobal_p.h b/src/sensorsquick/qsensorsquickglobal_p.h
new file mode 100644
index 00000000..4826ed82
--- /dev/null
+++ b/src/sensorsquick/qsensorsquickglobal_p.h
@@ -0,0 +1,23 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QSENSORSQUICKGLOBALS_P_H
+#define QSENSORSQUICKGLOBALS_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 <QtCore/qglobal.h>
+#include <QtSensorsQuick/qtsensorsquickexports.h>
+
+void Q_SENSORSQUICK_EXPORT qml_register_types_QtSensors();
+
+#endif // QSENSORSQUICKGLOBALS_P_H
diff --git a/src/src.pro b/src/src.pro
deleted file mode 100644
index b3aa7ba0..00000000
--- a/src/src.pro
+++ /dev/null
@@ -1,18 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += sensors
-sensors.subdir = sensors
-sensors.target = sub-sensors
-
-qtHaveModule(quick) {
- SUBDIRS += imports
- imports.subdir = imports
- imports.target = sub-imports
- imports.depends = sensors
-}
-
-SUBDIRS += plugins
-plugins.subdir = plugins
-plugins.target = sub-plugins
-plugins.depends = sensors
-