From d34e9ff20ebf115e26538d26d88e6ed6ab19e1a0 Mon Sep 17 00:00:00 2001 From: Pawel Andruszkiewicz Date: Fri, 7 Aug 2015 15:55:33 +0200 Subject: [PATCH] [BluetoothLE] Report NotFoundError if bt_gatt_client_get_service() returns BT_ERROR_NO_DATA. [Verification] Code compiles. Change-Id: I18a8d55bdd842caf9dd60635ac1223aacc94f615 Signed-off-by: Pawel Andruszkiewicz --- src/bluetooth/bluetooth_gatt_service.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/bluetooth/bluetooth_gatt_service.cc b/src/bluetooth/bluetooth_gatt_service.cc index 4744f5a2..1b271417 100755 --- a/src/bluetooth/bluetooth_gatt_service.cc +++ b/src/bluetooth/bluetooth_gatt_service.cc @@ -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 -- 2.34.1