From: Wootak Jung Date: Tue, 30 Apr 2024 05:19:17 +0000 (+0900) Subject: Modify to connect only one AVRCP device X-Git-Tag: accepted/tizen/unified/20240703.100015~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F41%2F313741%2F1;p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git Modify to connect only one AVRCP device Change-Id: I8667c617d5c48fc8fd04acd311d6c00def74e1e4 Signed-off-by: Wootak Jung --- diff --git a/bt-service/services/audio/bt-service-audio.c b/bt-service/services/audio/bt-service-audio.c index 3f7d50a..6a47a33 100644 --- a/bt-service/services/audio/bt-service-audio.c +++ b/bt-service/services/audio/bt-service-audio.c @@ -1380,7 +1380,7 @@ void _bt_audio_handle_incoming_authorization(char *address, int service_id) oal_status_t res = OAL_STATUS_SUCCESS; _bt_convert_addr_string_to_type(device_address.addr, address); - + BT_DBG("service_id [%d]", service_id); switch (service_id) { case HSP_SERVICE_ID: case HFP_SERVICE_ID: @@ -1393,6 +1393,10 @@ void _bt_audio_handle_incoming_authorization(char *address, int service_id) BT_DBG("Connected [0x%x]", connected); break; case AVRCP_SERVICE_ID: + if (TIZEN_FEATURE_DA_REFERENCE) { + connected = _bt_is_headset_type_connected(BT_AVRCP_TARGET, connected_address); + BT_DBG("Connected [0x%x]", connected); + } break; default: BT_ERR("Invalid HFP device ID.. [%d]", service_id); @@ -1428,6 +1432,24 @@ void _bt_audio_handle_incoming_authorization(char *address, int service_id) return; } } + + if(service_id == AVRCP_SERVICE_ID) { + char hfp_connected_address[BT_ADDRESS_STRING_SIZE + 1]; + gboolean hfp_connected = FALSE; + hfp_connected = _bt_is_headset_type_connected(BT_AUDIO_AG, hfp_connected_address); + + if (hfp_connected) { + BT_INFO("device is already connected..check which device.."); + if (g_strcmp0(hfp_connected_address, address) != 0) { + BT_INFO("Different device is HF connected[%s] reject current [%s] device authorization request", + hfp_connected_address, address); + res = device_reply_auth_request((bt_address_t*)&device_address, service_id, FALSE, FALSE); + if (res != OAL_STATUS_SUCCESS) + BT_ERR("authorize_response: %d", res); + return; + } + } + } } if (connected) { diff --git a/bt-service/services/device/bt-service-core-device.c b/bt-service/services/device/bt-service-core-device.c index b155b57..c3608d6 100644 --- a/bt-service/services/device/bt-service-core-device.c +++ b/bt-service/services/device/bt-service-core-device.c @@ -620,9 +620,17 @@ static void __bt_device_authorization_request_callback(event_dev_authorize_req_t break; case AVRCP_SERVICE_ID: BT_DBG("Incoming AVRCP (Remote) Profile conn Req from device addr [%s]", address); + if (TIZEN_FEATURE_DA_REFERENCE) { + _bt_audio_handle_incoming_authorization(address, service_id); + return; + } break; case AVRCP_CT_SERVICE_ID: BT_DBG("Incoming AVRCP (Remote: Controller) Profile conn Req from device addr [%s]", address); + if (TIZEN_FEATURE_DA_REFERENCE) { + _bt_audio_handle_incoming_authorization(address, service_id); + return; + } break; #ifdef TIZEN_FEATURE_BT_OBEX case OPP_SERVICE_ID: {