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

« back to all changes in this revision

Viewing changes to lib/test-plugins.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:
2
2
#include <dbus/dbus-glib.h>
3
3
#include "bluetooth-plugin-manager.h"
4
4
 
 
5
static gchar *bdaddr = NULL;
 
6
static gchar **uuids = NULL;
 
7
static gboolean list_uuid = FALSE;
 
8
 
5
9
static gboolean
6
10
delete_event_cb (GtkWidget *widget,
7
11
                 GdkEvent  *event,
11
15
        return FALSE;
12
16
}
13
17
 
 
18
static GOptionEntry options[] = {
 
19
        { "device", 0, 0, G_OPTION_ARG_STRING, &bdaddr,
 
20
                                "Remote device to use", "ADDRESS" },
 
21
        { "uuid", 0, 0, G_OPTION_ARG_STRING_ARRAY, &uuids,
 
22
                                "UUID(s) to test against", "UUID" },
 
23
        { "list-uuids", 0, 0, G_OPTION_ARG_NONE, &list_uuid,
 
24
                                "List valid UUIDs", NULL },
 
25
        { NULL },
 
26
};
 
27
 
14
28
int main (int argc, char **argv)
15
29
{
16
30
        GtkWidget *window, *vbox;
17
31
        GList *list, *l;
18
32
        DBusGConnection *bus;
19
 
        const char *uuids[] = { "PANU", NULL};
20
 
 
21
 
        gtk_init (&argc, &argv);
 
33
        GError *error = NULL;
 
34
 
 
35
        if (gtk_init_with_args (&argc, &argv, NULL,
 
36
                                options, NULL, &error) == FALSE) {
 
37
                if (error != NULL) {
 
38
                        g_printerr ("%s\n", error->message);
 
39
                        g_error_free (error);
 
40
                } else
 
41
                        g_printerr ("An unknown error occurred\n");
 
42
 
 
43
                return 1;
 
44
        }
 
45
 
 
46
        if (list_uuid) {
 
47
                g_print ("Valid UUIDs are:\n");
 
48
                /* UUIDs copied from bluetooth-client.c and sorted (do not translate them) */
 
49
                g_print ("AudioSink\n" \
 
50
                         "AudioSource\n" \
 
51
                         "A/V_RemoteControl\n" \
 
52
                         "A/V_RemoteControlTarget\n" \
 
53
                         "DialupNetworking\n" \
 
54
                         "GenericAudio\n" \
 
55
                         "GenericNetworking\n" \
 
56
                         "GN\n" \
 
57
                         "HandsfreeAudioGateway\n" \
 
58
                         "Handsfree\n" \
 
59
                         "Headset_-_AG\n" \
 
60
                         "HSP\n" \
 
61
                         "HumanInterfaceDeviceService\n" \
 
62
                         "IrMCSync\n" \
 
63
                         "NAP\n" \
 
64
                         "OBEXFileTransfer\n" \
 
65
                         "OBEXObjectPush\n" \
 
66
                         "PANU\n" \
 
67
                         "Phonebook_Access_-_PSE\n" \
 
68
                         "PnPInformation\n" \
 
69
                         "SEMC HLA\n" \
 
70
                         "SEMC Watch Phone\n" \
 
71
                         "SerialPort\n" \
 
72
                         "ServiceDiscoveryServerServiceClassID\n" \
 
73
                         "SIM_Access\n" \
 
74
                         "VideoSource\n");
 
75
 
 
76
                return 0;
 
77
        }
22
78
 
23
79
        /* Init the dbus-glib types */
24
80
        bus = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
32
88
        vbox = gtk_vbox_new (FALSE, 6);
33
89
        gtk_container_add (GTK_CONTAINER (window), vbox);
34
90
 
35
 
        list = bluetooth_plugin_manager_get_widgets ("11:22:33:44:55:66", uuids);
 
91
        list = bluetooth_plugin_manager_get_widgets (bdaddr, (const char **) uuids);
36
92
        if (list == NULL) {
37
93
                g_message ("no plugins");
38
94
                return 1;