Implementation for pretty_showing bluetooth physical addresses

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24123 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Ruiz Dorantes
2008-02-25 20:14:15 +00:00
parent 629ab634f5
commit 42d737bb2e
+17 -3
View File
@@ -8,6 +8,8 @@
#ifndef _BDADDR_UTILS_H #ifndef _BDADDR_UTILS_H
#define _BDADDR_UTILS_H #define _BDADDR_UTILS_H
#include <stdio.h>
#include <bluetooth/bluetooth.h> #include <bluetooth/bluetooth.h>
namespace Bluetooth { namespace Bluetooth {
@@ -36,11 +38,18 @@ class bdaddrUtils {
} }
static const char* ToString(bdaddr_t bdaddr) static char* ToString(const bdaddr_t bdaddr)
{ {
// TODO: // TODO: not safe
static char str[12]; static char str[18];
sprintf(str,"%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",bdaddr.b[0],
bdaddr.b[1],
bdaddr.b[2],
bdaddr.b[3],
bdaddr.b[4],
bdaddr.b[5]);
return str; return str;
} }
@@ -48,4 +57,9 @@ class bdaddrUtils {
} }
#ifndef _BT_USE_EXPLICIT_NAMESPACE
using Bluetooth::bdaddrUtils;
#endif
#endif #endif