summaryrefslogtreecommitdiffstats
path: root/src/bluetooth.h
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2013-03-12 09:42:05 -0300
committerDenis Kenzior <denkenz@gmail.com>2013-03-18 14:00:15 -0500
commit5d0ba72d040505a6ec076d20216e85d3cc356a50 (patch)
treea08d785e92dc6447289f480ec3ffe055c8394d59 /src/bluetooth.h
parentafb447055833c73db1bd4b75ee7d6c840000909a (diff)
downloadofono-5d0ba72d040505a6ec076d20216e85d3cc356a50.tar.bz2
core: Add bt_str2ba() to bluetooth.h
This patch adds a utility Bluetooth function to convert Bluetooth address from string to bdaddr_t.
Diffstat (limited to 'src/bluetooth.h')
-rw-r--r--src/bluetooth.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/bluetooth.h b/src/bluetooth.h
index 15841097..af6f02c1 100644
--- a/src/bluetooth.h
+++ b/src/bluetooth.h
@@ -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);
+}