3
* BlueZ - Bluetooth protocol stack for Linux
5
* Copyright (C) 2009 Bastien Nocera <hadess@hadess.net>
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or
11
* (at your option) any later version.
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31
#include "bluetooth-client.h"
32
#include "bluetooth-client-private.h"
33
#include "bluetooth-utils.h"
36
byte_to_binary (int x)
38
static char b[9] = {0};
41
for (z = 256; z > 0; z >>= 1) {
42
strcat(b, ((x & z) == z) ? "1" : "0");
48
int main(int argc, char *argv[])
50
GLogLevelFlags fatal_mask;
53
gtk_init(&argc, &argv);
55
fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
56
fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
57
g_log_set_always_fatal (fatal_mask);
59
class = g_ascii_strtoull (argv[1], NULL, 0);
61
g_message ("device class: 0x%X", class);
62
g_message ("major class: 0x%X %s", (class & 0x1f00) >> 8, byte_to_binary ((class & 0x1f00) >> 8));
64
g_message ("%d %s", bluetooth_class_to_type (class), bluetooth_type_to_string (bluetooth_class_to_type (class)));