Loading system/gd/hci/le_address_manager.cc +5 −5 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ #include "common/init_flags.h" #include "hci/octets.h" #include "include/macros.h" #include "os/log.h" #include "os/rand.h" namespace bluetooth { Loading @@ -39,11 +38,12 @@ enum class LeAddressManager::ClientState { std::string LeAddressManager::ClientStateText(const ClientState cs) { switch (cs) { CASE_RETURN_TEXT(ClientState::WAITING_FOR_PAUSE); CASE_RETURN_TEXT(ClientState::PAUSED); CASE_RETURN_TEXT(ClientState::WAITING_FOR_RESUME); CASE_RETURN_TEXT(ClientState::RESUMED); CASE_RETURN_STRING(ClientState::WAITING_FOR_PAUSE); CASE_RETURN_STRING(ClientState::PAUSED); CASE_RETURN_STRING(ClientState::WAITING_FOR_RESUME); CASE_RETURN_STRING(ClientState::RESUMED); } RETURN_UNKNOWN_TYPE_STRING(ClientState, cs); } LeAddressManager::LeAddressManager( Loading system/include/macros.h +14 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,20 @@ #pragma once #include <bluetooth/log.h> #include <cstdint> #include <string> #define CASE_RETURN_TEXT(code) \ case code: \ return #code #define CASE_RETURN_STRING(enumerator) \ case enumerator: \ return fmt::format(#enumerator "(0x{:x})", \ static_cast<uint64_t>(enumerator)) #define RETURN_UNKNOWN_TYPE_STRING(type, variable) \ return fmt::format("Unknown {}(0x{:x})", #type, \ static_cast<uint64_t>(variable)) system/types/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ cc_test { name: "net_test_types", static_libs: [ "libbluetooth-types", "libbluetooth_log", "libchrome", "libosi", // strlcpy ], Loading system/types/bt_transport.h +4 −2 Original line number Diff line number Diff line Loading @@ -20,13 +20,14 @@ #include <string> #include "macros.h" #define BT_TRANSPORT_AUTO 0 #define BT_TRANSPORT_BR_EDR 1 #define BT_TRANSPORT_LE 2 typedef uint8_t tBT_TRANSPORT; #if __has_include(<bluetooth/log.h>) #include "macros.h" inline std::string bt_transport_text(const tBT_TRANSPORT& transport) { switch (transport) { CASE_RETURN_TEXT(BT_TRANSPORT_AUTO); Loading @@ -36,3 +37,4 @@ inline std::string bt_transport_text(const tBT_TRANSPORT& transport) { return base::StringPrintf("UNKNOWN[%hhu]", transport); } } #endif Loading
system/gd/hci/le_address_manager.cc +5 −5 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ #include "common/init_flags.h" #include "hci/octets.h" #include "include/macros.h" #include "os/log.h" #include "os/rand.h" namespace bluetooth { Loading @@ -39,11 +38,12 @@ enum class LeAddressManager::ClientState { std::string LeAddressManager::ClientStateText(const ClientState cs) { switch (cs) { CASE_RETURN_TEXT(ClientState::WAITING_FOR_PAUSE); CASE_RETURN_TEXT(ClientState::PAUSED); CASE_RETURN_TEXT(ClientState::WAITING_FOR_RESUME); CASE_RETURN_TEXT(ClientState::RESUMED); CASE_RETURN_STRING(ClientState::WAITING_FOR_PAUSE); CASE_RETURN_STRING(ClientState::PAUSED); CASE_RETURN_STRING(ClientState::WAITING_FOR_RESUME); CASE_RETURN_STRING(ClientState::RESUMED); } RETURN_UNKNOWN_TYPE_STRING(ClientState, cs); } LeAddressManager::LeAddressManager( Loading
system/include/macros.h +14 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,20 @@ #pragma once #include <bluetooth/log.h> #include <cstdint> #include <string> #define CASE_RETURN_TEXT(code) \ case code: \ return #code #define CASE_RETURN_STRING(enumerator) \ case enumerator: \ return fmt::format(#enumerator "(0x{:x})", \ static_cast<uint64_t>(enumerator)) #define RETURN_UNKNOWN_TYPE_STRING(type, variable) \ return fmt::format("Unknown {}(0x{:x})", #type, \ static_cast<uint64_t>(variable))
system/types/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ cc_test { name: "net_test_types", static_libs: [ "libbluetooth-types", "libbluetooth_log", "libchrome", "libosi", // strlcpy ], Loading
system/types/bt_transport.h +4 −2 Original line number Diff line number Diff line Loading @@ -20,13 +20,14 @@ #include <string> #include "macros.h" #define BT_TRANSPORT_AUTO 0 #define BT_TRANSPORT_BR_EDR 1 #define BT_TRANSPORT_LE 2 typedef uint8_t tBT_TRANSPORT; #if __has_include(<bluetooth/log.h>) #include "macros.h" inline std::string bt_transport_text(const tBT_TRANSPORT& transport) { switch (transport) { CASE_RETURN_TEXT(BT_TRANSPORT_AUTO); Loading @@ -36,3 +37,4 @@ inline std::string bt_transport_text(const tBT_TRANSPORT& transport) { return base::StringPrintf("UNKNOWN[%hhu]", transport); } } #endif