summaryrefslogtreecommitdiffstats
path: root/src/sensors/qsensorbackend.cpp
diff options
context:
space:
mode:
authorJuha Vuolle <juha.vuolle@insta.fi>2021-06-08 16:46:33 +0300
committerJuha Vuolle <juha.vuolle@insta.fi>2021-06-15 11:36:05 +0300
commitf8445fdcbf75e455443304bc290c48c37961e9f1 (patch)
tree2e47f5185cd12f2fad8dfc28649dee21f1754265 /src/sensors/qsensorbackend.cpp
parent54b3ca67ad7230a21d76c581dd4287401acb230f (diff)
Make sensor possible to indicate it is no longer busy
The current implementation allowed sensor backend to only indicate that it is busy, but not to tell when it was freed again. This commit allows sensor backend to indicate also that it's busy state has cleared. It is up to the sensor implementation to decide if it makes sense / is possible to do that or not. Pick-to: 6.2 Task-number: QTBUG-92513 Task-number: QTBUG-92505 Change-Id: Ied4857850e81346031fd83aa347d9955081118e8 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/sensors/qsensorbackend.cpp')
-rw-r--r--src/sensors/qsensorbackend.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/sensors/qsensorbackend.cpp b/src/sensors/qsensorbackend.cpp
index 31e2e811..1e75644b 100644
--- a/src/sensors/qsensorbackend.cpp
+++ b/src/sensors/qsensorbackend.cpp
@@ -318,21 +318,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();
}
/*!