******************************************************************************/
void l2cble_notify_le_connection(const RawAddress& bda) {
tL2C_LCB* p_lcb = l2cu_find_lcb_by_bd_addr(bda, BT_TRANSPORT_LE);
- tL2C_CCB* p_ccb;
+ if (p_lcb == nullptr) {
+ LOG_WARN("Received notification for le connection but no lcb found");
+ return;
+ }
- if (p_lcb != NULL && BTM_IsAclConnectionUp(bda, BT_TRANSPORT_LE) &&
+ if (BTM_IsAclConnectionUp(bda, BT_TRANSPORT_LE) &&
p_lcb->link_state != LST_CONNECTED) {
/* update link status */
+ // TODO Move this back into acl layer
btm_establish_continue_from_address(bda, BT_TRANSPORT_LE);
/* update l2cap link status and send callback */
p_lcb->link_state = LST_CONNECTED;
l2cu_process_fixed_chnl_resp(p_lcb);
}
- if (p_lcb != NULL) {
- /* For all channels, send the event through their FSMs */
- for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb;
- p_ccb = p_ccb->p_next_ccb) {
- if (p_ccb->chnl_state == CST_CLOSED)
- l2c_csm_execute(p_ccb, L2CEVT_LP_CONNECT_CFM, NULL);
- }
+ /* For all channels, send the event through their FSMs */
+ for (tL2C_CCB* p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb;
+ p_ccb = p_ccb->p_next_ccb) {
+ if (p_ccb->chnl_state == CST_CLOSED)
+ l2c_csm_execute(p_ccb, L2CEVT_LP_CONNECT_CFM, NULL);
}
}