Bluetooth Classic
Bluedroid
The following Bluedroid APIs have been changed:
/bt/host/bluedroid/api/include/api/esp_hf_defs.h
Type
esp_hf_wbs_config_tis replaced byesp_hf_codec_mode_t. The new type identifies the negotiated codec (CVSD, mSBC, or LC3-SWB), not a Wideband Speech on/off flag.esp_hf_wbs_config_tis kept as a deprecated alias ofesp_hf_codec_mode_t.Enumerators are renamed. Numeric values 0 / 1 / 2 are unchanged. The old
ESP_HF_WBS_*names remain as macros that alias the new enumerators:
Old enumerator
New enumerator
Value
ESP_HF_WBS_NONE
ESP_HF_CODEC_NONE0
ESP_HF_WBS_NO
ESP_HF_CODEC_CVSD1
ESP_HF_WBS_YES
ESP_HF_CODEC_MSBC2
—
ESP_HF_CODEC_LC33
Existing
switchstatements and comparisons that useESP_HF_WBS_NOorESP_HF_WBS_YESstill compile. Prefer the new names in new code.
ESP_HF_CODEC_NONEmeans no codec has been negotiated, or the preference is reset to the stack default. It does not mean that CVSD is unavailable.ESP_HF_CODEC_CVSDis the selected narrowband codec, whether Wideband Speech is unsupported, disabled, or the link fell back from mSBC / LC3.
ESP_HF_CODEC_LC3is new. Code that indexes a three-entry table with the codec value must add an LC3 entry or a default branch.Do not use
esp_hf_codec_mode_tas a capability bitmap. Peer codec capabilities are reported separately asESP_HF_CODEC_CAP_CVSD/ESP_HF_CODEC_CAP_MSBC/ESP_HF_CODEC_CAP_LC3inESP_HF_BAC_RESPONSE_EVT.Audio connection state
ESP_HF_AUDIO_STATE_CONNECTED_LC3is added for an established LC3-SWB link, alongside the existingESP_HF_AUDIO_STATE_CONNECTED(CVSD) andESP_HF_AUDIO_STATE_CONNECTED_MSBCvalues./bt/host/bluedroid/api/include/api/esp_hf_ag_api.h
esp_hf_ag_set_codec()now takesesp_hf_codec_mode_t. PassESP_HF_CODEC_CVSD,ESP_HF_CODEC_MSBC,ESP_HF_CODEC_LC3, orESP_HF_CODEC_NONEto restore the stack default.
ESP_HF_WBS_RESPONSE_EVT(wbs_rep): fieldcodecis nowesp_hf_codec_mode_t. The field namecodecis unchanged. Astatusfield (esp_bt_status_t) is added to report whether the request succeeded.
ESP_HF_BCS_RESPONSE_EVT(bcs_rep): fieldmodeis nowesp_hf_codec_mode_t. The field namemodeis unchanged.Suggested replacements:
// Before esp_hf_ag_set_codec(bda, ESP_HF_WBS_YES); if (param->bcs_rep.mode == ESP_HF_WBS_NO) { /* CVSD */ } // After esp_hf_ag_set_codec(bda, ESP_HF_CODEC_MSBC); if (param->bcs_rep.mode == ESP_HF_CODEC_CVSD) { /* CVSD */ } else if (param->bcs_rep.mode == ESP_HF_CODEC_LC3) { /* LC3-SWB */ }