[common][bluetooth][TFDF-10685, fix Error CreatingBonding in helper wgt] 98/237998/1
authorqunfang.lin <qunfang.lin@samsung.com>
Tue, 7 Jul 2020 08:25:54 +0000 (16:25 +0800)
committerqunfang.lin <qunfang.lin@samsung.com>
Tue, 7 Jul 2020 08:27:10 +0000 (16:27 +0800)
Change-Id: Ib82653306fe89c42d25dc28ab11ee09192e1f78e
Signed-off-by: qunfang.lin <qunfang.lin@samsung.com>
common/tct-bluetooth-tizen-tests/tct-bt-helper/js/main.js

index 89d08bf753d5ddb7fc02d01d9f7cfcdef2372754..c0a91fc23917ad8188dbfba3d0abdbd247e6193e 100755 (executable)
@@ -23,6 +23,7 @@ Authors:
 */
 
 var serviceHandler = null;
+var connected_remote_device_address = null;
 
 function discoverDevicesError() {
     alert("Error discoverDevices");
@@ -116,6 +117,7 @@ function connectCallback(device) {
     if (device != null && device.uuids.indexOf(document.getElementById("serviceTxt").value) !== -1) {
         // open socket
             device.connectToServiceByUUID(document.getElementById("serviceTxt").value, function() {
+                connected_remote_device_address = device.address;
                 alert("connected");
             },connectError);
     } else {
@@ -128,7 +130,10 @@ function getDeviceCallback() {
 }
 
 function createBondingCallback() {
-    adapter.createBonding(document.getElementById("devicesList").value, getDeviceCallback, createBondingError);
+    adapter.destroyBonding(connected_remote_device_address);
+    setTimeout(function() {
+        adapter.createBonding(document.getElementById("devicesList").value, getDeviceCallback, createBondingError);
+    }, 3000);
 }
 
 function connectService() {