From 41c164796de5dcbf9265a915a3ca2d5d47a0f5a7 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Sun, 2 May 2010 18:44:06 +0100 Subject: Add major class output to test-class --- lib/test-class.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib/test-class.c') 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 #endif +#include #include #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; -- cgit v1.2.1