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

Commit be30d310 authored by Chris Manton's avatar Chris Manton
Browse files

Add stack/include/l2cdefs::l2cap_le_result_code_text

Toward loggable code

Bug: 163134718
Tag: #refactor
Test: CtsVerifier

Change-Id: I4ed9cca2e866f5862e029916e2b964e720628eb2
parent 0b9082eb
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
@@ -131,6 +131,34 @@ typedef enum : uint8_t {
  L2CAP_LE_RESULT_INVALID_PARAMETERS = 0x0C
} tL2CAP_LE_RESULT_CODE;

inline std::string l2cap_le_result_code_text(
    const tL2CAP_LE_RESULT_CODE& code) {
  switch (code) {
    case L2CAP_LE_RESULT_CONN_OK:
      return std::string("le connection success");
    case L2CAP_LE_RESULT_NO_PSM:
      return std::string("le no psm service");
    case L2CAP_LE_RESULT_NO_RESOURCES:
      return std::string("le no resources");
    case L2CAP_LE_RESULT_INSUFFICIENT_AUTHENTICATION:
      return std::string("le authentication failed");
    case L2CAP_LE_RESULT_INSUFFICIENT_AUTHORIZATION:
      return std::string("le authorization failed");
    case L2CAP_LE_RESULT_INSUFFICIENT_ENCRYP_KEY_SIZE:
      return std::string("le encryption key size failed");
    case L2CAP_LE_RESULT_INSUFFICIENT_ENCRYP:
      return std::string("le encryption failed");
    case L2CAP_LE_RESULT_INVALID_SOURCE_CID:
      return std::string("le invalid source channel identifier");
    case L2CAP_LE_RESULT_SOURCE_CID_ALREADY_ALLOCATED:
      return std::string("le source channel identifier busy");
    case L2CAP_LE_RESULT_UNACCEPTABLE_PARAMETERS:
      return std::string("le unacceptable parameters");
    case L2CAP_LE_RESULT_INVALID_PARAMETERS:
      return std::string("invalid parameters");
  }
}

/* Credit based reconfig results code */
#define L2CAP_RECONFIG_SUCCEED 0
#define L2CAP_RECONFIG_REDUCTION_MTU_NO_ALLOWED 1