Return error code properly 09/207609/1
authorinjun.yang <injun.yang@samsung.com>
Mon, 11 Feb 2019 05:31:16 +0000 (14:31 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Mon, 10 Jun 2019 03:49:01 +0000 (12:49 +0900)
[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 <injun.yang@samsung.com>
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
bt-service-adaptation/services/gatt/bt-service-gatt.c
bt-service/bt-service-device.c

index 4ba0750..c6a1315 100644 (file)
@@ -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;
 }
 
index e7002e9..82c81ee 100644 (file)
@@ -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);