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

Commit 7b469d58 authored by Chris Manton's avatar Chris Manton
Browse files

Complete hci errorcode text

Towards loggable code

Bug: 163134718
Tag: #refactor
Test: acts -tc BleCocTest
Test: ble paired 2 phones
Change-Id: Ib71ed35ce4495db3a869cf6e7b52a9b815e46b58
parent 1badf45b
Loading
Loading
Loading
Loading
+69 −1
Original line number Diff line number Diff line
@@ -59,14 +59,82 @@

#define HCI_ERR_MAX_ERR 0x43  // TODO remove. randomly used

inline std::string hci_error_code_text(uint16_t error_code) {
inline std::string hci_error_code_text(uint8_t error_code) {
  switch (error_code) {
    case HCI_SUCCESS:
      return std::string("Success");
    case HCI_ERR_ILLEGAL_COMMAND:
      return std::string("Illegal Command");
    case HCI_ERR_NO_CONNECTION:
      return std::string("Unknown Connection");
    case HCI_ERR_HW_FAILURE:
      return std::string("Hardware Failure");
    case HCI_ERR_PAGE_TIMEOUT:
      return std::string("Page Timeout");
    case HCI_ERR_AUTH_FAILURE:
      return std::string("Authentication Failure");
    case HCI_ERR_KEY_MISSING:
      return std::string("Pin or Key Missing");
    case HCI_ERR_MEMORY_FULL:
      return std::string("Memory Capacity Exceeded");
    case HCI_ERR_CONNECTION_TOUT:
      return std::string("Connection Timeout");
    case HCI_ERR_MAX_NUM_OF_CONNECTIONS:
      return std::string("Connection Limit Exceeded");
    case HCI_ERR_MAX_NUM_OF_SCOS:
      return std::string("Synchronous Connection Limit Exceeded");
    case HCI_ERR_CONNECTION_EXISTS:
      return std::string("Connection Already Exists");
    case HCI_ERR_COMMAND_DISALLOWED:
      return std::string("Command Disallowed");
    case HCI_ERR_HOST_REJECT_RESOURCES:
      return std::string("Connection Rejected Limited Resources");
    case HCI_ERR_HOST_REJECT_SECURITY:
      return std::string("Connection Rejected Security Reasons");
    case HCI_ERR_HOST_REJECT_DEVICE:
      return std::string("Connection Rejected Unacceptable BdAddr");
    case HCI_ERR_HOST_TIMEOUT:
      return std::string("Connection Accept Timeout");
    case HCI_ERR_ILLEGAL_PARAMETER_FMT:
      return std::string("Unsupported Feature or Parameter Value");
    case HCI_ERR_PEER_USER:
      return std::string("Remote Terminated Connection");
    case HCI_ERR_CONN_CAUSE_LOCAL_HOST:
      return std::string("Local Terminated Connection");
    case HCI_ERR_REPEATED_ATTEMPTS:
      return std::string("Repeated Attempts");
    case HCI_ERR_PAIRING_NOT_ALLOWED:
      return std::string("Pairing not Allowed");
    case HCI_ERR_UNSUPPORTED_REM_FEATURE:
      return std::string("Unsupported Remote or Lmp Feature");
    case HCI_ERR_UNSPECIFIED:
      return std::string("Unspecified Error");
    case HCI_ERR_LMP_RESPONSE_TIMEOUT:
      return std::string("Gatt Connection Lmp Timeout");
    case HCI_ERR_LMP_ERR_TRANS_COLLISION:
      return std::string("Link Layer Collision");
    case HCI_ERR_ENCRY_MODE_NOT_ACCEPTABLE:
      return std::string("Encryption Mode not Acceptable");
    case HCI_ERR_UNIT_KEY_USED:
      return std::string("Unit Key Used");
    case HCI_ERR_PAIRING_WITH_UNIT_KEY_NOT_SUPPORTED:
      return std::string("Pairing with Unit Key Unsupported");
    case HCI_ERR_DIFF_TRANSACTION_COLLISION:
      return std::string("Diff Transaction Collision");
    case HCI_ERR_INSUFFCIENT_SECURITY:
      return std::string("Insufficient Security");
    case HCI_ERR_ROLE_SWITCH_PENDING:
      return std::string("Role Switch Pending");
    case HCI_ERR_HOST_BUSY_PAIRING:
      return std::string("Host Busy Pairing");
    case HCI_ERR_UNACCEPT_CONN_INTERVAL:
      return std::string("Unacceptable Connection Interval");
    case HCI_ERR_ADVERTISING_TIMEOUT:
      return std::string("Advertising Timeout");
    case HCI_ERR_CONN_FAILED_ESTABLISHMENT:
      return std::string("Connection Failed Establishment");
    case HCI_ERR_LIMIT_REACHED:
      return std::string("Limit Reached");
    default:
      return std::string("Unknown Error");
  }