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

Commit e02196d2 authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Move bt_bdaddr_t operator to global header file

This is to simplify bt_bdaddr_t handling

Test: compilation
Change-Id: I06ac6c2f0402ed13a2c04f86494d3c4fd0165963
parent 7ea74cea
Loading
Loading
Loading
Loading
+1 −12
Original line number Diff line number Diff line
@@ -18,24 +18,13 @@

#include "service/common/bluetooth/util/address_helper.h"
#include "service/logging_helpers.h"
#include "stack/include/bt_types.h"

using std::lock_guard;
using std::mutex;

namespace bluetooth {

namespace {

bool operator==(const bt_bdaddr_t& lhs, const bt_bdaddr_t& rhs) {
  return memcmp(&lhs, &rhs, sizeof(lhs)) == 0;
}

bool operator!=(const bt_bdaddr_t& lhs, const bt_bdaddr_t& rhs) {
  return !(lhs == rhs);
}

}  // namespace

// GattServer implementation
// ========================================================

+20 −0
Original line number Diff line number Diff line
@@ -540,6 +540,26 @@ typedef struct {
typedef uint8_t BD_ADDR[BD_ADDR_LEN]; /* Device address */
typedef uint8_t* BD_ADDR_PTR;         /* Pointer to Device Address */

#ifdef __cplusplus
#include <base/strings/stringprintf.h>
#include <hardware/bluetooth.h>

inline bool operator==(const bt_bdaddr_t& lhs, const bt_bdaddr_t& rhs) {
  return memcmp(&lhs, &rhs, sizeof(lhs)) == 0;
}

inline bool operator!=(const bt_bdaddr_t& lhs, const bt_bdaddr_t& rhs) {
  return !(lhs == rhs);
}

inline std::ostream& operator<<(std::ostream& os, const bt_bdaddr_t& a) {
  os << base::StringPrintf("%02x:%02x:%02x:%02x:%02x:%02x", a.address[0],
                           a.address[1], a.address[2], a.address[3],
                           a.address[4], a.address[5]);
  return os;
}
#endif

#define AMP_KEY_TYPE_GAMP 0
#define AMP_KEY_TYPE_WIFI 1
#define AMP_KEY_TYPE_UWB 2