[BluetoothLE] Report NotFoundError if bt_gatt_client_get_service() returns BT_ERROR_N...
authorPawel Andruszkiewicz <p.andruszkie@samsung.com>
Fri, 7 Aug 2015 13:55:33 +0000 (15:55 +0200)
committerPawel Andruszkiewicz <p.andruszkie@samsung.com>
Fri, 7 Aug 2015 13:57:37 +0000 (15:57 +0200)
[Verification] Code compiles.

Change-Id: I18a8d55bdd842caf9dd60635ac1223aacc94f615
Signed-off-by: Pawel Andruszkiewicz <p.andruszkie@samsung.com>
src/bluetooth/bluetooth_gatt_service.cc

index 4744f5a228d4878ff5967c75a01e8768dd09759a..1b271417566556fb155abdb3406abdecf43ed27c 100755 (executable)
@@ -130,8 +130,12 @@ PlatformResult BluetoothGATTService::GetSpecifiedGATTService(const std::string &
   bt_gatt_h service = nullptr;
   int ret = bt_gatt_client_get_service(client, uuid.c_str(), &service);
   if (BT_ERROR_NONE != ret) {
-    LoggerE("%d", ret);
-    return util::GetBluetoothError(ret, "Failed to get a service's GATT handle");
+    LoggerE("bt_gatt_client_get_service() error: %d", ret);
+    if (BT_ERROR_NO_DATA == ret) {
+      return PlatformResult(ErrorCode::NOT_FOUND_ERR, "Service not found");
+    } else {
+      return util::GetBluetoothError(ret, "Failed to get a service's GATT handle");
+    }
   }
 
   //report BluetoothGattService