summaryrefslogtreecommitdiffstats
path: root/src/nfc/android
diff options
context:
space:
mode:
authorPeter Rustler <peter.rustler@basyskom.com>2015-03-02 11:25:50 +0100
committerAlex Blasche <alexander.blasche@theqtcompany.com>2015-03-18 08:46:18 +0000
commitcace1dd0a88245129ebef2e98f13749f2f31fa4f (patch)
treecbe821761ddc913906e048f2e4c68b48e99c52bc /src/nfc/android
parent155f550ff4f7fd7135bf73f70dd92c7b605b7664 (diff)
Bugfix: Exit updateReceiveState if we are paused and not receiving.
Change-Id: I7f64cc684780983b5ff6edb2c99dd137be978f54 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/nfc/android')
-rw-r--r--src/nfc/android/androidmainnewintentlistener.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/nfc/android/androidmainnewintentlistener.cpp b/src/nfc/android/androidmainnewintentlistener.cpp
index a23695d3..a2bab47a 100644
--- a/src/nfc/android/androidmainnewintentlistener.cpp
+++ b/src/nfc/android/androidmainnewintentlistener.cpp
@@ -96,15 +96,22 @@ void MainNfcNewIntentListener::handlePause()
void MainNfcNewIntentListener::updateReceiveState()
{
- if (paused && receiving) {
- AndroidNfc::stopDiscovery();
- receiving = false;
+ if (paused) {
+ // We were paused while receiving, so we stop receiving.
+ if (receiving) {
+ AndroidNfc::stopDiscovery();
+ receiving = false;
+ }
return;
}
+
+ // We reach here, so we are not paused.
listenersLock.lockForRead();
+ // We have nfc listeners and do not receive. Switch on.
if (listeners.count() && !receiving)
receiving = AndroidNfc::startDiscovery();
+ // we have no nfc listeners and do receive. Switch off.
if (!listeners.count() && receiving) {
AndroidNfc::stopDiscovery();
receiving = false;