summaryrefslogtreecommitdiff
path: root/src/bluetooth-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bluetooth-common.c')
-rw-r--r--[-rwxr-xr-x]src/bluetooth-common.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/bluetooth-common.c b/src/bluetooth-common.c
index e26223d..2e9f8cd 100755..100644
--- a/src/bluetooth-common.c
+++ b/src/bluetooth-common.c
@@ -979,6 +979,7 @@ static bool __bt_need_to_handle(int event)
case BLUETOOTH_EVENT_ADVERTISING_STARTED:
case BLUETOOTH_EVENT_ADVERTISING_STOPPED:
case BLUETOOTH_EVENT_GATT_CONNECTED:
+ case BLUETOOTH_EVENT_GATT_DISCONNECTED:
case BLUETOOTH_EVENT_GATT_SERVER_VALUE_CHANGED:
case BLUETOOTH_EVENT_GATT_SERVER_NOTIFICATION_STATE_CHANGED:
case BLUETOOTH_EVENT_GATT_SERVER_READ_REQUESTED:
@@ -1811,6 +1812,7 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
case BLUETOOTH_EVENT_GATT_CONNECTED: {
bt_gatt_client_s *client_s;
bt_gatt_connection_state_changed_cb cb = NULL;
+ bool is_pxp_initialized = FALSE;
BT_INFO("BLUETOOTH_EVENT_GATT_CONNECTED");
_bt_convert_address_to_string(&device_addr,
(bluetooth_device_address_t *)(param->param_data));
@@ -1828,6 +1830,12 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
if (cb)
cb(_bt_get_error_code(param->result), TRUE, device_addr,
bt_event_slot_container[event_index].user_data);
+
+ /* The below check is for calling the callback for proximity profile reporter/Monitor role */
+ _bt_check_proximity_is_initialized(&is_pxp_initialized);
+ if (is_pxp_initialized)
+ _bt_proximity_connection_set_state_changed(param->result, device_addr, TRUE);
+
g_free(device_addr);
device_addr = NULL;
break;
@@ -1835,6 +1843,7 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
case BLUETOOTH_EVENT_GATT_DISCONNECTED: {
bt_gatt_client_s *client_s;
bt_gatt_connection_state_changed_cb cb = NULL;
+ bool is_pxp_initialized = FALSE;
BT_INFO("BLUETOOTH_EVENT_GATT_DISCONNECTED");
_bt_convert_address_to_string(&device_addr,
(bluetooth_device_address_t *)(param->param_data));
@@ -1846,6 +1855,11 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
if (cb)
cb(_bt_get_error_code(param->result), FALSE, device_addr,
bt_event_slot_container[event_index].user_data);
+ /* The below check is for calling the callback for proximity profile reporter/Monitor role */
+ _bt_check_proximity_is_initialized(&is_pxp_initialized);
+ if (is_pxp_initialized)
+ _bt_proximity_connection_set_state_changed(param->result, device_addr, FALSE);
+
g_free(device_addr);
device_addr = NULL;
break;
@@ -2605,9 +2619,9 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
bt_pxp_property_info = (bt_pxp_property_changed_params_t *)(param->param_data);
_bt_convert_address_to_string(&device_addr, &bt_pxp_property_info->device_address);
- ((bt_proximity_property_changed_cb)bt_event_slot_container[event_index].callback) /* LCOV_EXCL_LINE */
+ ((bt_proximity_reporter_property_changed_cb)bt_event_slot_container[event_index].callback) /* LCOV_EXCL_LINE */
(_bt_get_error_code(param->result), device_addr,
- bt_pxp_property_info->role, bt_pxp_property_info->service_type,
+ bt_pxp_property_info->service_type,
bt_pxp_property_info->alert_lvl, bt_event_slot_container[event_index].user_data);
if (device_addr != NULL)
@@ -3156,7 +3170,7 @@ static int __bt_get_cb_index(int event)
case BLUETOOTH_EVENT_IPSP_INIT_STATE_CHANGED:
return BT_EVENT_IPSP_INIT_STATE_CHANGED;
case BLUETOOTH_EVENT_PXP_PROPERTY_CHANGED:
- return BT_EVENT_PROXIMITY_PROPERTY_CHANGED;
+ return BT_EVENT_PROXIMITY_REPORTER_PROPERTY_CHANGED;
default:
return -1;
}