OSDN Git Service

core: Introduce batocomp helper function
authorMarcel Holtmann <marcel@holtmann.org>
Sat, 8 Dec 2012 22:48:30 +0000 (23:48 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Sat, 8 Dec 2012 22:48:30 +0000 (23:48 +0100)
src/oui.c
src/oui.h

index 2f9c4a7..945d812 100644 (file)
--- a/src/oui.c
+++ b/src/oui.c
@@ -34,6 +34,8 @@
 #include <sys/stat.h>
 #include <sys/mman.h>
 
+#include <bluetooth/bluetooth.h>
+
 #include "oui.h"
 
 /* http://standards.ieee.org/regauth/oui/oui.txt */
@@ -88,3 +90,12 @@ char *ouitocomp(const char *oui)
 
        return str;
 }
+
+char *batocomp(const bdaddr_t *ba)
+{
+       char oui[9];
+
+       sprintf(oui, "%2.2X-%2.2X-%2.2X", ba->b[5], ba->b[4], ba->b[3]);
+
+       return ouitocomp(oui);
+}
index 629b57b..8dd8879 100644 (file)
--- a/src/oui.h
+++ b/src/oui.h
@@ -22,3 +22,4 @@
  */
 
 char *ouitocomp(const char *oui);
+char *batocomp(const bdaddr_t *ba);