bluez5: Add bt_ba2str()
authorClaudio Takahasi <claudio.takahasi@openbossa.org>
Mon, 28 Jan 2013 21:11:04 +0000 (18:11 -0300)
committerDenis Kenzior <denkenz@gmail.com>
Tue, 29 Jan 2013 15:02:45 +0000 (09:02 -0600)
Adds a copy of BlueZ ba2str() function.

plugins/bluez5.c
plugins/bluez5.h
plugins/hfp_hf_bluez5.c

index 876ad2d..d7e85f2 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <errno.h>
 #include <stdint.h>
+#include <stdio.h>
 #include <sys/socket.h>
 #include <string.h>
 
@@ -45,6 +46,12 @@ void bt_bacpy(bdaddr_t *dst, const bdaddr_t *src)
        memcpy(dst, src, sizeof(bdaddr_t));
 }
 
+int bt_ba2str(const bdaddr_t *ba, char *str)
+{
+       return sprintf(str, "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
+               ba->b[5], ba->b[4], ba->b[3], ba->b[2], ba->b[1], ba->b[0]);
+}
+
 static void profile_register_cb(DBusPendingCall *call, gpointer user_data)
 {
        DBusMessage *reply;
index 3921c7b..204c41d 100644 (file)
@@ -58,6 +58,8 @@ struct sockaddr_sco {
 
 void bt_bacpy(bdaddr_t *dst, const bdaddr_t *src);
 
+int bt_ba2str(const bdaddr_t *ba, char *str);
+
 int bluetooth_register_profile(DBusConnection *conn, const char *uuid,
                                        const char *name, const char *object);
 
index d2cca05..aba62e2 100644 (file)
@@ -26,6 +26,7 @@
 #include <errno.h>
 #include <stdint.h>
 #include <stdlib.h>
+#include <stdio.h>
 #include <unistd.h>
 #include <string.h>
 #include <fcntl.h>