Implement get_att_mtu logic in hal gatt client
[platform/core/connectivity/bluetooth-frwk.git] / bt-oal / oal-gatt.c
index e3a6547..4fd1513 100644 (file)
@@ -2429,6 +2429,30 @@ oal_status_t gattc_register_scan_filter(oal_ble_scan_filter_t* filter_data)
        return OAL_STATUS_SUCCESS;
 }
 
+oal_status_t gattc_get_att_mtu(int conn_id, int *mtu)
+{
+       int ret = OAL_STATUS_SUCCESS;
+       API_TRACE("Get ATT MTU, conn_id: %d", conn_id);
+       CHECK_OAL_GATT_ENABLED();
+       CHECK_CLIENT_CONNECTION(conn_id);
+       OAL_CHECK_PARAMETER(mtu, return);
+
+       /* To prevent crash in case other libraries not support this api */
+       if (gatt_api->client->get_att_mtu == NULL) {
+               BT_WARN("get_att_mtu is NULL");
+               return OAL_STATUS_NOT_SUPPORT;
+       }
+
+       ret = gatt_api->client->get_att_mtu(conn_id, mtu);
+       if (ret != BT_STATUS_SUCCESS) {
+               BT_ERR("GATT MTU Size failed, status: %s", status2string(ret));
+               return convert_to_oal_status(ret);
+       }
+
+       BT_INFO("Current ATT MTU Size: %d", *mtu);
+       return OAL_STATUS_SUCCESS;
+}
+
 oal_status_t gattc_configure_mtu(int conn_id, int mtu)
 {
        int ret;