Skip to content
Snippets Groups Projects
Commit ebfcf233 authored by Chris Manton's avatar Chris Manton Committed by Andre Eisenbach
Browse files

Add bdcopy method

parent a5657a8a
No related branches found
No related tags found
No related merge requests found
......@@ -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|
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment