From: Pawel Andruszkiewicz
Date: Fri, 7 Aug 2015 13:55:33 +0000 (+0200)
Subject: [BluetoothLE] Report NotFoundError if bt_gatt_client_get_service() returns BT_ERROR_N...
X-Git-Tag: submit/tizen/20151026.073646^2^2~205^2
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d34e9ff20ebf115e26538d26d88e6ed6ab19e1a0;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git
[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
---
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