From: Pawel Andruszkiewicz
Date: Wed, 19 Aug 2015 06:34:55 +0000 (+0200)
Subject: [BluetoothLE] Return NotFound error if UUID is invalid.
X-Git-Tag: submit/tizen/20151026.073646^2^2~184^2
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f3d0c2f7afefbeaf15e0d4988bd6f2820dd1144b;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git
[BluetoothLE] Return NotFound error if UUID is invalid.
[Verification] BluetoothLEDevice_getService_NotFoundError should pass.
Change-Id: Ifd7b89448e02ebd1c964ee9bb5e8d369f967ed9b
Signed-off-by: Pawel Andruszkiewicz
---
diff --git a/src/bluetooth/bluetooth_gatt_service.cc b/src/bluetooth/bluetooth_gatt_service.cc
index 2474bb24..03d8524d 100755
--- a/src/bluetooth/bluetooth_gatt_service.cc
+++ b/src/bluetooth/bluetooth_gatt_service.cc
@@ -131,10 +131,15 @@ PlatformResult BluetoothGATTService::GetSpecifiedGATTService(const std::string &
int ret = bt_gatt_client_get_service(client, uuid.c_str(), &service);
if (BT_ERROR_NONE != ret) {
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");
+ switch (ret) {
+ case BT_ERROR_NO_DATA:
+ return PlatformResult(ErrorCode::NOT_FOUND_ERR, "Service not found");
+
+ case BT_ERROR_INVALID_PARAMETER:
+ return PlatformResult(ErrorCode::NOT_FOUND_ERR, "Service UUID is invalid");
+
+ default:
+ return PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to get a service's GATT handle");
}
}