From: injun.yang Date: Mon, 11 Feb 2019 05:31:16 +0000 (+0900) Subject: Return error code properly X-Git-Tag: accepted/tizen/unified/20190611.050050~3 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git;a=commitdiff_plain;h=7e250d2c9e5b24c7ff06e15fb5bcd4c76ddb4803 Return error code properly [Model] All [BinType] AP [Customer] OPEN [Issue#] N/A [Request] Internal [Occurrence Version] N/A [Problem] In disconnection staus, bt frwk return MTU size without error code [Cause & Measure] When MTU size is invalid, return error code. [Checking Method] Getting MTU size [Team] IoT Hub [Developer] Injun Yang [Solution company] Samsung [Change Type] Specification change Change-Id: I23fa6a2a4bcb1f75c081a502062b7d5e7177111b Signed-off-by: injun.yang Signed-off-by: DoHyun Pyun --- diff --git a/bt-service-adaptation/services/gatt/bt-service-gatt.c b/bt-service-adaptation/services/gatt/bt-service-gatt.c index 4ba0750..c6a1315 100644 --- a/bt-service-adaptation/services/gatt/bt-service-gatt.c +++ b/bt-service-adaptation/services/gatt/bt-service-gatt.c @@ -2489,8 +2489,15 @@ int _bt_get_att_mtu(bluetooth_device_address_t *address, BT_ERR("ret: %d", ret); return BLUETOOTH_ERROR_INTERNAL; } + BT_INFO("ATT MTU received from OAL [%d]", stack_mtu); *mtu = (unsigned int)stack_mtu; + + if (*mtu == 0) { + BT_ERR("MTU value is zero, GATT Client [%s] is not yet connected..", addr); + return BLUETOOTH_ERROR_NOT_CONNECTED; + } + return BLUETOOTH_ERROR_NONE; } diff --git a/bt-service/bt-service-device.c b/bt-service/bt-service-device.c index e7002e9..82c81ee 100644 --- a/bt-service/bt-service-device.c +++ b/bt-service/bt-service-device.c @@ -3375,6 +3375,11 @@ int _bt_get_att_mtu(bluetooth_device_address_t *device_address, BT_DBG("ATT MTU : %d", *mtu); g_variant_unref(value); g_variant_unref(result); + + if (*mtu == 0) { + g_object_unref(device_proxy); + return BLUETOOTH_ERROR_NOT_CONNECTED; + } } g_object_unref(device_proxy);