summaryrefslogtreecommitdiff
path: root/src/bluetooth-common.c
diff options
context:
space:
mode:
authorDoHyun Pyun <dh79.pyun@samsung.com>2017-03-20 19:57:05 +0900
committerDoHyun Pyun <dh79.pyun@samsung.com>2017-04-06 08:24:31 +0900
commit63d79739acda75794dc123445e9eebbef1b69583 (patch)
treeefdb50c5b39902a27572e78b703e5327767fe9a5 /src/bluetooth-common.c
parentf21fb9ee6bb563f5af7737a1b58d0b18a7a54431 (diff)
downloadbluetooth-63d79739acda75794dc123445e9eebbef1b69583.tar.gz
bluetooth-63d79739acda75794dc123445e9eebbef1b69583.tar.bz2
bluetooth-63d79739acda75794dc123445e9eebbef1b69583.zip
Publish GATT MTU Exchange APIs to Native public API
Change-Id: Id1a134752e8c383a5d307ecffd89c48b5b803b19 Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
Diffstat (limited to 'src/bluetooth-common.c')
-rw-r--r--src/bluetooth-common.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/bluetooth-common.c b/src/bluetooth-common.c
index 7d1b12e..8815a90 100644
--- a/src/bluetooth-common.c
+++ b/src/bluetooth-common.c
@@ -733,9 +733,9 @@ static void __bt_free_bt_device_sdp_info_s(bt_device_sdp_info_s *sdp_info)
sdp_info = NULL;
}
-static int __bt_get_bt_device_att_mtu_info_s(bt_device_att_mtu_info_s **dest, bluetooth_le_att_mtu_info_t *source)
+static int __bt_get_bt_gatt_client_att_mtu_info_s(bt_gatt_client_att_mtu_info_s **dest, bluetooth_le_att_mtu_info_t *source)
{
- *dest = (bt_device_att_mtu_info_s *)g_malloc0(sizeof(bt_device_att_mtu_info_s));
+ *dest = (bt_gatt_client_att_mtu_info_s *)g_malloc0(sizeof(bt_gatt_client_att_mtu_info_s));
if (*dest == NULL)
return BT_ERROR_OUT_OF_MEMORY;
@@ -1048,6 +1048,7 @@ static bool __bt_need_to_handle(int event)
case BLUETOOTH_EVENT_GATT_SERVER_READ_REQUESTED:
case BLUETOOTH_EVENT_GATT_SERVER_NOTIFICATION_COMPLETED:
case BLUETOOTH_EVENT_GATT_CLIENT_SERVICE_CHANGED:
+ case BLUETOOTH_EVENT_GATT_ATT_MTU_CHANGED:
case BLUETOOTH_EVENT_TDS_TRANSPORT_DATA_RECEIVED:
case BLUETOOTH_EVENT_TDS_ACTIVATION_RESULT:
case BLUETOOTH_EVENT_TDS_CONTROL_POINT_ENABLED:
@@ -2438,12 +2439,24 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
bt_event_slot_container[event_index].user_data);
break;
case BLUETOOTH_EVENT_GATT_ATT_MTU_CHANGED: {
- bt_device_att_mtu_info_s *mtu_info = NULL;
+ bt_gatt_client_att_mtu_info_s *mtu_info = NULL;
+ bt_gatt_client_s *client = NULL;
BT_INFO("BLUETOOTH_EVENT_GATT_ATT_MTU_CHANGED");
- __bt_get_bt_device_att_mtu_info_s(&mtu_info, (bluetooth_le_att_mtu_info_t *)(param->param_data));
- ((bt_device_att_mtu_changed_cb)bt_event_slot_container[event_index].callback)
- (_bt_get_error_code(param->result), mtu_info, bt_event_slot_container[event_index].user_data);
+ __bt_get_bt_gatt_client_att_mtu_info_s(&mtu_info, (bluetooth_le_att_mtu_info_t *)(param->param_data));
+
+ client = _bt_gatt_get_client(mtu_info->remote_address);
+
+ if (client && client->connected && client->att_mtu_changed_cb)
+ client->att_mtu_changed_cb(client,
+ (const bt_gatt_client_att_mtu_info_s *)mtu_info,
+ client->att_mtu_changed_user_data);
+
+ if (bt_event_slot_container[event_index].callback)
+ ((bt_device_att_mtu_changed_cb)bt_event_slot_container[event_index].callback)
+ (_bt_get_error_code(param->result), (bt_device_att_mtu_info_s *)mtu_info,
+ bt_event_slot_container[event_index].user_data);
+
break;
}
case BLUETOOTH_EVENT_LE_DATA_LENGTH_CHANGED: