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

Commit ebfcf233 authored by Chris Manton's avatar Chris Manton Committed by Andre Eisenbach
Browse files

Add bdcopy method

parent a5657a8a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -38,6 +38,10 @@ bool bdaddr_is_empty(const bt_bdaddr_t *addr);
// may be NULL.
bool bdaddr_equals(const bt_bdaddr_t *first, const bt_bdaddr_t *second);

// Returns destination bdaddr |dest| after copying |src| to |dest|.
// |dest| and |src| must not be NULL.
bt_bdaddr_t *bdaddr_copy(bt_bdaddr_t *dest, const bt_bdaddr_t *src);

// Makes a string representation of |addr| and places it into |string|. |size|
// refers to the size of |string|'s buffer and must be >= 18. On success, this
// function returns |string|, otherwise it returns NULL. Neither |addr| nor |string|
+7 −0
Original line number Diff line number Diff line
@@ -37,6 +37,13 @@ bool bdaddr_equals(const bt_bdaddr_t *first, const bt_bdaddr_t *second) {
  return memcmp(first, second, sizeof(bt_bdaddr_t)) == 0;
}

bt_bdaddr_t *bdaddr_copy(bt_bdaddr_t *dest, const bt_bdaddr_t *src) {
  assert(dest != NULL);
  assert(src != NULL);

  return (bt_bdaddr_t *)memcpy(dest, src, sizeof(bt_bdaddr_t));
}

const char *bdaddr_to_string(const bt_bdaddr_t *addr, char *string, size_t size) {
  assert(addr != NULL);
  assert(string != NULL);