mirror of git://git.sysmocom.de/ofono
core: Add bt_str2ba() to bluetooth.h
This patch adds a utility Bluetooth function to convert Bluetooth address from string to bdaddr_t.
This commit is contained in:
parent
afb4470558
commit
5d0ba72d04
|
@ -69,3 +69,11 @@ static inline int bt_bacmp(const bdaddr_t *ba1, const bdaddr_t *ba2)
|
|||
{
|
||||
return memcmp(ba1, ba2, sizeof(bdaddr_t));
|
||||
}
|
||||
|
||||
static inline void bt_str2ba(const char *str, bdaddr_t *ba)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 5; i >= 0; i--, str += 3)
|
||||
ba->b[i] = strtol(str, NULL, 16);
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
|
Loading…
Reference in New Issue