summaryrefslogtreecommitdiff
path: root/lib/test-class.c
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2010-05-02 18:44:06 +0100
committerBastien Nocera <hadess@hadess.net>2010-05-02 18:57:29 +0100
commit41c164796de5dcbf9265a915a3ca2d5d47a0f5a7 (patch)
tree4bf6c33fdd9a2e28d71b0c50c263b41d145ea118 /lib/test-class.c
parent8497724f832e46fac53f747a1f2f1373721fe5bd (diff)
downloadgnome-bluetooth-41c164796de5dcbf9265a915a3ca2d5d47a0f5a7.tar.gz
Add major class output to test-class
Diffstat (limited to 'lib/test-class.c')
-rw-r--r--lib/test-class.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/test-class.c b/lib/test-class.c
index b62307ef..06eea06d 100644
--- a/lib/test-class.c
+++ b/lib/test-class.c
@@ -25,11 +25,25 @@
#include <config.h>
#endif
+#include <string.h>
#include <gtk/gtk.h>
#include "bluetooth-client.h"
#include "bluetooth-client-private.h"
+static const char *
+byte_to_binary (int x)
+{
+ static char b[9] = {0};
+
+ int z;
+ for (z = 256; z > 0; z >>= 1) {
+ strcat(b, ((x & z) == z) ? "1" : "0");
+ }
+
+ return b;
+}
+
int main(int argc, char *argv[])
{
GLogLevelFlags fatal_mask;
@@ -43,6 +57,8 @@ int main(int argc, char *argv[])
class = g_ascii_strtoull (argv[1], NULL, 0);
+ g_message ("major class: 0x%X %s", (class & 0x1f00) >> 8, byte_to_binary ((class & 0x1f00) >> 8));
+
g_message ("%d %s", bluetooth_class_to_type (class), bluetooth_type_to_string (bluetooth_class_to_type (class)));
return 0;