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

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

legacy: Move raw_address serialization to proper file am: a07e3023 am: 8394c0b6 am: 2ad4e608

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

Change-Id: I8a041fa184b4e3cf2d6945055418ccedd6a49127
parents ce3b9cef 2ad4e608
Loading
Loading
Loading
Loading
+5 −17
Original line number Diff line number Diff line
@@ -29,6 +29,11 @@
#include "stack/include/bt_device_type.h"
#include "stack/include/bt_hdr.h"
#include "stack/include/bt_octets.h"
#ifdef __cplusplus
#include "include/hardware/bluetooth.h"
#include "types/bluetooth/uuid.h"
#include "types/raw_address.h"
#endif  // __cplusplus

/* READ WELL !!
 *
@@ -324,23 +329,6 @@ enum {
  }

/* Common Bluetooth field definitions */
#define BD_ADDR_LEN 6 /* Device address length */

#ifdef __cplusplus
#include <bluetooth/uuid.h>
#include <include/hardware/bluetooth.h>

inline void BDADDR_TO_STREAM(uint8_t*& p, const RawAddress& a) {
  for (int ijk = 0; ijk < BD_ADDR_LEN; ijk++)
    *(p)++ = (uint8_t)(a.address)[BD_ADDR_LEN - 1 - ijk];
}

inline void STREAM_TO_BDADDR(RawAddress& a, uint8_t*& p) {
  uint8_t* pbda = (uint8_t*)(a.address) + BD_ADDR_LEN - 1;
  for (int ijk = 0; ijk < BD_ADDR_LEN; ijk++) *pbda-- = *(p)++;
}

#endif

#define PIN_CODE_LEN 16
typedef uint8_t PIN_CODE[PIN_CODE_LEN]; /* Pin Code (upto 128 bits) MSB is 0 */
+12 −0
Original line number Diff line number Diff line
@@ -80,3 +80,15 @@ struct std::hash<RawAddress> {
    return std::hash<uint64_t>{}(int_addr);
  }
};

#define BD_ADDR_LEN 6 /* Device address length */

inline void BDADDR_TO_STREAM(uint8_t*& p, const RawAddress& a) {
  for (int ijk = 0; ijk < BD_ADDR_LEN; ijk++)
    *(p)++ = (uint8_t)(a.address)[BD_ADDR_LEN - 1 - ijk];
}

inline void STREAM_TO_BDADDR(RawAddress& a, uint8_t*& p) {
  uint8_t* pbda = (uint8_t*)(a.address) + BD_ADDR_LEN - 1;
  for (int ijk = 0; ijk < BD_ADDR_LEN; ijk++) *pbda-- = *(p)++;
}