static void btm_esco_conn_rsp(uint16_t sco_inx, uint8_t hci_status,
const RawAddress& bda,
enh_esco_params_t* p_parms) {
-#if (BTM_MAX_SCO_LINKS > 0)
tSCO_CONN* p_sco = NULL;
+ if (BTM_MAX_SCO_LINKS == 0) return;
+
if (sco_inx < BTM_MAX_SCO_LINKS) p_sco = &btm_cb.sco_cb.sco_db[sco_inx];
/* Reject the connect request if refused by caller or wrong state */
p_setup->retransmission_effort, p_setup->packet_types);
}
}
-#endif
}
/*******************************************************************************
return (BTM_NO_RESOURCES);
}
-#if (BTM_MAX_SCO_LINKS > 0)
/*******************************************************************************
*
* Function btm_send_connect_request
return (BTM_CMD_STARTED);
}
-#endif
/*******************************************************************************
*
******************************************************************************/
void btm_accept_sco_link(uint16_t sco_inx, enh_esco_params_t* p_setup,
tBTM_SCO_CB* p_conn_cb, tBTM_SCO_CB* p_disc_cb) {
-#if (BTM_MAX_SCO_LINKS > 0)
tSCO_CONN* p_sco;
+ if (BTM_MAX_SCO_LINKS == 0) {
+ btm_reject_sco_link(sco_inx);
+ return;
+ }
+
if (sco_inx >= BTM_MAX_SCO_LINKS) {
BTM_TRACE_ERROR("btm_accept_sco_link: Invalid sco_inx(%d)", sco_inx);
return;
BTM_TRACE_DEBUG("TCS accept SCO: Packet Types 0x%04x", p_setup->packet_types);
btm_esco_conn_rsp(sco_inx, HCI_SUCCESS, p_sco->esco.data.bd_addr, p_setup);
-#else
- btm_reject_sco_link(sco_inx);
-#endif
}
/*******************************************************************************
tBTM_STATUS BTM_CreateSco(const RawAddress* remote_bda, bool is_orig,
uint16_t pkt_types, uint16_t* p_sco_inx,
tBTM_SCO_CB* p_conn_cb, tBTM_SCO_CB* p_disc_cb) {
-#if (BTM_MAX_SCO_LINKS > 0)
enh_esco_params_t* p_setup;
tSCO_CONN* p = &btm_cb.sco_cb.sco_db[0];
uint16_t xx;
uint16_t acl_handle = 0;
*p_sco_inx = BTM_INVALID_SCO_INDEX;
+ if (BTM_MAX_SCO_LINKS == 0) {
+ return BTM_NO_RESOURCES;
+ }
+
/* If originating, ensure that there is an ACL connection to the BD Address */
if (is_orig) {
}
}
-#endif
/* If here, all SCO blocks in use */
LOG(ERROR) << __func__ << ": all SCO control blocks are in use";
return BTM_NO_RESOURCES;
*
******************************************************************************/
void btm_sco_chk_pend_unpark(uint8_t hci_status, uint16_t hci_handle) {
-#if (BTM_MAX_SCO_LINKS > 0)
tSCO_CONN* p = &btm_cb.sco_cb.sco_db[0];
for (uint16_t xx = 0; xx < BTM_MAX_SCO_LINKS; xx++, p++) {
uint16_t acl_handle =
}
}
}
-#endif // BTM_MAX_SCO_LINKS
}
/*******************************************************************************
*
******************************************************************************/
void btm_sco_chk_pend_rolechange(uint16_t hci_handle) {
-#if (BTM_MAX_SCO_LINKS > 0)
uint16_t xx;
uint16_t acl_handle;
tSCO_CONN* p = &btm_cb.sco_cb.sco_db[0];
p->state = SCO_ST_CONNECTING;
}
}
-#endif
}
/*******************************************************************************
*
******************************************************************************/
void btm_sco_disc_chk_pend_for_modechange(uint16_t hci_handle) {
-#if (BTM_MAX_SCO_LINKS > 0)
tSCO_CONN* p = &btm_cb.sco_cb.sco_db[0];
BTM_TRACE_DEBUG("%s: hci_handle 0x%04x, p->state 0x%02x", __func__,
BTM_RemoveSco(xx);
}
}
-#endif
}
/*******************************************************************************
******************************************************************************/
void btm_sco_conn_req(const RawAddress& bda, DEV_CLASS dev_class,
uint8_t link_type) {
-#if (BTM_MAX_SCO_LINKS > 0)
tSCO_CB* p_sco = &btm_cb.sco_cb;
tSCO_CONN* p = &p_sco->sco_db[0];
tBTM_ESCO_CONN_REQ_EVT_DATA evt_data = {};
}
}
-#endif
/* If here, no one wants the SCO connection. Reject it */
BTM_TRACE_WARNING("%s: rejecting SCO for %s", __func__,
bda.ToString().c_str());
******************************************************************************/
void btm_sco_connected(uint8_t hci_status, const RawAddress* bda,
uint16_t hci_handle, tBTM_ESCO_DATA* p_esco_data) {
-#if (BTM_MAX_SCO_LINKS > 0)
tSCO_CONN* p = &btm_cb.sco_cb.sco_db[0];
uint16_t xx;
bool spt = false;
tBTM_CHG_ESCO_PARAMS parms = {};
-#endif
btm_cb.sco_cb.sco_disc_reason = hci_status;
-#if (BTM_MAX_SCO_LINKS > 0)
for (xx = 0; xx < BTM_MAX_SCO_LINKS; xx++, p++) {
if (((p->state == SCO_ST_CONNECTING) || (p->state == SCO_ST_LISTENING) ||
(p->state == SCO_ST_W4_CONN_RSP)) &&
return;
}
}
-#endif
}
/*******************************************************************************
*
******************************************************************************/
tBTM_STATUS BTM_RemoveSco(uint16_t sco_inx) {
-#if (BTM_MAX_SCO_LINKS > 0)
tSCO_CONN* p = &btm_cb.sco_cb.sco_db[sco_inx];
uint16_t tempstate;
tBTM_PM_STATE state = BTM_PM_ST_INVALID;
BTM_TRACE_DEBUG("%s", __func__);
+ if (BTM_MAX_SCO_LINKS == 0) {
+ return BTM_NO_RESOURCES;
+ }
+
/* Validity check */
if ((sco_inx >= BTM_MAX_SCO_LINKS) || (p->state == SCO_ST_UNUSED))
return (BTM_UNKNOWN_ADDR);
btsnd_hcic_disconnect(p->hci_handle, HCI_ERR_PEER_USER);
return (BTM_CMD_STARTED);
-#else
- return (BTM_NO_RESOURCES);
-#endif
}
void BTM_RemoveSco(const RawAddress& bda) {
-#if (BTM_MAX_SCO_LINKS > 0)
tSCO_CONN* p = &btm_cb.sco_cb.sco_db[0];
uint16_t xx;
BTM_RemoveSco(xx);
}
}
-#endif
}
/*******************************************************************************
*
******************************************************************************/
bool btm_sco_removed(uint16_t hci_handle, uint8_t reason) {
-#if (BTM_MAX_SCO_LINKS > 0)
tSCO_CONN* p = &btm_cb.sco_cb.sco_db[0];
uint16_t xx;
return true;
}
}
-#endif
return false;
}
*
******************************************************************************/
void btm_sco_acl_removed(const RawAddress* bda) {
-#if (BTM_MAX_SCO_LINKS > 0)
tSCO_CONN* p = &btm_cb.sco_cb.sco_db[0];
uint16_t xx;
}
}
}
-#endif
}
/*******************************************************************************
*
******************************************************************************/
const RawAddress* BTM_ReadScoBdAddr(uint16_t sco_inx) {
-#if (BTM_MAX_SCO_LINKS > 0)
tSCO_CONN* p = &btm_cb.sco_cb.sco_db[sco_inx];
/* Validity check */
return &(p->esco.data.bd_addr);
else
return (NULL);
-#else
- return (NULL);
-#endif
}
/*******************************************************************************
******************************************************************************/
tBTM_STATUS BTM_RegForEScoEvts(uint16_t sco_inx,
tBTM_ESCO_CBACK* p_esco_cback) {
-#if (BTM_MAX_SCO_LINKS > 0)
+ if (BTM_MAX_SCO_LINKS == 0) {
+ return BTM_MODE_UNSUPPORTED;
+ }
+
if (!btm_cb.sco_cb.esco_supported) {
btm_cb.sco_cb.sco_db[sco_inx].esco.p_esco_cback = NULL;
return (BTM_MODE_UNSUPPORTED);
return (BTM_SUCCESS);
}
return (BTM_ILLEGAL_VALUE);
-#else
- return (BTM_MODE_UNSUPPORTED);
-#endif
}
/*******************************************************************************
******************************************************************************/
tBTM_STATUS BTM_ChangeEScoLinkParms(uint16_t sco_inx,
tBTM_CHG_ESCO_PARAMS* p_parms) {
-#if (BTM_MAX_SCO_LINKS > 0)
+ if (BTM_MAX_SCO_LINKS == 0) {
+ return BTM_WRONG_MODE;
+ }
/* Make sure sco handle is valid and on an active link */
if (sco_inx >= BTM_MAX_SCO_LINKS ||
}
return (BTM_CMD_STARTED);
-#else
- return (BTM_WRONG_MODE);
-#endif
}
/*******************************************************************************
******************************************************************************/
void BTM_EScoConnRsp(uint16_t sco_inx, uint8_t hci_status,
enh_esco_params_t* p_parms) {
-#if (BTM_MAX_SCO_LINKS > 0)
if (sco_inx < BTM_MAX_SCO_LINKS &&
btm_cb.sco_cb.sco_db[sco_inx].state == SCO_ST_W4_CONN_RSP) {
btm_esco_conn_rsp(sco_inx, hci_status,
btm_cb.sco_cb.sco_db[sco_inx].esco.data.bd_addr, p_parms);
}
-#endif
}
/*******************************************************************************
void btm_esco_proc_conn_chg(uint8_t status, uint16_t handle,
uint8_t tx_interval, uint8_t retrans_window,
uint16_t rx_pkt_len, uint16_t tx_pkt_len) {
-#if (BTM_MAX_SCO_LINKS > 0)
tSCO_CONN* p = &btm_cb.sco_cb.sco_db[0];
tBTM_CHG_ESCO_EVT_DATA data;
uint16_t xx;
return;
}
}
-#endif
}
/*******************************************************************************
*
******************************************************************************/
bool btm_is_sco_active(uint16_t handle) {
-#if (BTM_MAX_SCO_LINKS > 0)
uint16_t xx;
tSCO_CONN* p = &btm_cb.sco_cb.sco_db[0];
for (xx = 0; xx < BTM_MAX_SCO_LINKS; xx++, p++) {
if (handle == p->hci_handle && p->state == SCO_ST_CONNECTED) return (true);
}
-#endif
return (false);
}
*
******************************************************************************/
uint8_t BTM_GetNumScoLinks(void) {
-#if (BTM_MAX_SCO_LINKS > 0)
tSCO_CONN* p = &btm_cb.sco_cb.sco_db[0];
uint16_t xx;
uint8_t num_scos = 0;
}
}
return (num_scos);
-#else
- return (0);
-#endif
}
/*******************************************************************************
*
******************************************************************************/
bool BTM_IsScoActiveByBdaddr(const RawAddress& remote_bda) {
-#if (BTM_MAX_SCO_LINKS > 0)
uint8_t xx;
tSCO_CONN* p = &btm_cb.sco_cb.sco_db[0];
return (true);
}
}
-#endif
return (false);
}