Use GATT server's get mtu size API instead of GATT client API
[platform/upstream/iotivity.git] / resource / csdk / connectivity / src / bt_le_adapter / tizen / caleserver_mcd.c
index cf81f37..9f3791f 100644 (file)
@@ -28,7 +28,7 @@
 #include "oic_malloc.h"
 #include "caleutil.h"
 #include "cautilinterface.h"
-#ifndef TIZEN_4
+#ifndef BLE_TIZEN_40
 #include <bluetooth_internal.h>
 #endif
 
@@ -1185,7 +1185,16 @@ uint16_t CALEServerGetMtuSize(const char* address)
     unsigned int mtu = CA_DEFAULT_BLE_MTU_SIZE;
     int ret = 0;
 
-#ifdef TIZEN_4
+#ifdef BLE_TIZEN_55
+    ret = bt_gatt_server_get_device_mtu(address, &mtu);
+    if (0 != ret)
+    {
+        OIC_LOG_V(ERROR, TAG,
+                  "bt_gatt_server_get_device_mtu failed with return [%s]", CALEGetErrorMsg(ret));
+        return CA_DEFAULT_BLE_MTU_SIZE;
+    }
+#else
+#ifdef BLE_TIZEN_40
     bt_gatt_client_h client = NULL;
     ret = bt_gatt_client_create(address, &client);
     if (0 != ret)
@@ -1218,7 +1227,8 @@ uint16_t CALEServerGetMtuSize(const char* address)
                   "bt_device_get_att_mtu failed with return [%s]", CALEGetErrorMsg(ret));
         return CA_DEFAULT_BLE_MTU_SIZE;
     }
-#endif // TIZEN_4
+#endif // BLE_TIZEN_40
+#endif // BLE_TIZEN_55
 
     OIC_LOG_V(INFO, TAG, "mtu size(including header) from bt_device_get_att_mtu is %d", mtu);
     OIC_LOG(DEBUG, TAG, "OUT");