extern UINT8 bta_ag_service_to_idx(tBTA_SERVICE_MASK services);
extern UINT16 bta_ag_idx_by_bdaddr(BD_ADDR peer_addr);
extern BOOLEAN bta_ag_other_scb_open(tBTA_AG_SCB *p_curr_scb);
+extern BOOLEAN bta_ag_scb_open(tBTA_AG_SCB *p_curr_scb);
extern tBTA_AG_SCB *bta_ag_get_other_idle_scb (tBTA_AG_SCB *p_curr_scb);
extern void bta_ag_sm_execute(tBTA_AG_SCB *p_scb, UINT16 event, tBTA_AG_DATA *p_data);
extern BOOLEAN bta_ag_hdl_event(BT_HDR *p_msg);
/*******************************************************************************
**
+** Function bta_ag_scb_open
+**
+** Description Check whether given scb is in open state.
+**
+**
+** Returns TRUE if scb is in open state, FALSE otherwise.
+**
+*******************************************************************************/
+BOOLEAN bta_ag_scb_open(tBTA_AG_SCB *p_curr_scb)
+{
+ if (p_curr_scb && p_curr_scb->in_use && p_curr_scb->state == BTA_AG_OPEN_ST)
+ {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/*******************************************************************************
+**
** Function bta_ag_get_other_idle_scb
**
** Description Return other scb if it is in INIT st.
p_sco->state = BTA_AG_SCO_LISTEN_ST;
}
+ /* If SCO closed for other HS which is not being disconnected,
+ then create listen sco connection for it as scb still open */
+ if (bta_ag_scb_open(p_scb))
+ {
+ APPL_TRACE_DEBUG0("create sco listen connection if scb still open");
+ bta_ag_create_sco(p_scb, FALSE);
+ p_sco->state = BTA_AG_SCO_LISTEN_ST;
+ }
+
if (p_scb == p_sco->p_curr_scb)
{
p_sco->p_curr_scb->sco_idx = BTM_INVALID_SCO_INDEX;