[bluetooth] - temporary fix for BLE device connect function
authorAndrzej Popowski <a.popowski@samsung.com>
Mon, 10 Aug 2015 06:45:39 +0000 (08:45 +0200)
committerAndrzej Popowski <a.popowski@samsung.com>
Mon, 10 Aug 2015 06:45:39 +0000 (08:45 +0200)
Change-Id: Ia3b753016654391cf17458cf5e978d47c8fa9f81
Signed-off-by: Andrzej Popowski <a.popowski@samsung.com>
src/bluetooth/bluetooth_le_device.cc

index a442a1a..e779b7f 100755 (executable)
@@ -308,6 +308,7 @@ void BluetoothLEDevice::Connect(const picojson::value& data,
 
   const auto& address = common::FromJson<std::string>(args, "address");
 
+/* TODO uncomment when bt_device_is_profile_connected function will be fixed
   bool connected = false;
   int ret = bt_device_is_profile_connected(address.c_str(), BT_PROFILE_GATT, &connected);
   if (BT_ERROR_NONE != ret) {
@@ -329,6 +330,18 @@ void BluetoothLEDevice::Connect(const picojson::value& data,
     }
     connecting_[address] = callback_handle;
   }
+*/
+
+  // TODO remove when the code above will be uncommented
+  int ret = bt_gatt_connect(address.c_str(), true);
+  if (BT_ERROR_NONE != ret) {
+    instance_.AsyncResponse(
+        callback_handle,
+        PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to connect."));
+    return;
+  }
+  connecting_[address] = callback_handle;
+  // ---
 
   ReportSuccess(out);
 }