mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-16 08:42:28 +00:00
example/hfp_hf_demo: support lc3-swb
This commit is contained in:
parent
5a5b7bc7b0
commit
d0452d6c2c
@ -81,40 +81,34 @@ static void show_usage(void);
|
|||||||
#endif
|
#endif
|
||||||
static hci_con_handle_t acl_handle = HCI_CON_HANDLE_INVALID;
|
static hci_con_handle_t acl_handle = HCI_CON_HANDLE_INVALID;
|
||||||
static hci_con_handle_t sco_handle = HCI_CON_HANDLE_INVALID;
|
static hci_con_handle_t sco_handle = HCI_CON_HANDLE_INVALID;
|
||||||
|
|
||||||
|
static uint8_t codecs[] = {
|
||||||
|
HFP_CODEC_CVSD,
|
||||||
#ifdef ENABLE_HFP_WIDE_BAND_SPEECH
|
#ifdef ENABLE_HFP_WIDE_BAND_SPEECH
|
||||||
static uint8_t codecs[] = {HFP_CODEC_CVSD, HFP_CODEC_MSBC};
|
HFP_CODEC_MSBC,
|
||||||
#else
|
|
||||||
static uint8_t codecs[] = {HFP_CODEC_CVSD};
|
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef ENABLE_HFP_SUPER_WIDE_BAND_SPEECH
|
||||||
|
HFP_CODEC_LC3_SWB,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
static uint16_t indicators[1] = {0x01};
|
static uint16_t indicators[1] = {0x01};
|
||||||
static uint8_t negotiated_codec = HFP_CODEC_CVSD;
|
static uint8_t negotiated_codec = HFP_CODEC_CVSD;
|
||||||
static btstack_packet_callback_registration_t hci_event_callback_registration;
|
static btstack_packet_callback_registration_t hci_event_callback_registration;
|
||||||
static char cmd;
|
static char cmd;
|
||||||
|
|
||||||
static void dump_supported_codecs(void){
|
static void dump_supported_codecs(void){
|
||||||
unsigned int i;
|
printf("Supported codecs: CVSD");
|
||||||
int mSBC_skipped = 0;
|
if (hci_extended_sco_link_supported()) {
|
||||||
printf("Supported codecs: ");
|
#ifdef ENABLE_HFP_WIDE_BAND_SPEECH
|
||||||
for (i = 0; i < sizeof(codecs); i++){
|
printf(", mSBC");
|
||||||
switch(codecs[i]){
|
#endif
|
||||||
case HFP_CODEC_CVSD:
|
#ifdef ENABLE_HFP_SUPER_WIDE_BAND_SPEECH
|
||||||
printf("CVSD");
|
printf(", LC3-SWB");
|
||||||
break;
|
#endif
|
||||||
case HFP_CODEC_MSBC:
|
printf("\n");
|
||||||
if (hci_extended_sco_link_supported()){
|
} else {
|
||||||
printf(", mSBC");
|
printf("\nmSBC and/or LC3-SWB disabled as eSCO not supported by local controller.\n");
|
||||||
} else {
|
|
||||||
mSBC_skipped = 1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
btstack_assert(false);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
if (mSBC_skipped){
|
|
||||||
printf("mSBC codec disabled because eSCO not supported by local controller.\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -548,12 +542,15 @@ static void hfp_hf_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t
|
|||||||
printf("Audio connection established with SCO handle 0x%04x.\n", sco_handle);
|
printf("Audio connection established with SCO handle 0x%04x.\n", sco_handle);
|
||||||
negotiated_codec = hfp_subevent_audio_connection_established_get_negotiated_codec(event);
|
negotiated_codec = hfp_subevent_audio_connection_established_get_negotiated_codec(event);
|
||||||
switch (negotiated_codec){
|
switch (negotiated_codec){
|
||||||
case 0x01:
|
case HFP_CODEC_CVSD:
|
||||||
printf("Using CVSD codec.\n");
|
printf("Using CVSD codec.\n");
|
||||||
break;
|
break;
|
||||||
case 0x02:
|
case HFP_CODEC_MSBC:
|
||||||
printf("Using mSBC codec.\n");
|
printf("Using mSBC codec.\n");
|
||||||
break;
|
break;
|
||||||
|
case HFP_CODEC_LC3_SWB:
|
||||||
|
printf("Using LC3-SWB codec.\n");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
printf("Using unknown codec 0x%02x.\n", negotiated_codec);
|
printf("Using unknown codec 0x%02x.\n", negotiated_codec);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user