From: Pawel Wasowski
Date: Tue, 1 Dec 2020 09:30:10 +0000 (+0200)
Subject: [Bluetooth] Prevent "Wrong listener identifier" errors for BLE scan
X-Git-Tag: submit/tizen_6.0/20210128.113333~2^2^2^2^2~1
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F78%2F250778%2F2;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git
[Bluetooth] Prevent "Wrong listener identifier" errors for BLE scan
The following app code caused aforementioned errors:
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan();
setTimeout(function() {
adapter.stopScan();
}, 10000);
Now, the error is not thrown.
[Validation] tct-bluetooth-tizen-tests: auto: 100% pass rate,
manual Bluetooth04_BLE_wearable suite: 100% pass rate
The code above runs in ChromeDevTools without errors
Change-Id: Id9ec278b4bb1c5ce38d0b3ffb1324498152ab645
Signed-off-by: Pawel Wasowski
---
diff --git a/src/bluetooth/bluetooth_api.js b/src/bluetooth/bluetooth_api.js
index 984fb779..1869e143 100755
--- a/src/bluetooth/bluetooth_api.js
+++ b/src/bluetooth/bluetooth_api.js
@@ -1514,12 +1514,12 @@ BluetoothLEAdapter.prototype.startScan = function() {
BluetoothLEAdapter.prototype.stopScan = function() {
privUtils_.log('Entered BluetoothLEAdapter.stopScan()');
- _bleScanListener.removeListener();
-
var result = native.callSync('BluetoothLEAdapter_stopScan', {});
if (native.isFailure(result)) {
throw native.getErrorObject(result);
}
+
+ _bleScanListener.removeListener();
};
var _BluetoothAdvertisePacketType = {