~timchen119/ubuntu/trusty/gnome-bluetooth/lp1035431

« back to all changes in this revision

Viewing changes to lib/test-class.c

  • Committer: Bazaar Package Importer
  • Author(s): Emilio Pozuelo Monfort
  • Date: 2011-02-27 15:45:22 UTC
  • mfrom: (1.3.2 upstream)
  • mto: (2.2.3 experimental) (1.5.1)
  • mto: This revision was merged to the branch mainline in revision 53.
  • Revision ID: james.westby@ubuntu.com-20110227154522-dnnoqasv5v3mv42a
Tags: upstream-2.91.5
ImportĀ upstreamĀ versionĀ 2.91.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include <config.h>
26
26
#endif
27
27
 
 
28
#include <string.h>
28
29
#include <gtk/gtk.h>
29
30
 
30
31
#include "bluetooth-client.h"
31
32
#include "bluetooth-client-private.h"
32
33
 
 
34
static const char *
 
35
byte_to_binary (int x)
 
36
{
 
37
        static char b[9] = {0};
 
38
 
 
39
        int z;
 
40
        for (z = 256; z > 0; z >>= 1) {
 
41
                strcat(b, ((x & z) == z) ? "1" : "0");
 
42
        }
 
43
 
 
44
        return b;
 
45
}
 
46
 
33
47
int main(int argc, char *argv[])
34
48
{
35
49
        GLogLevelFlags fatal_mask;
43
57
 
44
58
        class = g_ascii_strtoull (argv[1], NULL, 0);
45
59
 
 
60
        g_message ("major class: 0x%X %s", (class & 0x1f00) >> 8, byte_to_binary ((class & 0x1f00) >> 8));
 
61
 
46
62
        g_message ("%d %s", bluetooth_class_to_type (class), bluetooth_type_to_string (bluetooth_class_to_type (class)));
47
63
 
48
64
        return 0;