Fix issue where response was not delivered when HF connect failed 40/313740/1
authorWootak Jung <wootak.jung@samsung.com>
Mon, 22 Apr 2024 08:21:33 +0000 (17:21 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Mon, 1 Jul 2024 10:05:18 +0000 (19:05 +0900)
Fix issue of sending wrong address

Change-Id: Id274007eaba5e2d7b4fb17fe64de588edf74c952
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
bt-service/services/audio/hf/bt-service-hf-client.c

index fd91e2d..65097b3 100644 (file)
 static void __bt_reply_hf_client_disconnection_pending_request(bt_address_t *address)
 {
        char addr[BT_ADDRESS_STRING_SIZE] = { 0 };
-       bluetooth_device_address_t device_address;
        GArray *out_param;
        invocation_info_t *req_info;
        int result = BLUETOOTH_ERROR_NONE;
 
        ret_if(NULL == address);
 
-       memcpy(device_address.addr, address->addr, BLUETOOTH_ADDRESS_LENGTH);
        _bt_convert_addr_type_to_string(addr, address->addr);
-
        BT_DBG("HF Client Disconnection remote device [%s]", addr);
 
        /* Find Async request information*/
@@ -61,6 +58,7 @@ static void __bt_reply_hf_client_disconnection_pending_request(bt_address_t *add
                        return;
                } else {
                        BT_DBG("HF Connect request found..reply this request");
+                       result = BLUETOOTH_ERROR_INTERNAL;
                }
        } else {
                BT_DBG("HF DisConnect request found..reply this request");
@@ -68,7 +66,7 @@ static void __bt_reply_hf_client_disconnection_pending_request(bt_address_t *add
 
        /* In any of the above cases, reply DBUS context */
        out_param = g_array_new(FALSE, FALSE, sizeof(gchar));
-       g_array_append_vals(out_param, &device_address, sizeof(bluetooth_device_address_t));
+       g_array_append_vals(out_param, addr, BT_ADDRESS_STRING_SIZE);
        _bt_service_method_return(req_info->context, out_param, result);
        g_array_free(out_param, TRUE);
        _bt_free_info_from_invocation_list(req_info);
@@ -77,16 +75,13 @@ static void __bt_reply_hf_client_disconnection_pending_request(bt_address_t *add
 static void __bt_reply_hf_client_connection_pending_request(bt_address_t *address)
 {
        char addr[BT_ADDRESS_STRING_SIZE] = { 0 };
-       bluetooth_device_address_t device_address;
        GArray *out_param;
        invocation_info_t *req_info;
        int result = BLUETOOTH_ERROR_NONE;
 
        ret_if(NULL == address);
 
-       memcpy(device_address.addr, address->addr, BLUETOOTH_ADDRESS_LENGTH);
        _bt_convert_addr_type_to_string(addr, address->addr);
-
        BT_DBG("HF Client Connection remote device [%s]", addr);
 
        /* Find Async request information*/
@@ -101,14 +96,12 @@ static void __bt_reply_hf_client_connection_pending_request(bt_address_t *addres
 
        /* In any of the above cases, reply DBUS context */
        out_param = g_array_new(FALSE, FALSE, sizeof(gchar));
-       g_array_append_vals(out_param, &device_address, sizeof(bluetooth_device_address_t));
+       g_array_append_vals(out_param, addr, BT_ADDRESS_STRING_SIZE);
        _bt_service_method_return(req_info->context, out_param, result);
        g_array_free(out_param, TRUE);
        _bt_free_info_from_invocation_list(req_info);
-
 }
 
-
 /* This event handler process events for HF Client role */
 void _bt_hf_client_event_handler(int oal_event, gpointer event_data)
 {