implement ondevicedisappeared() method
authorCorentin Lecouvey <corentin.lecouvey@open.eurogiciel.org>
Mon, 18 Aug 2014 14:39:38 +0000 (16:39 +0200)
committerCorentin Lecouvey <corentin.lecouvey@open.eurogiciel.org>
Mon, 18 Aug 2014 14:47:38 +0000 (16:47 +0200)
Concern BluetoothDiscoverDevicesSuccessCallback_ondevicedisappeared
TCT test case

Change-Id: I08cdcd6ced3f3c869c2ea7736bdab6291d9020ee

bluetooth/bluetooth_api.js
bluetooth/bluetooth_instance_capi.cc

index 238ea28..cc1e80a 100644 (file)
@@ -180,6 +180,9 @@ var handleDeviceRemoved = function(address) {
       break;
     }
   }
+
+  if (adapter.discovery_callbacks.ondevicedisappeared)
+    adapter.discovery_callbacks.ondevicedisappeared(address);
 };
 
 var handleDeviceUpdated = function(msg) {
index 2e21fec..a2af57e 100644 (file)
@@ -257,6 +257,12 @@ void BluetoothInstance::OnDiscoveryStateChanged(int result,
       obj->InternalPostMessage(picojson::value(o));
       break;
     }
+    case BT_ADAPTER_DEVICE_DISCOVERY_REMOVED: {
+      o["Address"] = picojson::value(discovery_info->remote_address);
+      o["cmd"] = picojson::value("DeviceRemoved");
+      obj->InternalPostMessage(picojson::value(o));
+      break;
+    }
     default:
       LOG_ERR("Unknown discovery state callback!");
       break;
@@ -335,6 +341,7 @@ void BluetoothInstance::OnBondCreated(int result, bt_device_info_s* device_info,
 void BluetoothInstance::OnBondDestroyed(int result, char* remote_address,
     void* user_data) {
   BluetoothInstance* obj = static_cast<BluetoothInstance*>(user_data);
+
   if (!obj) {
     LOG_ERR("user_data is NULL!");
     return;