+static void __bt_handle_client_mtu_exchange_completed(event_gattc_mtu_configured_t *event_data)
+{
+ int result = BLUETOOTH_ERROR_NONE;
+ struct gatt_server_info_t *conn_info = NULL;
+ GVariant *param = NULL;
+ guint16 mtu = 0;
+ guint8 status = 0;
+
+ conn_info = __bt_find_remote_gatt_server_info_from_conn_id(event_data->conn_id);
+ if (conn_info == NULL) {
+ BT_ERR("Cant find connection Information");
+ return;
+ }
+
+ BT_INFO("GATT Client: MTU Configured from addr [%s] status [%d] MTU size [%d]",
+ conn_info->addr, event_data->status, event_data->mtu);
+
+ if (event_data->status != OAL_STATUS_SUCCESS)
+ result = BLUETOOTH_ERROR_INTERNAL;
+
+ BT_INFO("reply BT_REQ_ATT_MTU ");
+
+ /* DBUS Return fo BT_REQ_ATT_MTU for all the apps */
+ __bt_gatt_handle_pending_request_info(result, BT_REQ_ATT_MTU, conn_info->addr,
+ BT_ADDRESS_STRING_SIZE);
+
+ if (result == BLUETOOTH_ERROR_NONE) {
+ BT_INFO("sending mtu event");
+
+ mtu = event_data->mtu;
+ param = g_variant_new("(isqy)",
+ result,
+ conn_info->addr,
+ mtu,
+ status);
+
+ /* Send event to BT-API */
+ _bt_send_event(BT_DEVICE_EVENT,
+ BLUETOOTH_EVENT_GATT_ATT_MTU_CHANGED,
+ param);
+
+ /* Update the MTU for current connection */
+ BT_INFO("Updating the MTU for current connection");
+ __bt_update_mtu_gatt_device(conn_info->addr, event_data->mtu);
+ }
+}
+
+static struct gatt_mtu_info_t *__bt_find_mtu_gatt_device(char *address)
+{
+ GSList *l = NULL;
+ struct gatt_mtu_info_t *info = NULL;
+
+ BT_INFO("+");
+
+ for (l = gatt_mtu_info_list; l != NULL; l = g_slist_next(l)) {
+ info = (struct gatt_mtu_info_t*)l->data;
+ if (info == NULL)
+ continue;
+
+ if (!g_strcmp0(info->addr, address)) {
+ BT_INFO("Remote GATT device found addr[%s]", info->addr);
+ return info;
+ }
+ }
+
+ BT_INFO("Not found Remote GATT device addr[%s]", address);
+ return NULL;
+}
+
+static void __bt_remove_mtu_gatt_device(char *address)
+{
+ struct gatt_mtu_info_t *dev_info = NULL;
+
+ BT_INFO("+");
+
+ dev_info = __bt_find_mtu_gatt_device(address);
+
+ if (dev_info) {
+ BT_INFO("removing the gatt device from mtu list");
+ gatt_mtu_info_list = g_slist_remove(gatt_mtu_info_list, dev_info);
+ g_free(dev_info->addr);
+ g_free(dev_info);
+ }
+}
+
+static void __bt_add_mtu_gatt_device(char *address)
+{
+ struct gatt_mtu_info_t *dev_info = NULL;
+
+ BT_INFO("+");
+
+ dev_info = __bt_find_mtu_gatt_device(address);
+
+ if (!dev_info) {
+ BT_INFO("adding the gatt device in mtu list");
+ dev_info = g_new0(struct gatt_mtu_info_t, 1);
+ dev_info->addr = g_strdup(address);
+ dev_info->att_mtu = BT_DEFAULT_ATT_MTU;
+ gatt_mtu_info_list = g_slist_append(gatt_mtu_info_list, dev_info);
+ }
+}
+
+static void __bt_update_mtu_gatt_device(char *address, int mtu)
+{
+ struct gatt_mtu_info_t *dev_info = NULL;
+
+ BT_INFO("+");
+
+ dev_info = __bt_find_mtu_gatt_device(address);
+
+ if (dev_info) {
+ BT_INFO("Udating the mtu");
+ dev_info->att_mtu = mtu;
+ }
+}
+
+