hfp_ag.c (323d300063a7e0193cf61fbe114062cf000a3fe5) | hfp_ag.c (ca59be5193cced59664efef288ea86d02eaef3a4) |
---|---|
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 --- 84 unchanged lines hidden (view full) --- 93static int hfp_ag_indicators_nr = 0; 94static hfp_ag_indicator_t hfp_ag_indicators[HFP_MAX_NUM_AG_INDICATORS]; 95 96static int hfp_generic_status_indicators_nr = 0; 97static hfp_generic_status_indicator_t hfp_generic_status_indicators[HFP_MAX_NUM_HF_INDICATORS]; 98 99static int hfp_ag_call_hold_services_nr = 0; 100static char *hfp_ag_call_hold_services[6]; | 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 --- 84 unchanged lines hidden (view full) --- 93static int hfp_ag_indicators_nr = 0; 94static hfp_ag_indicator_t hfp_ag_indicators[HFP_MAX_NUM_AG_INDICATORS]; 95 96static int hfp_generic_status_indicators_nr = 0; 97static hfp_generic_status_indicator_t hfp_generic_status_indicators[HFP_MAX_NUM_HF_INDICATORS]; 98 99static int hfp_ag_call_hold_services_nr = 0; 100static char *hfp_ag_call_hold_services[6]; |
101static btstack_packet_handler_t hfp_callback; | 101static btstack_packet_handler_t hfp_ag_callback; |
102 103static hfp_response_and_hold_state_t hfp_ag_response_and_hold_state; 104static int hfp_ag_response_and_hold_active = 0; 105 106// Subcriber information entries 107static hfp_phone_number_t * subscriber_numbers = NULL; 108static int subscriber_numbers_count = 0; 109 --- 39 unchanged lines hidden (view full) --- 149} 150 151 152void hfp_ag_register_packet_handler(btstack_packet_handler_t callback){ 153 if (callback == NULL){ 154 log_error("hfp_ag_register_packet_handler called with NULL callback"); 155 return; 156 } | 102 103static hfp_response_and_hold_state_t hfp_ag_response_and_hold_state; 104static int hfp_ag_response_and_hold_active = 0; 105 106// Subcriber information entries 107static hfp_phone_number_t * subscriber_numbers = NULL; 108static int subscriber_numbers_count = 0; 109 --- 39 unchanged lines hidden (view full) --- 149} 150 151 152void hfp_ag_register_packet_handler(btstack_packet_handler_t callback){ 153 if (callback == NULL){ 154 log_error("hfp_ag_register_packet_handler called with NULL callback"); 155 return; 156 } |
157 hfp_callback = callback; 158 hfp_set_callback(callback); | 157 hfp_ag_callback = callback; 158 hfp_set_ag_callback(callback); |
159} 160 161static int use_in_band_tone(void){ 162 return get_bit(hfp_supported_features, HFP_AGSF_IN_BAND_RING_TONE); 163} 164 165static int has_codec_negotiation_feature(hfp_connection_t * hfp_connection){ 166 int hf = get_bit(hfp_connection->remote_supported_features, HFP_HFSF_CODEC_NEGOTIATION); --- 427 unchanged lines hidden (view full) --- 594 default: 595 break; 596 } 597 return 0; 598} 599 600static void hfp_ag_slc_established(hfp_connection_t * hfp_connection){ 601 hfp_connection->state = HFP_SERVICE_LEVEL_CONNECTION_ESTABLISHED; | 159} 160 161static int use_in_band_tone(void){ 162 return get_bit(hfp_supported_features, HFP_AGSF_IN_BAND_RING_TONE); 163} 164 165static int has_codec_negotiation_feature(hfp_connection_t * hfp_connection){ 166 int hf = get_bit(hfp_connection->remote_supported_features, HFP_HFSF_CODEC_NEGOTIATION); --- 427 unchanged lines hidden (view full) --- 594 default: 595 break; 596 } 597 return 0; 598} 599 600static void hfp_ag_slc_established(hfp_connection_t * hfp_connection){ 601 hfp_connection->state = HFP_SERVICE_LEVEL_CONNECTION_ESTABLISHED; |
602 hfp_emit_slc_connection_event(hfp_callback, 0, hfp_connection->acl_handle, hfp_connection->remote_addr); | 602 hfp_emit_slc_connection_event(hfp_connection, 0, hfp_connection->acl_handle, hfp_connection->remote_addr); |
603 604 // if active call exist, set per-hfp_connection state active, too (when audio is on) 605 if (hfp_gsm_call_status() == HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT){ 606 hfp_connection->call_state = HFP_CALL_W4_AUDIO_CONNECTION_FOR_ACTIVE; 607 } 608 // if AG is ringing, also start ringing on the HF 609 if (hfp_gsm_call_status() == HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS && 610 hfp_gsm_callsetup_status() == HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS){ --- 234 unchanged lines hidden (view full) --- 845 if (use_in_band_tone()){ 846 hfp_connection->call_state = HFP_CALL_W4_AUDIO_CONNECTION_FOR_IN_BAND_RING; 847 hfp_ag_establish_audio_connection(hfp_connection->acl_handle); 848 } else { 849 hfp_timeout_start(hfp_connection); 850 hfp_connection->ag_ring = 1; 851 hfp_connection->ag_send_clip = hfp_gsm_clip_type() && hfp_connection->clip_enabled; 852 hfp_connection->call_state = HFP_CALL_RINGING; | 603 604 // if active call exist, set per-hfp_connection state active, too (when audio is on) 605 if (hfp_gsm_call_status() == HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT){ 606 hfp_connection->call_state = HFP_CALL_W4_AUDIO_CONNECTION_FOR_ACTIVE; 607 } 608 // if AG is ringing, also start ringing on the HF 609 if (hfp_gsm_call_status() == HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS && 610 hfp_gsm_callsetup_status() == HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS){ --- 234 unchanged lines hidden (view full) --- 845 if (use_in_band_tone()){ 846 hfp_connection->call_state = HFP_CALL_W4_AUDIO_CONNECTION_FOR_IN_BAND_RING; 847 hfp_ag_establish_audio_connection(hfp_connection->acl_handle); 848 } else { 849 hfp_timeout_start(hfp_connection); 850 hfp_connection->ag_ring = 1; 851 hfp_connection->ag_send_clip = hfp_gsm_clip_type() && hfp_connection->clip_enabled; 852 hfp_connection->call_state = HFP_CALL_RINGING; |
853 hfp_emit_simple_event(hfp_callback, HFP_SUBEVENT_START_RINGINIG); | 853 hfp_emit_simple_event(hfp_connection, HFP_SUBEVENT_START_RINGINIG); |
854 } 855} 856 857static void hfp_ag_hf_stop_ringing(hfp_connection_t * hfp_connection){ 858 hfp_connection->ag_ring = 0; 859 hfp_connection->ag_send_clip = 0; 860 hfp_timeout_stop(hfp_connection); | 854 } 855} 856 857static void hfp_ag_hf_stop_ringing(hfp_connection_t * hfp_connection){ 858 hfp_connection->ag_ring = 0; 859 hfp_connection->ag_send_clip = 0; 860 hfp_timeout_stop(hfp_connection); |
861 hfp_emit_simple_event(hfp_callback, HFP_SUBEVENT_STOP_RINGINIG); | 861 hfp_emit_simple_event(hfp_connection, HFP_SUBEVENT_STOP_RINGINIG); |
862} 863 864static void hfp_ag_trigger_incoming_call(void){ 865 int indicator_index = get_ag_indicator_index_for_name("callsetup"); 866 if (indicator_index < 0) return; 867 868 btstack_linked_list_iterator_t it; 869 btstack_linked_list_iterator_init(&it, hfp_get_connections()); --- 118 unchanged lines hidden (view full) --- 988 connection->call_state != HFP_CALL_W4_AUDIO_CONNECTION_FOR_IN_BAND_RING) continue; 989 hfp_ag_hf_stop_ringing(connection); 990 connection->ag_indicators_status_update_bitmap = store_bit(connection->ag_indicators_status_update_bitmap, callsetup_indicator_index, 1); 991 connection->call_state = HFP_CALL_IDLE; 992 hfp_run_for_context(connection); 993 } 994} 995 | 862} 863 864static void hfp_ag_trigger_incoming_call(void){ 865 int indicator_index = get_ag_indicator_index_for_name("callsetup"); 866 if (indicator_index < 0) return; 867 868 btstack_linked_list_iterator_t it; 869 btstack_linked_list_iterator_init(&it, hfp_get_connections()); --- 118 unchanged lines hidden (view full) --- 988 connection->call_state != HFP_CALL_W4_AUDIO_CONNECTION_FOR_IN_BAND_RING) continue; 989 hfp_ag_hf_stop_ringing(connection); 990 connection->ag_indicators_status_update_bitmap = store_bit(connection->ag_indicators_status_update_bitmap, callsetup_indicator_index, 1); 991 connection->call_state = HFP_CALL_IDLE; 992 hfp_run_for_context(connection); 993 } 994} 995 |
996static void hfp_ag_emit_simple_event(uint8_t event_subtype){ 997 uint8_t event[3]; 998 event[0] = HCI_EVENT_HFP_META; 999 event[1] = sizeof(event) - 2; 1000 event[2] = event_subtype; 1001 if (!hfp_ag_callback) return; 1002 (*hfp_ag_callback)(HCI_EVENT_PACKET, 0, event, sizeof(event)); 1003} 1004 |
|
996static void hfp_ag_trigger_terminate_call(void){ 997 int call_indicator_index = get_ag_indicator_index_for_name("call"); 998 999 btstack_linked_list_iterator_t it; 1000 btstack_linked_list_iterator_init(&it, hfp_get_connections()); 1001 while (btstack_linked_list_iterator_has_next(&it)){ 1002 hfp_connection_t * hfp_connection = (hfp_connection_t *)btstack_linked_list_iterator_next(&it); 1003 hfp_ag_establish_service_level_connection(hfp_connection->remote_addr); 1004 if (hfp_connection->call_state == HFP_CALL_IDLE) continue; 1005 hfp_connection->call_state = HFP_CALL_IDLE; 1006 hfp_connection->ag_indicators_status_update_bitmap = store_bit(hfp_connection->ag_indicators_status_update_bitmap, call_indicator_index, 1); 1007 hfp_connection->release_audio_connection = 1; 1008 hfp_run_for_context(hfp_connection); 1009 } | 1005static void hfp_ag_trigger_terminate_call(void){ 1006 int call_indicator_index = get_ag_indicator_index_for_name("call"); 1007 1008 btstack_linked_list_iterator_t it; 1009 btstack_linked_list_iterator_init(&it, hfp_get_connections()); 1010 while (btstack_linked_list_iterator_has_next(&it)){ 1011 hfp_connection_t * hfp_connection = (hfp_connection_t *)btstack_linked_list_iterator_next(&it); 1012 hfp_ag_establish_service_level_connection(hfp_connection->remote_addr); 1013 if (hfp_connection->call_state == HFP_CALL_IDLE) continue; 1014 hfp_connection->call_state = HFP_CALL_IDLE; 1015 hfp_connection->ag_indicators_status_update_bitmap = store_bit(hfp_connection->ag_indicators_status_update_bitmap, call_indicator_index, 1); 1016 hfp_connection->release_audio_connection = 1; 1017 hfp_run_for_context(hfp_connection); 1018 } |
1010 hfp_emit_simple_event(hfp_callback, HFP_SUBEVENT_CALL_TERMINATED); | 1019 hfp_ag_emit_simple_event(HFP_SUBEVENT_CALL_TERMINATED); |
1011} 1012 1013static void hfp_ag_set_callsetup_indicator(void){ 1014 hfp_ag_indicator_t * indicator = get_ag_indicator_for_name("callsetup"); 1015 if (!indicator){ 1016 log_error("hfp_ag_set_callsetup_indicator: callsetup indicator is missing"); 1017 return; 1018 }; --- 54 unchanged lines hidden (view full) --- 1073 case HFP_CALL_W4_AUDIO_CONNECTION_FOR_IN_BAND_RING: 1074 if (hfp_connection->state != HFP_AUDIO_CONNECTION_ESTABLISHED) return 0; 1075 // we got event: audio hfp_connection established 1076 hfp_timeout_start(hfp_connection); 1077 hfp_connection->ag_ring = 1; 1078 hfp_connection->ag_send_clip = hfp_gsm_clip_type() && hfp_connection->clip_enabled; 1079 hfp_connection->call_state = HFP_CALL_RINGING; 1080 hfp_connection->call_state = HFP_CALL_RINGING; | 1020} 1021 1022static void hfp_ag_set_callsetup_indicator(void){ 1023 hfp_ag_indicator_t * indicator = get_ag_indicator_for_name("callsetup"); 1024 if (!indicator){ 1025 log_error("hfp_ag_set_callsetup_indicator: callsetup indicator is missing"); 1026 return; 1027 }; --- 54 unchanged lines hidden (view full) --- 1082 case HFP_CALL_W4_AUDIO_CONNECTION_FOR_IN_BAND_RING: 1083 if (hfp_connection->state != HFP_AUDIO_CONNECTION_ESTABLISHED) return 0; 1084 // we got event: audio hfp_connection established 1085 hfp_timeout_start(hfp_connection); 1086 hfp_connection->ag_ring = 1; 1087 hfp_connection->ag_send_clip = hfp_gsm_clip_type() && hfp_connection->clip_enabled; 1088 hfp_connection->call_state = HFP_CALL_RINGING; 1089 hfp_connection->call_state = HFP_CALL_RINGING; |
1081 hfp_emit_simple_event(hfp_callback, HFP_SUBEVENT_START_RINGINIG); | 1090 hfp_emit_simple_event(hfp_connection, HFP_SUBEVENT_START_RINGINIG); |
1082 break; 1083 case HFP_CALL_W4_AUDIO_CONNECTION_FOR_ACTIVE: 1084 if (hfp_connection->state != HFP_AUDIO_CONNECTION_ESTABLISHED) return 0; 1085 // we got event: audio hfp_connection established 1086 hfp_connection->call_state = HFP_CALL_ACTIVE; 1087 break; 1088 case HFP_CALL_W2_SEND_CALL_WAITING: 1089 hfp_connection->call_state = HFP_CALL_W4_CHLD; --- 79 unchanged lines hidden (view full) --- 1169 switch (hfp_gsm_call_status()){ 1170 case HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT: 1171 switch (hfp_gsm_callheld_status()){ 1172 case HFP_CALLHELD_STATUS_CALL_ON_HOLD_OR_SWAPPED: 1173 log_info("AG: joining held call with active call"); 1174 hfp_gsm_handle_event(HFP_AG_HELD_CALL_JOINED_BY_AG); 1175 hfp_ag_set_callheld_indicator(); 1176 hfp_ag_transfer_callheld_state(); | 1091 break; 1092 case HFP_CALL_W4_AUDIO_CONNECTION_FOR_ACTIVE: 1093 if (hfp_connection->state != HFP_AUDIO_CONNECTION_ESTABLISHED) return 0; 1094 // we got event: audio hfp_connection established 1095 hfp_connection->call_state = HFP_CALL_ACTIVE; 1096 break; 1097 case HFP_CALL_W2_SEND_CALL_WAITING: 1098 hfp_connection->call_state = HFP_CALL_W4_CHLD; --- 79 unchanged lines hidden (view full) --- 1178 switch (hfp_gsm_call_status()){ 1179 case HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT: 1180 switch (hfp_gsm_callheld_status()){ 1181 case HFP_CALLHELD_STATUS_CALL_ON_HOLD_OR_SWAPPED: 1182 log_info("AG: joining held call with active call"); 1183 hfp_gsm_handle_event(HFP_AG_HELD_CALL_JOINED_BY_AG); 1184 hfp_ag_set_callheld_indicator(); 1185 hfp_ag_transfer_callheld_state(); |
1177 hfp_emit_simple_event(hfp_callback, HFP_SUBEVENT_CONFERENCE_CALL); | 1186 hfp_emit_simple_event(hfp_connection, HFP_SUBEVENT_CONFERENCE_CALL); |
1178 break; 1179 default: 1180 break; 1181 } 1182 break; 1183 default: 1184 break; 1185 } --- 4 unchanged lines hidden (view full) --- 1190 case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS: 1191 switch (hfp_gsm_callsetup_status()){ 1192 case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS: 1193 hfp_gsm_handle_event(HFP_AG_INCOMING_CALL_ACCEPTED_BY_HF); 1194 hfp_ag_set_callsetup_indicator(); 1195 hfp_ag_set_call_indicator(); 1196 hfp_ag_hf_accept_call(hfp_connection); 1197 log_info("HF answers call, accept call by GSM"); | 1187 break; 1188 default: 1189 break; 1190 } 1191 break; 1192 default: 1193 break; 1194 } --- 4 unchanged lines hidden (view full) --- 1199 case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS: 1200 switch (hfp_gsm_callsetup_status()){ 1201 case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS: 1202 hfp_gsm_handle_event(HFP_AG_INCOMING_CALL_ACCEPTED_BY_HF); 1203 hfp_ag_set_callsetup_indicator(); 1204 hfp_ag_set_call_indicator(); 1205 hfp_ag_hf_accept_call(hfp_connection); 1206 log_info("HF answers call, accept call by GSM"); |
1198 hfp_emit_simple_event(hfp_callback, HFP_SUBEVENT_CALL_ANSWERED); | 1207 hfp_emit_simple_event(hfp_connection, HFP_SUBEVENT_CALL_ANSWERED); |
1199 break; 1200 default: 1201 break; 1202 } 1203 break; 1204 default: 1205 break; 1206 } --- 171 unchanged lines hidden (view full) --- 1378 hfp_connection->send_error = 1; 1379 hfp_run_for_context(hfp_connection); 1380 break; 1381 } 1382 hfp_gsm_handle_event_with_call_number(HFP_AG_OUTGOING_CALL_INITIATED, (const char *) &hfp_connection->line_buffer[3]); 1383 1384 hfp_connection->call_state = HFP_CALL_OUTGOING_INITIATED; 1385 | 1208 break; 1209 default: 1210 break; 1211 } 1212 break; 1213 default: 1214 break; 1215 } --- 171 unchanged lines hidden (view full) --- 1387 hfp_connection->send_error = 1; 1388 hfp_run_for_context(hfp_connection); 1389 break; 1390 } 1391 hfp_gsm_handle_event_with_call_number(HFP_AG_OUTGOING_CALL_INITIATED, (const char *) &hfp_connection->line_buffer[3]); 1392 1393 hfp_connection->call_state = HFP_CALL_OUTGOING_INITIATED; 1394 |
1386 hfp_emit_string_event(hfp_callback, HFP_SUBEVENT_PLACE_CALL_WITH_NUMBER, (const char *) &hfp_connection->line_buffer[3]); | 1395 hfp_emit_string_event(hfp_connection, HFP_SUBEVENT_PLACE_CALL_WITH_NUMBER, (const char *) &hfp_connection->line_buffer[3]); |
1387 break; 1388 1389 case HFP_AG_OUTGOING_REDIAL_INITIATED:{ 1390 // directly reject call if number of free slots is exceeded 1391 if (!hfp_gsm_call_possible()){ 1392 hfp_connection->send_error = 1; 1393 hfp_run_for_context(hfp_connection); 1394 break; 1395 } 1396 1397 hfp_gsm_handle_event(HFP_AG_OUTGOING_REDIAL_INITIATED); 1398 hfp_connection->call_state = HFP_CALL_OUTGOING_INITIATED; 1399 1400 log_info("Redial last number"); 1401 char * last_dialed_number = hfp_gsm_last_dialed_number(); 1402 1403 if (strlen(last_dialed_number) > 0){ 1404 log_info("Last number exists: accept call"); | 1396 break; 1397 1398 case HFP_AG_OUTGOING_REDIAL_INITIATED:{ 1399 // directly reject call if number of free slots is exceeded 1400 if (!hfp_gsm_call_possible()){ 1401 hfp_connection->send_error = 1; 1402 hfp_run_for_context(hfp_connection); 1403 break; 1404 } 1405 1406 hfp_gsm_handle_event(HFP_AG_OUTGOING_REDIAL_INITIATED); 1407 hfp_connection->call_state = HFP_CALL_OUTGOING_INITIATED; 1408 1409 log_info("Redial last number"); 1410 char * last_dialed_number = hfp_gsm_last_dialed_number(); 1411 1412 if (strlen(last_dialed_number) > 0){ 1413 log_info("Last number exists: accept call"); |
1405 hfp_emit_string_event(hfp_callback, HFP_SUBEVENT_PLACE_CALL_WITH_NUMBER, last_dialed_number); | 1414 hfp_emit_string_event(hfp_connection, HFP_SUBEVENT_PLACE_CALL_WITH_NUMBER, last_dialed_number); |
1406 } else { 1407 log_info("log_infoLast number missing: reject call"); 1408 hfp_ag_outgoing_call_rejected(); 1409 } 1410 break; 1411 } 1412 case HFP_AG_OUTGOING_CALL_REJECTED: 1413 hfp_connection = hfp_ag_connection_for_call_state(HFP_CALL_OUTGOING_INITIATED); --- 133 unchanged lines hidden (view full) --- 1547 1548 case HFP_AG_CALL_HOLD_ADD_HELD_CALL: 1549 // Adds a held call to the conversation. 1550 if (hfp_gsm_callheld_status() != HFP_CALLHELD_STATUS_NO_CALLS_HELD){ 1551 log_info("AG: Join 3-way-call"); 1552 hfp_gsm_handle_event(HFP_AG_CALL_HOLD_ADD_HELD_CALL); 1553 hfp_ag_set_callheld_indicator(); 1554 hfp_connection->ag_indicators_status_update_bitmap = store_bit(hfp_connection->ag_indicators_status_update_bitmap, callheld_indicator_index, 1); | 1415 } else { 1416 log_info("log_infoLast number missing: reject call"); 1417 hfp_ag_outgoing_call_rejected(); 1418 } 1419 break; 1420 } 1421 case HFP_AG_OUTGOING_CALL_REJECTED: 1422 hfp_connection = hfp_ag_connection_for_call_state(HFP_CALL_OUTGOING_INITIATED); --- 133 unchanged lines hidden (view full) --- 1556 1557 case HFP_AG_CALL_HOLD_ADD_HELD_CALL: 1558 // Adds a held call to the conversation. 1559 if (hfp_gsm_callheld_status() != HFP_CALLHELD_STATUS_NO_CALLS_HELD){ 1560 log_info("AG: Join 3-way-call"); 1561 hfp_gsm_handle_event(HFP_AG_CALL_HOLD_ADD_HELD_CALL); 1562 hfp_ag_set_callheld_indicator(); 1563 hfp_connection->ag_indicators_status_update_bitmap = store_bit(hfp_connection->ag_indicators_status_update_bitmap, callheld_indicator_index, 1); |
1555 hfp_emit_simple_event(hfp_callback, HFP_SUBEVENT_CONFERENCE_CALL); | 1564 hfp_emit_simple_event(hfp_connection, HFP_SUBEVENT_CONFERENCE_CALL); |
1556 } 1557 hfp_connection->call_state = HFP_CALL_ACTIVE; 1558 break; 1559 case HFP_AG_CALL_HOLD_EXIT_AND_JOIN_CALLS: 1560 // Connects the two calls and disconnects the subscriber from both calls (Explicit Call Transfer) 1561 hfp_gsm_handle_event(HFP_AG_CALL_HOLD_EXIT_AND_JOIN_CALLS); 1562 log_info("AG: Transfer call -> Connect two calls and disconnect"); 1563 hfp_ag_set_call_indicator(); --- 317 unchanged lines hidden (view full) --- 1881 hfp_ag_send_ok(hfp_connection->rfcomm_cid); 1882 break; 1883 } 1884 hfp_connection->next_subscriber_number_to_send = 0; 1885 hfp_connection->send_subscriber_number = 1; 1886 break; 1887 case HFP_CMD_TRANSMIT_DTMF_CODES: 1888 hfp_connection->command = HFP_CMD_NONE; | 1565 } 1566 hfp_connection->call_state = HFP_CALL_ACTIVE; 1567 break; 1568 case HFP_AG_CALL_HOLD_EXIT_AND_JOIN_CALLS: 1569 // Connects the two calls and disconnects the subscriber from both calls (Explicit Call Transfer) 1570 hfp_gsm_handle_event(HFP_AG_CALL_HOLD_EXIT_AND_JOIN_CALLS); 1571 log_info("AG: Transfer call -> Connect two calls and disconnect"); 1572 hfp_ag_set_call_indicator(); --- 317 unchanged lines hidden (view full) --- 1890 hfp_ag_send_ok(hfp_connection->rfcomm_cid); 1891 break; 1892 } 1893 hfp_connection->next_subscriber_number_to_send = 0; 1894 hfp_connection->send_subscriber_number = 1; 1895 break; 1896 case HFP_CMD_TRANSMIT_DTMF_CODES: 1897 hfp_connection->command = HFP_CMD_NONE; |
1889 hfp_emit_string_event(hfp_callback, HFP_SUBEVENT_TRANSMIT_DTMF_CODES, (const char *) &hfp_connection->line_buffer[0]); | 1898 hfp_emit_string_event(hfp_connection, HFP_SUBEVENT_TRANSMIT_DTMF_CODES, (const char *) &hfp_connection->line_buffer[0]); |
1890 break; 1891 case HFP_CMD_HF_REQUEST_PHONE_NUMBER: 1892 hfp_connection->command = HFP_CMD_NONE; | 1899 break; 1900 case HFP_CMD_HF_REQUEST_PHONE_NUMBER: 1901 hfp_connection->command = HFP_CMD_NONE; |
1893 hfp_emit_simple_event(hfp_callback, HFP_SUBEVENT_ATTACH_NUMBER_TO_VOICE_TAG); | 1902 hfp_emit_simple_event(hfp_connection, HFP_SUBEVENT_ATTACH_NUMBER_TO_VOICE_TAG); |
1894 break; 1895 case HFP_CMD_TURN_OFF_EC_AND_NR: 1896 hfp_connection->command = HFP_CMD_NONE; 1897 if (get_bit(hfp_supported_features, HFP_AGSF_EC_NR_FUNCTION)){ 1898 hfp_connection->ok_pending = 1; 1899 hfp_supported_features = store_bit(hfp_supported_features, HFP_AGSF_EC_NR_FUNCTION, hfp_connection->ag_echo_and_noise_reduction); 1900 log_info("AG: EC/NR = %u", hfp_connection->ag_echo_and_noise_reduction); 1901 } else { --- 155 unchanged lines hidden (view full) --- 2057 hci_add_event_handler(&hci_event_callback_registration); 2058 2059 rfcomm_register_service(&packet_handler, rfcomm_channel_nr, 0xffff); 2060 2061 hfp_ag_response_and_hold_active = 0; 2062 subscriber_numbers = NULL; 2063 subscriber_numbers_count = 0; 2064 | 1903 break; 1904 case HFP_CMD_TURN_OFF_EC_AND_NR: 1905 hfp_connection->command = HFP_CMD_NONE; 1906 if (get_bit(hfp_supported_features, HFP_AGSF_EC_NR_FUNCTION)){ 1907 hfp_connection->ok_pending = 1; 1908 hfp_supported_features = store_bit(hfp_supported_features, HFP_AGSF_EC_NR_FUNCTION, hfp_connection->ag_echo_and_noise_reduction); 1909 log_info("AG: EC/NR = %u", hfp_connection->ag_echo_and_noise_reduction); 1910 } else { --- 155 unchanged lines hidden (view full) --- 2066 hci_add_event_handler(&hci_event_callback_registration); 2067 2068 rfcomm_register_service(&packet_handler, rfcomm_channel_nr, 0xffff); 2069 2070 hfp_ag_response_and_hold_active = 0; 2071 subscriber_numbers = NULL; 2072 subscriber_numbers_count = 0; 2073 |
2065 hfp_set_packet_handler_for_rfcomm_connections(&packet_handler); | 2074 hfp_set_ag_rfcomm_packet_handler(&packet_handler); |
2066 2067 hfp_gsm_init(); 2068} 2069 2070void hfp_ag_establish_service_level_connection(bd_addr_t bd_addr){ 2071 hfp_establish_service_level_connection(bd_addr, BLUETOOTH_SERVICE_CLASS_HANDSFREE, HFP_ROLE_AG); 2072} 2073 --- 275 unchanged lines hidden --- | 2075 2076 hfp_gsm_init(); 2077} 2078 2079void hfp_ag_establish_service_level_connection(bd_addr_t bd_addr){ 2080 hfp_establish_service_level_connection(bd_addr, BLUETOOTH_SERVICE_CLASS_HANDSFREE, HFP_ROLE_AG); 2081} 2082 --- 275 unchanged lines hidden --- |