diff options
Diffstat (limited to 'src/bluetooth-common.c')
-rw-r--r-- | src/bluetooth-common.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/src/bluetooth-common.c b/src/bluetooth-common.c index 08e4a0f..5e3c5c1 100644 --- a/src/bluetooth-common.c +++ b/src/bluetooth-common.c @@ -1053,6 +1053,8 @@ static bool __bt_need_to_handle(int event) case BLUETOOTH_EVENT_TDS_ACTIVATION_RESULT: case BLUETOOTH_EVENT_TDS_CONTROL_POINT_ENABLED: case BLUETOOTH_EVENT_TDS_ACTIVATION_INDICATION: + case BLUETOOTH_EVENT_OTP_READ_CHAR_VAL: + case BLUETOOTH_EVENT_OTP_NOTIFICATION_ENABLED: return true; default: break; @@ -1992,6 +1994,9 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us /* TDS Seeker */ _bt_tds_update_seeker_connection_state_changed(param->result, device_addr, TRUE); + /* OTP Client */ + _bt_otp_client_connection_state_changed(param->result, device_addr, TRUE); + g_free(device_addr); device_addr = NULL; break; @@ -2019,6 +2024,9 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us /* TDS Seeker */ _bt_tds_update_seeker_connection_state_changed(param->result, device_addr, FALSE); + /* OTP Client */ + _bt_otp_client_connection_state_changed(param->result, device_addr, FALSE); + g_free(device_addr); device_addr = NULL; break; @@ -2918,7 +2926,8 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us if (device_addr != NULL) free(device_addr); /* LCOV_EXCL_STOP */ break; - } case BLUETOOTH_EVENT_OTP_SERVER_STATE_CHANGED: { + } + case BLUETOOTH_EVENT_OTP_SERVER_STATE_CHANGED: { bt_otp_server_state_changed_cb cb = bt_event_slot_container[event_index].callback; bool *status = (bool *)(param->param_data); @@ -2927,6 +2936,31 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us cb(_bt_get_error_code(param->result), *status ? true : false); break; } + case BLUETOOTH_EVENT_OTP_READ_CHAR_VAL: { + BT_DBG("BLUETOOTH_EVENT_OTP_READ_CHAR_VAL"); /* LCOV_EXCL_LINE */ + bluetooth_otp_resp_info_t *info = NULL; + char *handle = NULL; + + if (_bt_get_error_code(param->result) == BT_ERROR_NONE) { + info = (bluetooth_otp_resp_info_t *)(param->param_data); + BT_ERR("Read Success Handle [%s]", info->handle); + _bt_otp_client_read_value_response(_bt_get_error_code(param->result), + info->handle, info->data, info->data_length); + } else { + handle = (char *)(param->param_data); + BT_ERR("Read Fail Handle [%s]", handle); + _bt_otp_client_read_value_response(_bt_get_error_code(param->result), + handle, NULL, 0); + } + break; + } + case BLUETOOTH_EVENT_OTP_NOTIFICATION_ENABLED: { + BT_DBG("BLUETOOTH_EVENT_OTP_NOTIFICATION_ENABLED"); /* LCOV_EXCL_LINE */ + char *handle = (char *)(param->param_data); + BT_ERR("Handle [%s]", handle); + _bt_otp_client_notification_enabled(_bt_get_error_code(param->result), handle); + break; + } default: BT_INFO("Unknown function"); break; |