* Returns void
*
******************************************************************************/
-void avct_l2c_config_cfm_cback(uint16_t lcid, uint16_t result) {
+void avct_l2c_config_cfm_cback(uint16_t lcid, uint16_t initiator) {
tAVCT_LCB* p_lcb;
/* look up lcb for this channel */
* Returns void
*
******************************************************************************/
-void avct_l2c_br_config_cfm_cback(uint16_t lcid, uint16_t result) {
+void avct_l2c_br_config_cfm_cback(uint16_t lcid, uint16_t initiator) {
tAVCT_BCB* p_lcb;
/* look up lcb for this channel */
* Returns void
*
******************************************************************************/
-void avdt_l2c_config_cfm_cback(uint16_t lcid, uint16_t result) {
+void avdt_l2c_config_cfm_cback(uint16_t lcid, uint16_t initiator) {
AvdtpTransportChannel* p_tbl;
AVDT_TRACE_DEBUG("%s: lcid: %d", __func__, lcid);
* Returns void
*
******************************************************************************/
-static void bnep_config_cfm(uint16_t l2cap_cid, uint16_t result) {
+static void bnep_config_cfm(uint16_t l2cap_cid, uint16_t initiator) {
tBNEP_CONN* p_bcb;
BNEP_TRACE_EVENT("BNEP - Rcvd cfg cfm, CID: 0x%x", l2cap_cid);
* Returns void
*
******************************************************************************/
-static void gap_config_cfm(uint16_t l2cap_cid, uint16_t result) {
+static void gap_config_cfm(uint16_t l2cap_cid, uint16_t initiator) {
tGAP_CCB* p_ccb;
/* Find CCB based on CID */
}
/** This is the L2CAP config confirm callback function */
-void gatt_l2cif_config_cfm_cback(uint16_t lcid, uint16_t result) {
+void gatt_l2cif_config_cfm_cback(uint16_t lcid, uint16_t initiator) {
/* look up clcb for this channel */
tGATT_TCB* p_tcb = gatt_find_tcb_by_cid(lcid);
if (!p_tcb) return;
* Returns void
*
******************************************************************************/
-static void hidd_l2cif_config_cfm(uint16_t cid, uint16_t result) {
+static void hidd_l2cif_config_cfm(uint16_t cid, uint16_t initiator) {
tHID_CONN* p_hcon;
HIDD_TRACE_EVENT("%s: cid=%04x", __func__, cid);
* Returns void
*
******************************************************************************/
-static void hidh_l2cif_config_cfm(uint16_t l2cap_cid, uint16_t result) {
+static void hidh_l2cif_config_cfm(uint16_t l2cap_cid, uint16_t initiator) {
uint8_t dhandle;
tHID_CONN* p_hcon = NULL;
uint32_t reason;
*/
typedef void(tL2CA_CONFIG_IND_CB)(uint16_t, tL2CAP_CFG_INFO*);
+constexpr uint16_t L2CAP_INITIATOR_LOCAL = 1;
+constexpr uint16_t L2CAP_INITIATOR_REMOTE = 0;
/* Configuration confirm callback prototype. Parameters are
* Local CID assigned to the connection
- * Config result (L2CA_CONN_OK)
- * If there is an error, tL2CA_ERROR_CB is invoked
+ * Initiator (1 for local, 0 for remote)
+ * If there is an error, tL2CA_ERROR_CB is invoked
*/
typedef void(tL2CA_CONFIG_CFM_CB)(uint16_t, uint16_t);
/* Save registration info */
p_ccb->p_rcb = p_rcb;
+ p_ccb->connection_initiator = L2CAP_INITIATOR_LOCAL;
+
/* If link is up, start the L2CAP connection */
if (p_lcb->link_state == LST_CONNECTED) {
l2c_csm_execute(p_ccb, L2CEVT_L2CA_CONNECT_REQ, nullptr);
/* Save registration info */
p_ccb->p_rcb = p_rcb;
+ p_ccb->connection_initiator = L2CAP_INITIATOR_LOCAL;
+
/* Save the configuration */
if (p_cfg) {
p_ccb->local_conn_cfg = *p_cfg;
p_ccb->is_first_seg = true;
p_ccb->peer_cfg.fcr.mode = L2CAP_FCR_LE_COC_MODE;
+ p_ccb->connection_initiator = L2CAP_INITIATOR_REMOTE;
+
l2c_csm_execute(p_ccb, L2CEVT_L2CAP_CONNECT_REQ, &con_info);
break;
if (p_ccb->config_done & OB_CFG_DONE) {
if (p_ccb->remote_config_rsp_result == L2CAP_CFG_OK) {
(*p_ccb->p_rcb->api.pL2CA_ConfigCfm_Cb)(
- p_ccb->local_cid, p_ccb->remote_config_rsp_result);
+ p_ccb->local_cid, p_ccb->connection_initiator);
} else {
(*p_ccb->p_rcb->api.pL2CA_Error_Cb)(p_ccb->local_cid,
L2CAP_CFG_FAILED_NO_REASON);
p_ccb->remote_config_rsp_result = p_cfg->result;
if (p_ccb->config_done & IB_CFG_DONE) {
(*p_ccb->p_rcb->api.pL2CA_ConfigCfm_Cb)(p_ccb->local_cid,
- p_cfg->result);
+ p_ccb->connection_initiator);
}
break;
#define CCB_FLAG_SENT_PENDING 0x02 /* already sent pending response */
uint8_t flags;
+ bool connection_initiator; /* true if we sent ConnectReq */
+
tL2CAP_CFG_INFO our_cfg; /* Our saved configuration options */
tL2CAP_CFG_INFO peer_cfg; /* Peer's saved configuration options */
p_ccb->remote_id = id;
p_ccb->p_rcb = p_rcb;
p_ccb->remote_cid = rcid;
+ p_ccb->connection_initiator = L2CAP_INITIATOR_REMOTE;
if (p_rcb->psm == BT_PSM_RFCOMM) {
btsnoop_get_interface()->add_rfc_l2c_channel(
* event to the FSM.
*
******************************************************************************/
-void RFCOMM_ConfigCnf(uint16_t lcid, uint16_t result) {
+void RFCOMM_ConfigCnf(uint16_t lcid, uint16_t initiator) {
tRFC_MCB* p_mcb = rfc_find_lcid_mcb(lcid);
if (!p_mcb) {
RFCOMM_TRACE_ERROR("RFCOMM_ConfigCnf no MCB LCID:0x%x", lcid);
return;
}
- uintptr_t result_as_ptr = result;
+ uintptr_t result_as_ptr = L2CAP_CFG_OK;
rfc_mx_sm_execute(p_mcb, RFC_MX_EVENT_CONF_CNF, (void*)result_as_ptr);
}
* Returns void
*
******************************************************************************/
-static void sdp_config_cfm(uint16_t l2cap_cid, uint16_t result) {
+static void sdp_config_cfm(uint16_t l2cap_cid, uint16_t initiator) {
tCONN_CB* p_ccb;
SDP_TRACE_EVENT("SDP - Rcvd cfg cfm, CID: 0x%x", l2cap_cid);