Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 75bc73a5 authored by Chris Manton's avatar Chris Manton
Browse files

stack::l2cap [9/19] L2CA_RegisterFixedChannel

Bug: 339732512
Test: m .
Flag: EXEMPT, Logging Change

Change-Id: Icff9977e1d3282273f4d9a821a96df036ab6f46c
parent 91c5b953
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -130,7 +130,9 @@ void gatt_init(void) {
  // clients exist
  fixed_reg.default_idle_tout = L2CAP_NO_IDLE_TIMEOUT;

  L2CA_RegisterFixedChannel(L2CAP_ATT_CID, &fixed_reg);
  if (!L2CA_RegisterFixedChannel(L2CAP_ATT_CID, &fixed_reg)) {
    log::error("Unable to register L2CAP ATT fixed channel");
  }

  gatt_cb.over_br_enabled =
      osi_property_get_bool("bluetooth.gatt.over_bredr.enabled", true);
+13 −3
Original line number Diff line number Diff line
@@ -74,12 +74,19 @@ void smp_l2cap_if_init(void) {
  fixed_reg.default_idle_tout =
      60; /* set 60 seconds timeout, 0xffff default idle timeout */

  L2CA_RegisterFixedChannel(L2CAP_SMP_CID, &fixed_reg);
  if (!L2CA_RegisterFixedChannel(L2CAP_SMP_CID, &fixed_reg)) {
    log::error("Unable to register with L2CAP fixed channel profile SMP psm:{}",
               L2CAP_SMP_CID);
  }

  fixed_reg.pL2CA_FixedConn_Cb = smp_br_connect_callback;
  fixed_reg.pL2CA_FixedData_Cb = smp_br_data_received;

  L2CA_RegisterFixedChannel(L2CAP_SMP_BR_CID, &fixed_reg);
  if (!L2CA_RegisterFixedChannel(L2CAP_SMP_BR_CID, &fixed_reg)) {
    log::error(
        "Unable to register with L2CAP fixed channel profile SMP_BR psm:{}",
        L2CAP_SMP_BR_CID);
  }
}

/*******************************************************************************
@@ -208,7 +215,10 @@ static void smp_data_received(uint16_t channel, const RawAddress& bd_addr,
    smp_int_data.p_data = p;
    smp_sm_event(p_cb, static_cast<tSMP_EVENT>(cmd), &smp_int_data);
  } else {
    L2CA_RemoveFixedChnl(channel, bd_addr);
    if (!L2CA_RemoveFixedChnl(channel, bd_addr)) {
      log::error("Unable to remove fixed channel peer:{} cid:{}", bd_addr,
                 channel);
    }
  }

  osi_free(p_buf);