Loading system/stack/btm/btm_sco.cc +18 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ #include "osi/include/allocator.h" #include "osi/include/log.h" #include "osi/include/osi.h" #include "stack/btm/btm_sco_hfp_hal.h" #include "stack/btm/btm_sec.h" #include "stack/btm/security_device_record.h" #include "stack/include/acl_api.h" Loading Loading @@ -763,6 +764,11 @@ void btm_sco_connected(const RawAddress& bda, uint16_t hci_handle, (*p->p_conn_cb)(xx); hfp_hal_interface::notify_sco_connection_change( bda, /*is_connected=*/true, hfp_hal_interface::esco_coding_to_codec( p->esco.setup.transmit_coding_format.coding_format)); bluetooth::audio::sco::open(); return; Loading Loading @@ -917,11 +923,18 @@ bool btm_sco_removed(uint16_t hci_handle, tHCI_REASON reason) { for (xx = 0; xx < BTM_MAX_SCO_LINKS; xx++, p++) { if ((p->state != SCO_ST_UNUSED) && (p->state != SCO_ST_LISTENING) && (p->hci_handle == hci_handle)) { RawAddress bda(p->esco.data.bd_addr); p->state = SCO_ST_UNUSED; p->hci_handle = HCI_INVALID_HANDLE; p->rem_bd_known = false; p->esco.p_esco_cback = NULL; /* Deregister eSCO callback */ (*p->p_disc_cb)(xx); hfp_hal_interface::notify_sco_connection_change( bda, /*is_connected=*/false, hfp_hal_interface::esco_coding_to_codec( p->esco.setup.transmit_coding_format.coding_format)); LOG_DEBUG("Disconnected SCO link handle:%hu reason:%s", hci_handle, hci_reason_code_text(reason).c_str()); return true; Loading Loading @@ -976,6 +989,11 @@ void btm_sco_on_disconnected(uint16_t hci_handle, tHCI_REASON reason) { base::StringPrintf("handle:0x%04x reason:%s", hci_handle, hci_reason_code_text(reason).c_str())); hfp_hal_interface::notify_sco_connection_change( bd_addr, /*is_connected=*/false, hfp_hal_interface::esco_coding_to_codec( p_sco->esco.setup.transmit_coding_format.coding_format)); bluetooth::audio::sco::cleanup(); } Loading system/stack/btm/btm_sco_hfp_hal.h +15 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <vector> #include "bt_target.h" #include "device/include/esco_parameters.h" #include "raw_address.h" // Used by the Bluetooth stack to get WBS supported and codec, or notify SCO Loading Loading @@ -48,6 +49,20 @@ struct bt_codecs { // Use default packet size for codec if this value is given. constexpr int kDefaultPacketSize = 0; constexpr inline int esco_coding_to_codec(esco_coding_format_t esco_coding) { switch (esco_coding) { case ESCO_CODING_FORMAT_TRANSPNT: return codec::MSBC_TRANSPARENT; case ESCO_CODING_FORMAT_MSBC: return codec::MSBC; // Default to CVSD encoding if unknown format. case ESCO_CODING_FORMAT_CVSD: default: return codec::CVSD; } } // Initialize the SCO HFP HAL module void init(); Loading Loading
system/stack/btm/btm_sco.cc +18 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ #include "osi/include/allocator.h" #include "osi/include/log.h" #include "osi/include/osi.h" #include "stack/btm/btm_sco_hfp_hal.h" #include "stack/btm/btm_sec.h" #include "stack/btm/security_device_record.h" #include "stack/include/acl_api.h" Loading Loading @@ -763,6 +764,11 @@ void btm_sco_connected(const RawAddress& bda, uint16_t hci_handle, (*p->p_conn_cb)(xx); hfp_hal_interface::notify_sco_connection_change( bda, /*is_connected=*/true, hfp_hal_interface::esco_coding_to_codec( p->esco.setup.transmit_coding_format.coding_format)); bluetooth::audio::sco::open(); return; Loading Loading @@ -917,11 +923,18 @@ bool btm_sco_removed(uint16_t hci_handle, tHCI_REASON reason) { for (xx = 0; xx < BTM_MAX_SCO_LINKS; xx++, p++) { if ((p->state != SCO_ST_UNUSED) && (p->state != SCO_ST_LISTENING) && (p->hci_handle == hci_handle)) { RawAddress bda(p->esco.data.bd_addr); p->state = SCO_ST_UNUSED; p->hci_handle = HCI_INVALID_HANDLE; p->rem_bd_known = false; p->esco.p_esco_cback = NULL; /* Deregister eSCO callback */ (*p->p_disc_cb)(xx); hfp_hal_interface::notify_sco_connection_change( bda, /*is_connected=*/false, hfp_hal_interface::esco_coding_to_codec( p->esco.setup.transmit_coding_format.coding_format)); LOG_DEBUG("Disconnected SCO link handle:%hu reason:%s", hci_handle, hci_reason_code_text(reason).c_str()); return true; Loading Loading @@ -976,6 +989,11 @@ void btm_sco_on_disconnected(uint16_t hci_handle, tHCI_REASON reason) { base::StringPrintf("handle:0x%04x reason:%s", hci_handle, hci_reason_code_text(reason).c_str())); hfp_hal_interface::notify_sco_connection_change( bd_addr, /*is_connected=*/false, hfp_hal_interface::esco_coding_to_codec( p_sco->esco.setup.transmit_coding_format.coding_format)); bluetooth::audio::sco::cleanup(); } Loading
system/stack/btm/btm_sco_hfp_hal.h +15 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <vector> #include "bt_target.h" #include "device/include/esco_parameters.h" #include "raw_address.h" // Used by the Bluetooth stack to get WBS supported and codec, or notify SCO Loading Loading @@ -48,6 +49,20 @@ struct bt_codecs { // Use default packet size for codec if this value is given. constexpr int kDefaultPacketSize = 0; constexpr inline int esco_coding_to_codec(esco_coding_format_t esco_coding) { switch (esco_coding) { case ESCO_CODING_FORMAT_TRANSPNT: return codec::MSBC_TRANSPARENT; case ESCO_CODING_FORMAT_MSBC: return codec::MSBC; // Default to CVSD encoding if unknown format. case ESCO_CODING_FORMAT_CVSD: default: return codec::CVSD; } } // Initialize the SCO HFP HAL module void init(); Loading