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

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

Add stack/l2cap/l2c_int::link_state_text

Toward loggable code

Bug: 163134718
Tag: #refactor
Test: CtsVerifier

Change-Id: If32f14beece68e85f7cbf345a3f694c1f2553bdb
parent 8b4655d5
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#define L2C_INT_H

#include <stdbool.h>
#include <string>

#include "bt_common.h"
#include "btm_api.h"
@@ -89,6 +90,25 @@ typedef enum {
  LST_DISCONNECTING
} tL2C_LINK_STATE;

inline std::string link_state_text(const tL2C_LINK_STATE& state) {
  switch (state) {
    case LST_DISCONNECTED:
      return std::string("LST_DISCONNECTED");
    case LST_CONNECT_HOLDING:
      return std::string("LST_CONNECT_HOLDING");
    case LST_CONNECTING_WAIT_SWITCH:
      return std::string("LST_CONNECTING_WAIT_SWITCH");
    case LST_CONNECTING:
      return std::string("LST_CONNECTING");
    case LST_CONNECTED:
      return std::string("LST_CONNECTED");
    case LST_DISCONNECTING:
      return std::string("LST_DISCONNECTING");
    default:
      return std::string("UNKNOWN");
  }
}

/* Define input events to the L2CAP link and channel state machines. The names
 * of the events may seem a bit strange, but they are taken from
 * the Bluetooth specification.