example/hsp: update examples

This commit is contained in:
Matthias Ringwald 2021-11-29 14:43:11 +01:00
parent b956b515b1
commit 2e3335af42
2 changed files with 5 additions and 15 deletions

View File

@ -217,19 +217,14 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even
#endif #endif
break; break;
case HSP_SUBEVENT_RFCOMM_DISCONNECTION_COMPLETE: case HSP_SUBEVENT_RFCOMM_DISCONNECTION_COMPLETE:
status = hsp_subevent_rfcomm_disconnection_complete_get_status(event); printf("RFCOMM disconnected.\n");
if (status != ERROR_CODE_SUCCESS){
printf("RFCOMM disconnection failed with status %u.\n", status);
} else {
printf("RFCOMM disconnected.\n");
}
break; break;
case HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE: case HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE:
status = hsp_subevent_audio_connection_complete_get_status(event); status = hsp_subevent_audio_connection_complete_get_status(event);
if (status != ERROR_CODE_SUCCESS){ if (status != ERROR_CODE_SUCCESS){
printf("Audio connection establishment failed with status %u\n", status); printf("Audio connection establishment failed with status %u\n", status);
} else { } else {
sco_handle = hsp_subevent_audio_connection_complete_get_handle(event); sco_handle = hsp_subevent_audio_connection_complete_get_sco_handle(event);
printf("Audio connection established with SCO handle 0x%04x.\n", sco_handle); printf("Audio connection established with SCO handle 0x%04x.\n", sco_handle);
hci_request_sco_can_send_now_event(); hci_request_sco_can_send_now_event();
} }

View File

@ -198,25 +198,20 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even
case HSP_SUBEVENT_RFCOMM_CONNECTION_COMPLETE: case HSP_SUBEVENT_RFCOMM_CONNECTION_COMPLETE:
status = hsp_subevent_rfcomm_connection_complete_get_status(event); status = hsp_subevent_rfcomm_connection_complete_get_status(event);
if (status != ERROR_CODE_SUCCESS){ if (status != ERROR_CODE_SUCCESS){
printf("RFCOMM connection establishement failed with status %u\n", status); printf("RFCOMM connection establishment failed with status %u\n", status);
} else { } else {
printf("RFCOMM connection established.\n"); printf("RFCOMM connection established.\n");
} }
break; break;
case HSP_SUBEVENT_RFCOMM_DISCONNECTION_COMPLETE: case HSP_SUBEVENT_RFCOMM_DISCONNECTION_COMPLETE:
status = hsp_subevent_rfcomm_disconnection_complete_get_status(event); printf("RFCOMM disconnected.\n");
if (status != ERROR_CODE_SUCCESS){
printf("RFCOMM disconnection failed with status %u.\n", status);
} else {
printf("RFCOMM disconnected.\n");
}
break; break;
case HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE: case HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE:
status = hsp_subevent_audio_connection_complete_get_status(event); status = hsp_subevent_audio_connection_complete_get_status(event);
if (status != ERROR_CODE_SUCCESS){ if (status != ERROR_CODE_SUCCESS){
printf("Audio connection establishment failed with status %u\n", status); printf("Audio connection establishment failed with status %u\n", status);
} else { } else {
sco_handle = hsp_subevent_audio_connection_complete_get_handle(event); sco_handle = hsp_subevent_audio_connection_complete_get_sco_handle(event);
printf("Audio connection established with SCO handle 0x%04x.\n", sco_handle); printf("Audio connection established with SCO handle 0x%04x.\n", sco_handle);
hci_request_sco_can_send_now_event(); hci_request_sco_can_send_now_event();
} }