{
BT_CHECK_PARAMETER(address, return);
BT_CHECK_PARAMETER(mtu, return);
- struct gatt_client_info_t *conn_info = NULL;
+ struct gatt_client_info_t *client_info = NULL;
char addr[BT_ADDRESS_STRING_SIZE] = { 0 };
int ret = OAL_STATUS_SUCCESS;
int stack_mtu;
BT_INFO("Get current MTU size for the remote client:DevAddress:[%s]", addr);
- conn_info = _bt_find_remote_gatt_client_info(addr);
- if (conn_info) {
+ client_info = _bt_find_remote_gatt_client_info(addr);
+ if (client_info) {
BT_INFO("GATT Client [%s] is connected, conn Id [%d] Instance ID [%d]",
- conn_info->addr, conn_info->connection_id, conn_info->instance_id);
- } else {
- BT_ERR("GATT Client [%s] is not yet connected..", addr);
- return BLUETOOTH_ERROR_NOT_CONNECTED;
- }
+ client_info->addr, client_info->connection_id, client_info->instance_id);
- if (conn_info->instance_id == -1) {
- ret = gattc_get_att_mtu(conn_info->connection_id, &stack_mtu);
+ ret = gatts_get_att_mtu(client_info->connection_id, &stack_mtu);
if (ret != OAL_STATUS_SUCCESS) {
BT_ERR("ret: %d", ret);
return _bt_convert_oal_status_to_bt_error(ret);
}
} else {
- ret = gatts_get_att_mtu(conn_info->connection_id, &stack_mtu);
- if (ret != OAL_STATUS_SUCCESS) {
- BT_ERR("ret: %d", ret);
- return _bt_convert_oal_status_to_bt_error(ret);
+ struct gatt_server_info_t *server_info = NULL;
+ BT_ERR("GATT Client [%s] is not yet connected..", addr);
+ server_info = _bt_find_remote_gatt_server_info(addr);
+ if (server_info) {
+ BT_INFO("GATT Server [%s] is connected, conn Id [%d] Client ID [%d]",
+ server_info->addr, server_info->connection_id, server_info->client_id);
+
+ ret = gattc_get_att_mtu(server_info->connection_id, &stack_mtu);
+ if (ret != OAL_STATUS_SUCCESS) {
+ BT_ERR("ret: %d", ret);
+ return _bt_convert_oal_status_to_bt_error(ret);
+ }
+ } else {
+ BT_ERR("GATT Server [%s] is not yet connected..", addr);
+ return BLUETOOTH_ERROR_NOT_CONNECTED;
}
}