diff --git a/include/btstack/hci_cmds.h b/include/btstack/hci_cmds.h index 05609c20c..850e4c8af 100644 --- a/include/btstack/hci_cmds.h +++ b/include/btstack/hci_cmds.h @@ -624,7 +624,6 @@ extern "C" { #define HSP_SUBEVENT_HS_COMMAND 0x05 #define HSP_SUBEVENT_AG_INDICATION 0x06 #define HSP_SUBEVENT_ERROR 0x07 -#define HSP_SUBEVENT_RING 0x08 #define HCI_EVENT_HFP_META 0xE9 @@ -647,6 +646,7 @@ extern "C" { #define HFP_SUBEVENT_TRANSMIT_STATUS_OF_CURRENT_CALL 0x11 #define HFP_SUBEVENT_CALL_ANSWERED 0x12 #define HFP_SUBEVENT_CONFERENCE_CALL 0x13 +#define HFP_SUBEVENT_RING 0x14 // ANCS Client #define ANCS_CLIENT_CONNECTED 0xF0 diff --git a/src/hfp.c b/src/hfp.c index 0047f12cb..96c15a96d 100644 --- a/src/hfp.c +++ b/src/hfp.c @@ -686,6 +686,10 @@ static hfp_command_t parse_command(const char * line_buffer, int isHandsFree){ return HFP_CMD_ERROR; } + if (strncmp(line_buffer+offset, HFP_RING, strlen(HFP_RING)) == 0){ + return HFP_CMD_RING; + } + if (isHandsFree && strncmp(line_buffer+offset, HFP_OK, strlen(HFP_OK)) == 0){ return HFP_CMD_OK; } diff --git a/src/hfp.h b/src/hfp.h index 8334aded2..b1d95c40e 100644 --- a/src/hfp.h +++ b/src/hfp.h @@ -137,6 +137,7 @@ extern "C" { #define HFP_OK "OK" #define HFP_ERROR "ERROR" +#define HFP_RING "RING" // Codecs #define HFP_CODEC_CVSD 0x01 @@ -147,6 +148,7 @@ typedef enum { HFP_CMD_ERROR, HFP_CMD_UNKNOWN, HFP_CMD_OK, + HFP_CMD_RING, HFP_CMD_SUPPORTED_FEATURES, HFP_CMD_AVAILABLE_CODECS, diff --git a/src/hfp_hf.c b/src/hfp_hf.c index 17770acfa..da8decaa8 100644 --- a/src/hfp_hf.c +++ b/src/hfp_hf.c @@ -647,6 +647,9 @@ static void hfp_handle_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8 case HFP_CMD_OK: hfp_hf_switch_on_ok(context); break; + case HFP_CMD_RING: + hfp_emit_event(hfp_callback, HFP_SUBEVENT_RING, 0); + break; default: break; } diff --git a/test/pts/hfp_hf_test.c b/test/pts/hfp_hf_test.c index 6d9781066..228403b3a 100644 --- a/test/pts/hfp_hf_test.c +++ b/test/pts/hfp_hf_test.c @@ -241,6 +241,9 @@ static void packet_handler(uint8_t * event, uint16_t event_size){ if (event[4]) printf("EXTENDED_AUDIO_GATEWAY_ERROR_REPORT, status : %d\n", event[3]); break; + case HFP_SUBEVENT_RING: + printf("** Ring **\n"); + break; default: printf("event not handled %u\n", event[2]); break;