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

Commit 84dad1c3 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes I48e01da5,Ic6a7bff6,I9a568d60,Id1b5926a

* changes:
  Add stack/acl/btm_acl::link_policy_text
  Add stack/include/gatt_api::gatt_op_code_text
  Add API tL2C_LCB::number_of_active_dynamic_channels
  Add stack/l2cap/l2c_api::fixed_channel_text
parents c4e37137 ff915834
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@
#include "main/shim/dumpsys.h"
#include "main/shim/entry.h"
#include "main/shim/helpers.h"
#include "stack/acl/acl.h"
#include "stack/btm/btm_int_types.h"
#include "stack/include/acl_hci_link_interface.h"
#include "stack/include/ble_acl_interface.h"
@@ -477,7 +478,10 @@ void DumpsysAcl(int fd) {
                BtTransportText(acl_conn.transport).c_str());
    LOG_DUMPSYS(fd, "    flush_timeout:0x%04x",
                acl_conn.flush_timeout_in_ticks);
    LOG_DUMPSYS(fd, "    [classic] link_policy:0x%x", acl_conn.link_policy);
    LOG_DUMPSYS(
        fd, "    [classic] link_policy:%s",
        link_policy_text(static_cast<tLINK_POLICY>(acl_conn.link_policy))
            .c_str());
    LOG_DUMPSYS(fd, "    link_super_tout:0x%04x", acl_conn.link_super_tout);
    LOG_DUMPSYS(fd, "    pkt_types_mask:0x%04x", acl_conn.pkt_types_mask);
    LOG_DUMPSYS(fd, "    disconnect_reason:0x%02x", acl_conn.disconnect_reason);
+27 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#pragma once

#include <cstdint>
#include <string>

#include "stack/include/acl_api_types.h"
#include "stack/include/bt_types.h"
@@ -42,6 +43,32 @@ enum btm_acl_swkey_state_t {
  BTM_ACL_SWKEY_STATE_IN_PROGRESS = 5,
};

/* Policy settings status */
typedef enum : uint16_t {
  HCI_DISABLE_ALL_LM_MODES = 0,
  HCI_ENABLE_CENTRAL_PERIPHERAL_SWITCH = (1u << 0),
  HCI_ENABLE_HOLD_MODE = (1u << 1),
  HCI_ENABLE_SNIFF_MODE = (1u << 2),
  HCI_ENABLE_PARK_MODE = (1u << 3),
} tLINK_POLICY;

static const char* link_policy_string[] = {
    " role_switch ",
    " hold_mode ",
    " sniff_mode ",
    " park_mode ",
};

inline std::string link_policy_text(tLINK_POLICY policy) {
  std::ostringstream os;
  os << "0x" << loghex(static_cast<uint16_t>(policy)) << " :";
  std::string s = os.str();
  for (uint16_t i = 0; i < 4; i++) {
    if (policy & (0x1 << i)) s += link_policy_string[i];
  }
  return s;
}

/* Structure returned with Role Switch information (in tBTM_CMPL_CB callback
 * function) in response to BTM_SwitchRoleToCentral call.
 */
+0 −9
Original line number Diff line number Diff line
@@ -106,15 +106,6 @@ typedef struct {
       ? true                                                       \
       : false)

/* Policy settings status */
typedef enum : uint16_t {
  HCI_DISABLE_ALL_LM_MODES = 0,
  HCI_ENABLE_CENTRAL_PERIPHERAL_SWITCH = (1u << 0),
  HCI_ENABLE_HOLD_MODE = (1u << 1),
  HCI_ENABLE_SNIFF_MODE = (1u << 2),
  HCI_ENABLE_PARK_MODE = (1u << 3),
} tLINK_POLICY;

extern tBTM_CB btm_cb;

static void btm_acl_chk_peer_pkt_type_support(tACL_CONN* p,
+63 −0
Original line number Diff line number Diff line
@@ -115,6 +115,69 @@ typedef enum : uint8_t {
  GATT_OP_CODE_MAX = (GATT_HANDLE_VALUE_CONF + 1),
} tGATT_OP_CODE;

inline std::string gatt_op_code_text(const tGATT_OP_CODE& op_code) {
  switch (op_code) {
    case GATT_RSP_ERROR:
      return std::string("GATT_RSP_ERROR");
    case GATT_REQ_MTU:
      return std::string("GATT_REQ_MTU");
    case GATT_RSP_MTU:
      return std::string("GATT_RSP_MTU");
    case GATT_REQ_FIND_INFO:
      return std::string("GATT_REQ_FIND_INFO");
    case GATT_RSP_FIND_INFO:
      return std::string("GATT_RSP_FIND_INFO");
    case GATT_REQ_FIND_TYPE_VALUE:
      return std::string("GATT_REQ_FIND_TYPE_VALUE");
    case GATT_RSP_FIND_TYPE_VALUE:
      return std::string("GATT_RSP_FIND_TYPE_VALUE");
    case GATT_REQ_READ_BY_TYPE:
      return std::string("GATT_REQ_READ_BY_TYPE");
    case GATT_RSP_READ_BY_TYPE:
      return std::string("GATT_RSP_READ_BY_TYPE");
    case GATT_REQ_READ:
      return std::string("GATT_REQ_READ");
    case GATT_RSP_READ:
      return std::string("GATT_RSP_READ");
    case GATT_REQ_READ_BLOB:
      return std::string("GATT_REQ_READ_BLOB");
    case GATT_RSP_READ_BLOB:
      return std::string("GATT_RSP_READ_BLOB");
    case GATT_REQ_READ_MULTI:
      return std::string("GATT_REQ_READ_MULTI");
    case GATT_RSP_READ_MULTI:
      return std::string("GATT_RSP_READ_MULTI");
    case GATT_REQ_READ_BY_GRP_TYPE:
      return std::string("GATT_REQ_READ_BY_GRP_TYPE");
    case GATT_RSP_READ_BY_GRP_TYPE:
      return std::string("GATT_RSP_READ_BY_GRP_TYPE");
    case GATT_REQ_WRITE:
      return std::string("GATT_REQ_WRITE");
    case GATT_RSP_WRITE:
      return std::string("GATT_RSP_WRITE");
    case GATT_CMD_WRITE:
      return std::string("GATT_CMD_WRITE");
    case GATT_REQ_PREPARE_WRITE:
      return std::string("GATT_REQ_PREPARE_WRITE");
    case GATT_RSP_PREPARE_WRITE:
      return std::string("GATT_RSP_PREPARE_WRITE");
    case GATT_REQ_EXEC_WRITE:
      return std::string("GATT_REQ_EXEC_WRITE");
    case GATT_RSP_EXEC_WRITE:
      return std::string("GATT_RSP_EXEC_WRITE");
    case GATT_HANDLE_VALUE_NOTIF:
      return std::string("GATT_HANDLE_VALUE_NOTIF");
    case GATT_HANDLE_VALUE_IND:
      return std::string("GATT_HANDLE_VALUE_IND");
    case GATT_HANDLE_VALUE_CONF:
      return std::string("GATT_HANDLE_VALUE_CONF");
    case GATT_SIGN_CMD_WRITE:
      return std::string("GATT_SIGN_CMD_WRITE");
    case GATT_OP_CODE_MAX:
      return std::string("GATT_OP_CODE_MAX");
  };
}

#define GATT_HANDLE_IS_VALID(x) ((x) != 0)

#define GATT_CONN_UNKNOWN 0
+26 −5
Original line number Diff line number Diff line
@@ -1089,6 +1089,27 @@ bool L2CA_GetPeerFeatures(const RawAddress& bd_addr, uint32_t* p_ext_feat,
 *  Return value:   -
 *
 ******************************************************************************/
static std::string fixed_channel_text(const uint16_t& fixed_cid) {
  switch (fixed_cid) {
    case L2CAP_SIGNALLING_CID:
      return std::string("br_edr signalling");
    case L2CAP_CONNECTIONLESS_CID:
      return std::string("connectionless");
    case L2CAP_AMP_CID:
      return std::string("amp");
    case L2CAP_ATT_CID:
      return std::string("att");
    case L2CAP_BLE_SIGNALLING_CID:
      return std::string("ble signalling");
    case L2CAP_SMP_CID:
      return std::string("smp");
    case L2CAP_SMP_BR_CID:
      return std::string("br_edr smp");
    default:
      return std::string("unknown");
  }
}

bool L2CA_RegisterFixedChannel(uint16_t fixed_cid,
                               tL2CAP_FIXED_CHNL_REG* p_freg) {
  if (bluetooth::shim::is_gd_l2cap_enabled()) {
@@ -1097,14 +1118,14 @@ bool L2CA_RegisterFixedChannel(uint16_t fixed_cid,

  if ((fixed_cid < L2CAP_FIRST_FIXED_CHNL) ||
      (fixed_cid > L2CAP_LAST_FIXED_CHNL)) {
    L2CAP_TRACE_ERROR("L2CA_RegisterFixedChannel()  Invalid CID: 0x%04x",
                      fixed_cid);

    return (false);
    LOG_ERROR("Invalid fixed CID: 0x%04x", fixed_cid);
    return false;
  }

  l2cb.fixed_reg[fixed_cid - L2CAP_FIRST_FIXED_CHNL] = *p_freg;
  return (true);
  LOG_DEBUG("Registered fixed channel:%s",
            fixed_channel_text(fixed_cid).c_str());
  return true;
}

/*******************************************************************************
Loading