diff --git a/example/hfp_ag_demo.c b/example/hfp_ag_demo.c index e2416a348..15d0d54b6 100644 --- a/example/hfp_ag_demo.c +++ b/example/hfp_ag_demo.c @@ -551,10 +551,13 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even sco_demo_close(); break; case HFP_SUBEVENT_START_RINGINIG: - printf("Start Ringing\n"); - break; + printf("** START Ringing **\n"); + break; + case HFP_SUBEVENT_RING: + printf("** Ring **\n"); + break; case HFP_SUBEVENT_STOP_RINGINIG: - printf("Stop Ringing\n"); + printf("** STOP Ringing **\n"); break; case HFP_SUBEVENT_PLACE_CALL_WITH_NUMBER: printf("Outgoing call '%s'\n", hfp_subevent_place_call_with_number_get_number(event)); diff --git a/src/classic/hfp_ag.c b/src/classic/hfp_ag.c index 293d709b3..6cace70c7 100644 --- a/src/classic/hfp_ag.c +++ b/src/classic/hfp_ag.c @@ -1083,10 +1083,10 @@ static void hfp_timeout_handler(btstack_timer_source_t * timer){ } static void hfp_timeout_start(hfp_connection_t * hfp_connection){ - btstack_run_loop_remove_timer(& hfp_connection->hfp_timeout); - btstack_run_loop_set_timer_handler(& hfp_connection->hfp_timeout, hfp_timeout_handler); - btstack_run_loop_set_timer(& hfp_connection->hfp_timeout, 2000); // 2 seconds timeout - btstack_run_loop_add_timer(& hfp_connection->hfp_timeout); + btstack_run_loop_remove_timer(&hfp_connection->hfp_timeout); + btstack_run_loop_set_timer_handler(&hfp_connection->hfp_timeout, hfp_timeout_handler); + btstack_run_loop_set_timer(&hfp_connection->hfp_timeout, 2000); // 2 seconds timeout + btstack_run_loop_add_timer(&hfp_connection->hfp_timeout); } static void hfp_timeout_stop(hfp_connection_t * hfp_connection){ @@ -1990,6 +1990,7 @@ static int hfp_ag_send_commands(hfp_connection_t *hfp_connection){ if (hfp_connection->ag_ring){ hfp_connection->ag_ring = 0; hfp_connection->command = HFP_CMD_NONE; + hfp_emit_simple_event(hfp_connection, HFP_SUBEVENT_RING); hfp_ag_send_ring(hfp_connection->rfcomm_cid); return 1; }