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

Commit bb2c8fb6 authored by Chris Manton's avatar Chris Manton Committed by Automerger Merge Worker
Browse files

Add btif/include/btif_hh::btif_hh_status_text am: 7898ae38

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1642945

Change-Id: I347b8686b3808a025b72f3c7e9536e0779431c1f
parents 07cd418f 7898ae38
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@
 *  Type definitions and return values
 ******************************************************************************/

typedef enum {
typedef enum : unsigned {
  BTIF_HH_DISABLED = 0,
  BTIF_HH_ENABLED,
  BTIF_HH_DISABLING,
@@ -56,6 +56,25 @@ typedef enum {
  BTIF_HH_DEV_DISCONNECTED
} BTIF_HH_STATUS;

#define CASE_RETURN_TEXT(code) \
  case code:                   \
    return #code

inline std::string btif_hh_status_text(const BTIF_HH_STATUS& status) {
  switch (status) {
    CASE_RETURN_TEXT(BTIF_HH_DISABLED);
    CASE_RETURN_TEXT(BTIF_HH_ENABLED);
    CASE_RETURN_TEXT(BTIF_HH_DISABLING);
    CASE_RETURN_TEXT(BTIF_HH_DEV_UNKNOWN);
    CASE_RETURN_TEXT(BTIF_HH_DEV_CONNECTING);
    CASE_RETURN_TEXT(BTIF_HH_DEV_CONNECTED);
    CASE_RETURN_TEXT(BTIF_HH_DEV_DISCONNECTED);
    default:
      return std::string("UNKNOWN[%hhu]", status);
  }
}
#undef CASE_RETURN_TEXT

typedef struct {
  bthh_connection_state_t dev_status;
  uint8_t dev_handle;