diff options
author | Bastien Nocera <hadess@hadess.net> | 2010-05-02 18:44:06 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2010-05-02 18:57:29 +0100 |
commit | 41c164796de5dcbf9265a915a3ca2d5d47a0f5a7 (patch) | |
tree | 4bf6c33fdd9a2e28d71b0c50c263b41d145ea118 | |
parent | 8497724f832e46fac53f747a1f2f1373721fe5bd (diff) | |
download | gnome-bluetooth-41c164796de5dcbf9265a915a3ca2d5d47a0f5a7.tar.gz |
Add major class output to test-class
-rw-r--r-- | lib/test-class.c | 16 |
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; |