mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-22 15:40:16 +00:00
hsp ag: emit HSP_SUBEVENT_BUTTON_PRESSED instead of audio connection setup/release
This commit is contained in:
parent
fcf88f47f1
commit
d04d6ac3e2
@ -56,6 +56,7 @@ Nordic SPP Service Server: use `GATTSERVICE_SUBEVENT_SPP_SERVICE_CONNECTED` and
|
||||
events instead of callback, and `RFCOMM_DATA_PACKET` for received data
|
||||
u-blox SPP Service Server: use `GATTSERVICE_SUBEVENT_SPP_SERVICE_CONNECTED` and `GATTSERVICE_SUBEVENT_SPP_SERVICE_CONNECTED`
|
||||
events instead of callback, and `RFCOMM_DATA_PACKET` for received data
|
||||
HSP AG: emit HSP_SUBEVENT_BUTTON_PRESSED instead of audio connection setup/release
|
||||
|
||||
## Release v1.3.2
|
||||
|
||||
|
@ -248,6 +248,15 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even
|
||||
printf("Received custom command: \"%s\". \nExit code or call hsp_ag_send_result.\n", hs_cmd_buffer);
|
||||
break;
|
||||
}
|
||||
case HSP_SUBEVENT_BUTTON_PRESSED:
|
||||
if (sco_handle == HCI_CON_HANDLE_INVALID){
|
||||
printf("Button event -> establish audio\n");
|
||||
hsp_ag_establish_audio_connection();
|
||||
} else {
|
||||
printf("Button event -> release audio\n");
|
||||
hsp_ag_release_audio_connection();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf("event not handled %u\n", event[2]);
|
||||
break;
|
||||
|
@ -1502,6 +1502,11 @@ typedef uint8_t sm_key_t[16];
|
||||
*/
|
||||
#define HSP_SUBEVENT_AG_INDICATION 0x09
|
||||
|
||||
/**
|
||||
* @format 1
|
||||
* @param subevent_code
|
||||
*/
|
||||
#define HSP_SUBEVENT_BUTTON_PRESSED 0x0a
|
||||
|
||||
/** HFP Subevent */
|
||||
|
||||
|
@ -524,16 +524,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
if (strncmp((char *)packet, HSP_HS_BUTTON_PRESS, strlen(HSP_HS_BUTTON_PRESS)) == 0){
|
||||
log_info("Received button press %s", HSP_HS_BUTTON_PRESS);
|
||||
ag_send_ok = 1;
|
||||
switch (hsp_state){
|
||||
case HSP_AUDIO_CONNECTION_ESTABLISHED:
|
||||
hsp_release_audio_connection = 1;
|
||||
break;
|
||||
case HSP_RFCOMM_CONNECTION_ESTABLISHED:
|
||||
hsp_state = HSP_W2_CONNECT_SCO;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
emit_event(HSP_SUBEVENT_BUTTON_PRESSED, 0);
|
||||
} else if (strncmp((char *)packet, HSP_HS_MICROPHONE_GAIN, strlen(HSP_HS_MICROPHONE_GAIN)) == 0){
|
||||
uint8_t gain = (uint8_t)btstack_atoi((char*)&packet[strlen(HSP_HS_MICROPHONE_GAIN)]);
|
||||
ag_send_ok = 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user