bluez5: Add bt_ba2str()

Adds a copy of BlueZ ba2str() function.
This commit is contained in:
Claudio Takahasi 2013-01-28 18:11:04 -03:00 committed by Denis Kenzior
parent e05b3dfb4d
commit e8621fe8c2
3 changed files with 10 additions and 0 deletions

View 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;

View 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);

View 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>