hfp.c (66093044dbeb77119c911c53a09f5c17e004da22) hfp.c (4431fb7a03a1045388efa00a89ccbb6cf203fec4)
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 1102 unchanged lines hidden (view full) ---

1111 }
1112
1113 hfp_connection->acl_handle = rfcomm_event_channel_opened_get_con_handle(packet);
1114 hfp_connection->rfcomm_cid = rfcomm_event_channel_opened_get_rfcomm_cid(packet);
1115 hfp_connection->rfcomm_mtu = rfcomm_event_channel_opened_get_max_frame_size(packet);
1116 bd_addr_copy(hfp_connection->remote_addr, event_addr);
1117 hfp_connection->state = HFP_EXCHANGE_SUPPORTED_FEATURES;
1118
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 1102 unchanged lines hidden (view full) ---

1111 }
1112
1113 hfp_connection->acl_handle = rfcomm_event_channel_opened_get_con_handle(packet);
1114 hfp_connection->rfcomm_cid = rfcomm_event_channel_opened_get_rfcomm_cid(packet);
1115 hfp_connection->rfcomm_mtu = rfcomm_event_channel_opened_get_max_frame_size(packet);
1116 bd_addr_copy(hfp_connection->remote_addr, event_addr);
1117 hfp_connection->state = HFP_EXCHANGE_SUPPORTED_FEATURES;
1118
1119 if (local_role == HFP_ROLE_HF) {
1120 // setup HF Indicators
1121 uint8_t i;
1122 for (i=0; i < hfp_hf_indicators_nr; i++){
1123 hfp_connection->generic_status_indicators[i].uuid = hfp_hf_indicators[i];
1124 hfp_connection->generic_status_indicators[i].state = 0;
1125 }
1126 }
1127
1119 rfcomm_request_can_send_now_event(hfp_connection->rfcomm_cid);
1120 break;
1121
1122 case RFCOMM_EVENT_CHANNEL_CLOSED:
1123 rfcomm_cid = little_endian_read_16(packet,2);
1124 hfp_connection = get_hfp_connection_context_for_rfcomm_cid(rfcomm_cid);
1125 if (!hfp_connection) break;
1126 switch (hfp_connection->state){

--- 761 unchanged lines hidden (view full) ---

1888 return BTSTACK_MEMORY_ALLOC_FAILED;
1889 }
1890
1891 connection->state = HFP_W2_SEND_SDP_QUERY;
1892
1893 bd_addr_copy(connection->remote_addr, bd_addr);
1894 connection->service_uuid = service_uuid;
1895
1128 rfcomm_request_can_send_now_event(hfp_connection->rfcomm_cid);
1129 break;
1130
1131 case RFCOMM_EVENT_CHANNEL_CLOSED:
1132 rfcomm_cid = little_endian_read_16(packet,2);
1133 hfp_connection = get_hfp_connection_context_for_rfcomm_cid(rfcomm_cid);
1134 if (!hfp_connection) break;
1135 switch (hfp_connection->state){

--- 761 unchanged lines hidden (view full) ---

1897 return BTSTACK_MEMORY_ALLOC_FAILED;
1898 }
1899
1900 connection->state = HFP_W2_SEND_SDP_QUERY;
1901
1902 bd_addr_copy(connection->remote_addr, bd_addr);
1903 connection->service_uuid = service_uuid;
1904
1896 if (local_role == HFP_ROLE_HF) {
1897 // setup HF Indicators
1898 uint8_t i;
1899 for (i=0; i < hfp_hf_indicators_nr; i++){
1900 connection->generic_status_indicators[i].uuid = hfp_hf_indicators[i];
1901 connection->generic_status_indicators[i].state = 0;
1902 }
1903 }
1904
1905 hfp_sdp_query_request.callback = &hfp_handle_start_sdp_client_query;
1906 // ignore ERROR_CODE_COMMAND_DISALLOWED because in that case, we already have requested an SDP callback
1907 (void) sdp_client_register_query_callback(&hfp_sdp_query_request);
1908 return ERROR_CODE_SUCCESS;
1909}
1910
1911void hfp_trigger_release_service_level_connection(hfp_connection_t * hfp_connection){
1912 // called internally, NULL check already performed

--- 566 unchanged lines hidden ---
1905 hfp_sdp_query_request.callback = &hfp_handle_start_sdp_client_query;
1906 // ignore ERROR_CODE_COMMAND_DISALLOWED because in that case, we already have requested an SDP callback
1907 (void) sdp_client_register_query_callback(&hfp_sdp_query_request);
1908 return ERROR_CODE_SUCCESS;
1909}
1910
1911void hfp_trigger_release_service_level_connection(hfp_connection_t * hfp_connection){
1912 // called internally, NULL check already performed

--- 566 unchanged lines hidden ---