diff options
author | agrkush <kush.agrawal@samsung.com> | 2018-12-16 20:48:06 +0530 |
---|---|---|
committer | DoHyun Pyun <dh79.pyun@samsung.com> | 2018-12-19 09:59:38 +0900 |
commit | 408fb23ec95a77781d91f3674c8e1b3712b3bfa7 (patch) | |
tree | c3ff8d15af728c54a0e6e876769e682b9b2b5992 | |
parent | 255adc3a72fa9b6e4ae0d9585152bce3daea4713 (diff) | |
download | iotivity-408fb23ec95a77781d91f3674c8e1b3712b3bfa7.tar.gz iotivity-408fb23ec95a77781d91f3674c8e1b3712b3bfa7.tar.bz2 iotivity-408fb23ec95a77781d91f3674c8e1b3712b3bfa7.zip |
Changing logic of fetching MTU size in server size.submit/tizen/20181219.045745submit/tizen/20181219.010032accepted/tizen/unified/20181219.154852
https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/368
(cherry picked from commit b4f4c74d8b114706acb1cbcc3a71fcceeb23399a)
Change-Id: I39f7a066c4608cff93730771eef756bcd8695d21
Signed-off-by: agrkush <kush.agrawal@samsung.com>
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
-rw-r--r-- | resource/csdk/connectivity/src/bt_le_adapter/tizen/caleserver.c | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleserver.c b/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleserver.c index 9c74caf5e..019984ddd 100644 --- a/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleserver.c +++ b/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleserver.c @@ -949,8 +949,35 @@ uint16_t CALEServerGetMtuSize(const char* address) OIC_LOG(DEBUG, TAG, "IN"); VERIFY_NON_NULL_RET(address, TAG, "address is null", CA_SUPPORTED_BLE_MTU_SIZE - CA_BLE_MTU_HEADER_SIZE); - //@Todo - OIC_LOG(INFO, TAG, - "bt_device_get_att_mtu is not supported"); - return CA_SUPPORTED_BLE_MTU_SIZE - CA_BLE_MTU_HEADER_SIZE; + + unsigned int mtu = CA_DEFAULT_BLE_MTU_SIZE; + int ret = 0; + + bt_gatt_client_h client = NULL; + ret = bt_gatt_client_create(address, &client); + if (0 != ret) + { + OIC_LOG_V(ERROR, TAG, + "bt_gatt_client_create failed with return [%s]", CALEGetErrorMsg(ret)); + return CA_DEFAULT_BLE_MTU_SIZE; + } + + ret = bt_gatt_client_get_att_mtu(client, &mtu); + if (0 != ret) + { + OIC_LOG_V(ERROR, TAG, + "bt_gatt_client_get_att_mtu failed with return [%s]", CALEGetErrorMsg(ret)); + return CA_DEFAULT_BLE_MTU_SIZE; + } + + ret = bt_gatt_client_destroy(client); + if (0 != ret) + { + OIC_LOG_V(ERROR, TAG, + "bt_gatt_client_destroy failed with return [%s]", CALEGetErrorMsg(ret)); + return CA_DEFAULT_BLE_MTU_SIZE; + } + + OIC_LOG_V(INFO, TAG, "mtu size(including header) from bt_device_get_att_mtu is %d", mtu); + return mtu - CA_BLE_MTU_HEADER_SIZE; } |