[gnome-bluetooth/gnome-2-32] Make lib/test-plugins accept address and UUIDs on the command line
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth/gnome-2-32] Make lib/test-plugins accept address and UUIDs on the command line
- Date: Wed, 4 Aug 2010 10:15:52 +0000 (UTC)
commit a6878b7f38e58235b9fe7ec35e304ca53d2b2ef8
Author: Daniele Forsi <daniele forsi it>
Date: Sat Jun 19 17:50:16 2010 +0200
Make lib/test-plugins accept address and UUIDs on the command line
This allows for easier plugin testing.
https://bugzilla.gnome.org/show_bug.cgi?id=611219
lib/test-plugins.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 59 insertions(+), 3 deletions(-)
---
diff --git a/lib/test-plugins.c b/lib/test-plugins.c
index ac06084..2875d86 100644
--- a/lib/test-plugins.c
+++ b/lib/test-plugins.c
@@ -2,6 +2,10 @@
#include <dbus/dbus-glib.h>
#include "bluetooth-plugin-manager.h"
+static gchar *bdaddr = NULL;
+static gchar **uuids = NULL;
+static gboolean list_uuid = FALSE;
+
static gboolean
delete_event_cb (GtkWidget *widget,
GdkEvent *event,
@@ -11,14 +15,66 @@ delete_event_cb (GtkWidget *widget,
return FALSE;
}
+static GOptionEntry options[] = {
+ { "device", 0, 0, G_OPTION_ARG_STRING, &bdaddr,
+ "Remote device to use", "ADDRESS" },
+ { "uuid", 0, 0, G_OPTION_ARG_STRING_ARRAY, &uuids,
+ "UUID(s) to test against", "UUID" },
+ { "list-uuids", 0, 0, G_OPTION_ARG_NONE, &list_uuid,
+ "List valid UUIDs", NULL },
+ { NULL },
+};
+
int main (int argc, char **argv)
{
GtkWidget *window, *vbox;
GList *list, *l;
DBusGConnection *bus;
- const char *uuids[] = { "PANU", NULL};
+ GError *error = NULL;
+
+ if (gtk_init_with_args (&argc, &argv, NULL,
+ options, NULL, &error) == FALSE) {
+ if (error != NULL) {
+ g_printerr ("%s\n", error->message);
+ g_error_free (error);
+ } else
+ g_printerr ("An unknown error occurred\n");
+
+ return 1;
+ }
- gtk_init (&argc, &argv);
+ if (list_uuid) {
+ g_print ("Valid UUIDs are:\n");
+ /* UUIDs copied from bluetooth-client.c and sorted (do not translate them) */
+ g_print ("AudioSink\n" \
+ "AudioSource\n" \
+ "A/V_RemoteControl\n" \
+ "A/V_RemoteControlTarget\n" \
+ "DialupNetworking\n" \
+ "GenericAudio\n" \
+ "GenericNetworking\n" \
+ "GN\n" \
+ "HandsfreeAudioGateway\n" \
+ "Handsfree\n" \
+ "Headset_-_AG\n" \
+ "HSP\n" \
+ "HumanInterfaceDeviceService\n" \
+ "IrMCSync\n" \
+ "NAP\n" \
+ "OBEXFileTransfer\n" \
+ "OBEXObjectPush\n" \
+ "PANU\n" \
+ "Phonebook_Access_-_PSE\n" \
+ "PnPInformation\n" \
+ "SEMC HLA\n" \
+ "SEMC Watch Phone\n" \
+ "SerialPort\n" \
+ "ServiceDiscoveryServerServiceClassID\n" \
+ "SIM_Access\n" \
+ "VideoSource\n");
+
+ return 0;
+ }
/* Init the dbus-glib types */
bus = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
@@ -32,7 +88,7 @@ int main (int argc, char **argv)
vbox = gtk_vbox_new (FALSE, 6);
gtk_container_add (GTK_CONTAINER (window), vbox);
- list = bluetooth_plugin_manager_get_widgets ("11:22:33:44:55:66", uuids);
+ list = bluetooth_plugin_manager_get_widgets (bdaddr, (const char **) uuids);
if (list == NULL) {
g_message ("no plugins");
return 1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]