Mercurial > audlegacy-plugins
changeset 2838:22a2ffe86750
added passkey agent and basic pairing functionality
author | Paula Stanciu <paula.stanciu@gmail.com> |
---|---|
date | Wed, 16 Jul 2008 20:48:09 +0300 |
parents | bdc4fbf878ec |
children | 22a5075fc7f7 |
files | src/bluetooth/Makefile src/bluetooth/agent.c src/bluetooth/agent.h src/bluetooth/auth-agent-glue.h src/bluetooth/bluetooth.c src/bluetooth/bluetooth.h src/bluetooth/dbus-glue.h src/bluetooth/gui.c src/bluetooth/gui.h src/bluetooth/passkey-agent-glue.h |
diffstat | 10 files changed, 2097 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/src/bluetooth/Makefile Mon Jul 14 18:07:03 2008 +0200 +++ b/src/bluetooth/Makefile Wed Jul 16 20:48:09 2008 +0300 @@ -1,11 +1,11 @@ PLUGIN = bluetooth${PLUGIN_SUFFIX} -SRCS = bluetooth.c gui.c marshal.c scan_gui.c +SRCS = bluetooth.c gui.c marshal.c scan_gui.c agent.c include ../../buildsys.mk include ../../extra.mk plugindir := ${plugindir}/${GENERAL_PLUGIN_DIR} +CFLAGS += ${PLUGIN_CFLAGS} +CPPFLAGS += ${PLUGIN_CPPFLAGS} ${BEEP_DEFINES} ${MOWGLI_CFLAGS} ${DBUS_CFLAGS} ${GTK_CFLAGS} ${GLIB_CFLAGS} ${DBUS_GLIB_CFLAGS} ${PANGO_CFLAGS} -I../../intl -I../.. ${BLUEZ_CFLAGS} +LIBS += ${GTK_LIBS} ${GLIB_LIBS} ${PANGO_LIBS} ${BLUEZ_LIBS} -CFLAGS += ${PLUGIN_CFLAGS} -CPPFLAGS += ${PLUGIN_CPPFLAGS} ${BEEP_DEFINES} ${MOWGLI_CFLAGS} ${DBUS_CFLAGS} ${GTK_CFLAGS} ${GLIB_CFLAGS} ${PANGO_CFLAGS} -I../../intl -I../.. ${BLUEZ_CFLAGS} -LIBS += ${GTK_LIBS} ${GLIB_LIBS} ${PANGO_LIBS} ${BLUEZ_LIBS}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/bluetooth/agent.c Wed Jul 16 20:48:09 2008 +0300 @@ -0,0 +1,731 @@ +#include <glib/gprintf.h> +#include "bluetooth.h" +#include "gui.h" + +#define PASSKEY_AGENT_PATH "/org/bluez/audacious_passkey" +#define AUTH_AGENT_PATH "/org/bluez/audacious_auth" + +static GtkWidget *agent_window = NULL; +static GtkWidget *window_box = NULL; +static GtkWidget *top_box = NULL; +static GtkWidget *middle_box = NULL; +static GtkWidget *bottom_box = NULL; +static GtkWidget *pair_label = NULL; +static GtkWidget *device_label = NULL; +static GtkWidget *passkey_entry = NULL; +static GtkWidget *ok_button = NULL; +static GtkWidget *cancel_button = NULL; +static char* passkey; +DBusGProxy *pair_obj = NULL; +static DBusGConnection *connection; +void ok_button_call() +{ + passkey = gtk_entry_get_text(GTK_ENTRY(passkey_entry)); + printf("Key entered : %s\n",passkey); +} + +void cancel_button_call() +{ + gtk_widget_destroy (agent_window); + agent_window = NULL; +} + +void run_agent() +{ + if (!agent_window) + { + agent_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + g_signal_connect (agent_window, "destroy",G_CALLBACK (gtk_widget_destroyed), &agent_window); + window_box = gtk_vbox_new(FALSE,2); + top_box = gtk_vbox_new(FALSE,2); + middle_box = gtk_hbox_new(FALSE,2); + bottom_box = gtk_hbox_new(FALSE,2); + + gtk_container_add(GTK_CONTAINER(agent_window),window_box); + gtk_container_add(GTK_CONTAINER(window_box),top_box); + gtk_container_set_border_width (GTK_CONTAINER(middle_box), 20); + gtk_container_add(GTK_CONTAINER(window_box),middle_box); + gtk_container_add(GTK_CONTAINER(window_box),bottom_box); + + pair_label = gtk_label_new_with_mnemonic("Enter passkey for pairing"); + device_label = gtk_label_new_with_mnemonic(((DeviceData*)(selected_dev->data))->name); + + gtk_container_add(GTK_CONTAINER(top_box),pair_label); + gtk_container_add(GTK_CONTAINER(top_box),device_label); + + passkey_entry = gtk_entry_new(); + gtk_container_add(GTK_CONTAINER(middle_box),passkey_entry); + + ok_button = gtk_button_new_with_mnemonic("OK"); + cancel_button = gtk_button_new_with_mnemonic("Cancel"); + gtk_container_add(GTK_CONTAINER(bottom_box),ok_button); + g_signal_connect(ok_button,"clicked",G_CALLBACK(ok_button_call),NULL); + + gtk_container_add(GTK_CONTAINER(bottom_box),cancel_button); + g_signal_connect(cancel_button,"clicked",G_CALLBACK (cancel_button_call),NULL); + + + gtk_window_set_title(GTK_WINDOW(agent_window),"Pairing passkey request"); + if (!GTK_WIDGET_VISIBLE (agent_window)) + gtk_widget_show_all (agent_window); + else + { + gtk_widget_destroy (agent_window); + agent_window = NULL; + } + + } + + +} +static DBusGConnection *connection; + +static int volatile registered_passkey = 0; +static int volatile registered_auth = 0; + +static gboolean auto_authorize = FALSE; + +typedef enum { + AGENT_ERROR_REJECT +} AgentError; + +#define AGENT_ERROR (agent_error_quark()) + +#define AGENT_ERROR_TYPE (agent_error_get_type()) + +static GQuark agent_error_quark(void) +{ + static GQuark quark = 0; + if (!quark) + quark = g_quark_from_static_string("agent"); + + return quark; +} + +#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC } + +static GType agent_error_get_type(void) +{ + static GType etype = 0; + if (etype == 0) { + static const GEnumValue values[] = { + ENUM_ENTRY(AGENT_ERROR_REJECT, "Rejected"), + { 0, 0, 0 } + }; + + etype = g_enum_register_static("agent", values); + } + + return etype; +} + +static GList *input_list = NULL; + +struct input_data { + char *path; + char *address; + char *service; + char *uuid; + DBusGMethodInvocation *context; +}; + +static gint input_compare(gconstpointer a, gconstpointer b) +{ + struct input_data *a_data = (struct input_data *) a; + struct input_data *b_data = (struct input_data *) b; + + return g_ascii_strcasecmp(a_data->address, b_data->address); +} + +static void input_free(struct input_data *input) +{ + + input_list = g_list_remove(input_list, input); + + g_free(input->uuid); + g_free(input->service); + g_free(input->address); + g_free(input->path); + g_free(input); + +// if (g_list_length(input_list) == 0) + // disable_blinking(); +} + +static void passkey_callback(gint response, gpointer user_data) +{ + struct input_data *input = user_data; + + if (response == GTK_RESPONSE_ACCEPT) { + const char *passkey; +/*!!!!!!!!! hardcoded passkey !!!!!!!!!!!!! to modify*/ + passkey ="0000"; + dbus_g_method_return(input->context, passkey); + } else { + GError *error; + error = g_error_new(AGENT_ERROR, AGENT_ERROR_REJECT, + "Pairing request rejected"); + dbus_g_method_return_error(input->context, error); + } + + input_free(input); +} + +static void confirm_callback(gint response, gpointer user_data) +{ + struct input_data *input = user_data; + + if (response != GTK_RESPONSE_YES) { + GError *error; + error = g_error_new(AGENT_ERROR, AGENT_ERROR_REJECT, + "Confirmation request rejected"); + dbus_g_method_return_error(input->context, error); + } else + dbus_g_method_return(input->context); + + input_free(input); +} + +static void set_trusted(struct input_data *input) +{ + DBusGProxy *object; + gboolean active; + +//aways set trusted -- we dont have yet an active button - +//maybe I'll add one + object = dbus_g_proxy_new_for_name(connection, "org.bluez", + input->path, "org.bluez.Adapter"); + + dbus_g_proxy_call(object, "SetTrusted", NULL, + G_TYPE_STRING, input->address, G_TYPE_INVALID, + G_TYPE_INVALID); +} + +static void auth_callback(gint response, gpointer user_data) +{ + +/* I must call this function with the alway allow option and + * don't boder to aks the user - to many questions + */ + struct input_data *input = user_data; + + if (response == GTK_RESPONSE_YES) { + set_trusted(input); + dbus_g_method_return(input->context); + } else { + GError *error; + error = g_error_new(AGENT_ERROR, AGENT_ERROR_REJECT, + "Authorization request rejected"); + dbus_g_method_return_error(input->context, error); + } + + input_free(input); +} + + +static void passkey_dialog(const char *path, const char *address, + const gchar *device, DBusGMethodInvocation *context) +{ + struct input_data *input; + + input = g_try_malloc0(sizeof(*input)); + if (!input) + return; + + input->path = g_strdup(path); + input->address = g_strdup(address); + + input->context = context; + + + +/* + g_signal_connect(G_OBJECT(entry), "changed", + G_CALLBACK(changed_callback), input); + + + g_signal_connect(G_OBJECT(button), "toggled", + G_CALLBACK(toggled_callback), input); + + gtk_container_add(GTK_CONTAINER(vbox), button); + + input_list = g_list_append(input_list, input); + + g_signal_connect(G_OBJECT(dialog), "response", + G_CALLBACK(passkey_callback), input); + + enable_blinking(); +*/ +} + +static void confirm_dialog(const char *path, const char *address, + const char *value, const gchar *device, + DBusGMethodInvocation *context) +{ + struct input_data *input; + + input = g_try_malloc0(sizeof(*input)); + if (!input) + return; + + input->path = g_strdup(path); + input->address = g_strdup(address); + + input->context = context; + + +// g_signal_connect(G_OBJECT(dialog), "response", +// G_CALLBACK(confirm_callback), input); + + //enable_blinking(); +} + +static void auth_dialog(const char *path, const char *address, + const char *service, const char *uuid, const gchar *device, + const gchar *profile, DBusGMethodInvocation *context) +{ + GtkWidget *dialog; + GtkWidget *button; + GtkWidget *image; + GtkWidget *label; + GtkWidget *table; + GtkWidget *vbox; + gchar *markup, *text; + struct input_data *input; + + input = g_try_malloc0(sizeof(*input)); + if (!input) + return; + + input->path = g_strdup(path); + input->address = g_strdup(address); + input->service = g_strdup(service); + input->uuid = g_strdup(uuid); + + input->context = context; + + + /* translators: Whether to grant access to a particular service + * to the device mentioned */ + +// g_signal_connect(G_OBJECT(dialog), "response", +// G_CALLBACK(auth_callback), input); + + //enable_blinking(); +} + +typedef struct { + GObject parent; +} PasskeyAgent; + +typedef struct { + GObjectClass parent; +} PasskeyAgentClass; + +static GObjectClass *passkey_agent_parent; + +G_DEFINE_TYPE(PasskeyAgent, passkey_agent, G_TYPE_OBJECT) + +#define PASSKEY_AGENT_OBJECT_TYPE (passkey_agent_get_type()) + +#define PASSKEY_AGENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + PASSKEY_AGENT_OBJECT_TYPE, PasskeyAgent)) + +static void passkey_agent_finalize(GObject *obj) +{ + passkey_agent_parent->finalize(obj); +} + +static void passkey_agent_init(PasskeyAgent *obj) +{ +} + +static void passkey_agent_class_init(PasskeyAgentClass *klass) +{ + GObjectClass *gobject_class; + + passkey_agent_parent = g_type_class_peek_parent(klass); + + gobject_class = G_OBJECT_CLASS(klass); + gobject_class->finalize = passkey_agent_finalize; +} + +static PasskeyAgent *passkey_agent_new(const char *path) +{ + PasskeyAgent *agent; + + agent = g_object_new(PASSKEY_AGENT_OBJECT_TYPE, NULL); + + dbus_g_connection_register_g_object(connection, path, G_OBJECT(agent)); + + return agent; +} + + + +static gboolean passkey_agent_request(PasskeyAgent *agent, + const char *path, const char *address, + DBusGMethodInvocation *context) +{ + DBusGProxy *object; + const char *adapter = NULL, *name = NULL; + gchar *device, *line; + + object = dbus_g_proxy_new_for_name(connection, "org.bluez", + path, "org.bluez.Adapter"); + + dbus_g_proxy_call(object, "GetName", NULL, G_TYPE_INVALID, + G_TYPE_STRING, &adapter, G_TYPE_INVALID); + + dbus_g_proxy_call(object, "GetRemoteName", NULL, + G_TYPE_STRING, address, G_TYPE_INVALID, + G_TYPE_STRING, &name, G_TYPE_INVALID); + + if (name) { + if (g_strrstr(name, address)) + device = g_strdup(name); + else + device = g_strdup_printf("%s (%s)", name, address); + } else + device = g_strdup(address); + + passkey_dialog(path, address, device, context); + + /* translators: this is a popup telling you a particular device + * has asked for pairing */ + line = g_strdup_printf(_("Pairing request for '%s'"), device); + g_free(device); + + /*show_notification(adapter ? adapter : _("Bluetooth device"), + line, _("Enter passkey"), 0, + G_CALLBACK(notification_closed)); +*/ + g_free(line); + + return TRUE; +} + +static gboolean passkey_agent_confirm(PasskeyAgent *agent, + const char *path, const char *address, + const char *value, DBusGMethodInvocation *context) +{ + DBusGProxy *object; + const char *adapter = NULL, *name = NULL; + gchar *device, *line; + + object = dbus_g_proxy_new_for_name(connection, "org.bluez", + path, "org.bluez.Adapter"); + + dbus_g_proxy_call(object, "GetName", NULL, G_TYPE_INVALID, + G_TYPE_STRING, &adapter, G_TYPE_INVALID); + + dbus_g_proxy_call(object, "GetRemoteName", NULL, + G_TYPE_STRING, address, G_TYPE_INVALID, + G_TYPE_STRING, &name, G_TYPE_INVALID); + + if (name) { + if (g_strrstr(name, address)) + device = g_strdup(name); + else + device = g_strdup_printf("%s (%s)", name, address); + } else + device = g_strdup(address); + + confirm_dialog(path, address, value, device, context); + + line = g_strdup_printf(_("Pairing request for '%s'"), device); + g_free(device); + + /*show_notification(adapter ? adapter : _("Bluetooth device"), + line, _("Confirm pairing"), 0, + G_CALLBACK(notification_closed)); +*/ + g_free (line); + + return TRUE; +} + +static gboolean passkey_agent_cancel(PasskeyAgent *agent, + const char *path, const char *address, GError **error) +{ + GList *list; + GError *result; + struct input_data *input; + + input = g_try_malloc0(sizeof(*input)); + if (!input) + return FALSE; + + input->path = g_strdup(path); + input->address = g_strdup(address); + + list = g_list_find_custom(input_list, input, input_compare); + + g_free(input->address); + g_free(input->path); + g_free(input); + + if (!list || !list->data) + return FALSE; + + input = list->data; + + //close_notification(); + + result = g_error_new(AGENT_ERROR, AGENT_ERROR_REJECT, + "Agent callback canceled"); + + dbus_g_method_return_error(input->context, result); + + input_free(input); + + return TRUE; +} + +static gboolean passkey_agent_release(PasskeyAgent *agent, GError **error) +{ + registered_passkey = 0; + + return TRUE; +} + +#include "passkey-agent-glue.h" + +typedef struct { + GObject parent; +} AuthAgent; + +typedef struct { + GObjectClass parent; +} AuthAgentClass; + +static GObjectClass *auth_agent_parent; + +G_DEFINE_TYPE(AuthAgent, auth_agent, G_TYPE_OBJECT) + +#define AUTH_AGENT_OBJECT_TYPE (auth_agent_get_type()) + +#define AUTH_AGENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + AUTH_AGENT_OBJECT_TYPE, AuthAgent)) + +static void auth_agent_finalize(GObject *obj) +{ + auth_agent_parent->finalize(obj); +} + +static void auth_agent_init(AuthAgent *obj) +{ +} + +static void auth_agent_class_init(AuthAgentClass *klass) +{ + GObjectClass *gobject_class; + + auth_agent_parent = g_type_class_peek_parent(klass); + + gobject_class = G_OBJECT_CLASS(klass); + gobject_class->finalize = auth_agent_finalize; +} + +static AuthAgent *auth_agent_new(const char *path) +{ + AuthAgent *agent; + + agent = g_object_new(AUTH_AGENT_OBJECT_TYPE, NULL); + + dbus_g_connection_register_g_object(connection, path, G_OBJECT(agent)); + + return agent; +} + +static gboolean auth_agent_authorize(PasskeyAgent *agent, + const char *path, const char *address, const char *service, + const char *uuid, DBusGMethodInvocation *context) +{ + DBusGProxy *object; + const char *adapter = NULL, *name = NULL; + gchar *device, *profile, *line; + + if (auto_authorize == TRUE) { + dbus_g_method_return(context); + return TRUE; + } + + object = dbus_g_proxy_new_for_name(connection, "org.bluez", + path, "org.bluez.Adapter"); + + dbus_g_proxy_call(object, "GetName", NULL, G_TYPE_INVALID, + G_TYPE_STRING, &adapter, G_TYPE_INVALID); + + dbus_g_proxy_call(object, "GetRemoteName", NULL, + G_TYPE_STRING, address, G_TYPE_INVALID, + G_TYPE_STRING, &name, G_TYPE_INVALID); + + object = dbus_g_proxy_new_for_name(connection, "org.bluez", + service, "org.bluez.Service"); + + dbus_g_proxy_call(object, "GetName", NULL, G_TYPE_INVALID, + G_TYPE_STRING, &profile, G_TYPE_INVALID); + + if (name) { + if (g_strrstr(name, address)) + device = g_strdup(name); + else + device = g_strdup_printf("%s (%s)", name, address); + } else + device = g_strdup(address); + + auth_dialog(path, address, service, uuid, device, profile, context); + + line = g_strdup_printf(_("Authorization request for %s"), device); + g_free(device); + + /*show_notification(adapter ? adapter : _("Bluetooth device"), + line, _("Check authorization"), 0, + G_CALLBACK(notification_closed)); +*/ + g_free(line); + + return TRUE; +} + +static gboolean auth_agent_cancel(PasskeyAgent *agent, + const char *path, const char *address, const char *service, + const char *uuid, DBusGMethodInvocation *context) +{ + GList *list; + GError *result; + struct input_data *input; + + input = g_try_malloc0(sizeof(*input)); + if (!input) + return FALSE; + + input->path = g_strdup(path); + input->address = g_strdup(address); + input->service = g_strdup(service); + input->uuid = g_strdup(uuid); + + list = g_list_find_custom(input_list, input, input_compare); + + g_free(input->uuid); + g_free(input->service); + g_free(input->address); + g_free(input->path); + g_free(input); + + if (!list || !list->data) + return FALSE; + + input = list->data; + + //close_notification(); + + result = g_error_new(AGENT_ERROR, AGENT_ERROR_REJECT, + "Agent callback canceled"); + + dbus_g_method_return_error(input->context, result); + + input_free(input); + + return TRUE; +} + +static gboolean auth_agent_release(PasskeyAgent *agent, GError **error) +{ + registered_auth = 0; + + return TRUE; +} + +#include "auth-agent-glue.h" + +int register_agents(void) +{ + DBusGProxy *object; + GError *error = NULL; + + if (registered_passkey && registered_auth) + return 0; + + object = dbus_g_proxy_new_for_name(connection, "org.bluez", + "/org/bluez", "org.bluez.Security"); + + if (!registered_passkey) { + + dbus_g_proxy_call(object, "RegisterDefaultPasskeyAgent", + &error, G_TYPE_STRING, PASSKEY_AGENT_PATH, + G_TYPE_INVALID, G_TYPE_INVALID); + + if (error != NULL) { + g_error_free(error); + return -1; + } + + registered_passkey = 1; + } + + if (!registered_auth) { + dbus_g_proxy_call(object, "RegisterDefaultAuthorizationAgent", + &error, G_TYPE_STRING, AUTH_AGENT_PATH, + G_TYPE_INVALID, G_TYPE_INVALID); + + if (error != NULL) { + g_error_free(error); + return -1; + } + + registered_auth = 1; + } + + return 0; +} + +void unregister_agents(void) +{ + registered_passkey = 0; + registered_auth = 0; +} + +int setup_agents(DBusGConnection *conn) +{ + void *agent; + + connection = dbus_g_connection_ref(conn); + + dbus_g_object_type_install_info(PASSKEY_AGENT_OBJECT_TYPE, + &dbus_glib_passkey_agent_object_info); + + dbus_g_object_type_install_info(AUTH_AGENT_OBJECT_TYPE, + &dbus_glib_auth_agent_object_info); + + dbus_g_error_domain_register(AGENT_ERROR, "org.bluez.Error", + AGENT_ERROR_TYPE); + + agent = passkey_agent_new(PASSKEY_AGENT_PATH); + + agent = auth_agent_new(AUTH_AGENT_PATH); + + return 0; +} + +void cleanup_agents(void) +{ + unregister_agents(); + + dbus_g_connection_unref(connection); +} + +void show_agents(void) +{ + //close_notification(); + +// g_list_foreach(input_list, show_dialog, NULL); + +// disable_blinking(); +} + +void set_auto_authorize(gboolean value) +{ + auto_authorize = value; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/bluetooth/agent.h Wed Jul 16 20:48:09 2008 +0300 @@ -0,0 +1,12 @@ +#include <gtk/gtk.h> +#include <glib.h> +#include <dbus/dbus-glib.h> +void run_agent(void); +int setup_agents(DBusGConnection *conn); +void cleanup_agents(void); + +int register_agents(void); +void unregister_agents(void); + +void show_agents(void); +void set_auto_authorize(gboolean value);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/bluetooth/auth-agent-glue.h Wed Jul 16 20:48:09 2008 +0300 @@ -0,0 +1,223 @@ +/* Generated by dbus-binding-tool; do not edit! */ + + +#ifndef __dbus_glib_marshal_auth_agent_MARSHAL_H__ +#define __dbus_glib_marshal_auth_agent_MARSHAL_H__ + +#include <glib-object.h> + +G_BEGIN_DECLS + +#ifdef G_ENABLE_DEBUG +#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v) +#define g_marshal_value_peek_char(v) g_value_get_char (v) +#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v) +#define g_marshal_value_peek_int(v) g_value_get_int (v) +#define g_marshal_value_peek_uint(v) g_value_get_uint (v) +#define g_marshal_value_peek_long(v) g_value_get_long (v) +#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v) +#define g_marshal_value_peek_int64(v) g_value_get_int64 (v) +#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v) +#define g_marshal_value_peek_enum(v) g_value_get_enum (v) +#define g_marshal_value_peek_flags(v) g_value_get_flags (v) +#define g_marshal_value_peek_float(v) g_value_get_float (v) +#define g_marshal_value_peek_double(v) g_value_get_double (v) +#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v) +#define g_marshal_value_peek_param(v) g_value_get_param (v) +#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v) +#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v) +#define g_marshal_value_peek_object(v) g_value_get_object (v) +#else /* !G_ENABLE_DEBUG */ +/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API. + * Do not access GValues directly in your code. Instead, use the + * g_value_get_*() functions + */ +#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int +#define g_marshal_value_peek_char(v) (v)->data[0].v_int +#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint +#define g_marshal_value_peek_int(v) (v)->data[0].v_int +#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint +#define g_marshal_value_peek_long(v) (v)->data[0].v_long +#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong +#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64 +#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64 +#define g_marshal_value_peek_enum(v) (v)->data[0].v_long +#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong +#define g_marshal_value_peek_float(v) (v)->data[0].v_float +#define g_marshal_value_peek_double(v) (v)->data[0].v_double +#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer +#endif /* !G_ENABLE_DEBUG */ + + +/* BOOLEAN:STRING,STRING,STRING,STRING,POINTER (/tmp/dbus-binding-tool-c-marshallers.9NIBEU:1) */ +extern void dbus_glib_marshal_auth_agent_BOOLEAN__STRING_STRING_STRING_STRING_POINTER (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +void +dbus_glib_marshal_auth_agent_BOOLEAN__STRING_STRING_STRING_STRING_POINTER (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef gboolean (*GMarshalFunc_BOOLEAN__STRING_STRING_STRING_STRING_POINTER) (gpointer data1, + gpointer arg_1, + gpointer arg_2, + gpointer arg_3, + gpointer arg_4, + gpointer arg_5, + gpointer data2); + register GMarshalFunc_BOOLEAN__STRING_STRING_STRING_STRING_POINTER callback; + register GCClosure *cc = (GCClosure*) closure; + register gpointer data1, data2; + gboolean v_return; + + g_return_if_fail (return_value != NULL); + g_return_if_fail (n_param_values == 6); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_BOOLEAN__STRING_STRING_STRING_STRING_POINTER) (marshal_data ? marshal_data : cc->callback); + + v_return = callback (data1, + g_marshal_value_peek_string (param_values + 1), + g_marshal_value_peek_string (param_values + 2), + g_marshal_value_peek_string (param_values + 3), + g_marshal_value_peek_string (param_values + 4), + g_marshal_value_peek_pointer (param_values + 5), + data2); + + g_value_set_boolean (return_value, v_return); +} + +/* NONE:STRING,STRING,STRING,STRING,POINTER (/tmp/dbus-binding-tool-c-marshallers.9NIBEU:2) */ +extern void dbus_glib_marshal_auth_agent_VOID__STRING_STRING_STRING_STRING_POINTER (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +void +dbus_glib_marshal_auth_agent_VOID__STRING_STRING_STRING_STRING_POINTER (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__STRING_STRING_STRING_STRING_POINTER) (gpointer data1, + gpointer arg_1, + gpointer arg_2, + gpointer arg_3, + gpointer arg_4, + gpointer arg_5, + gpointer data2); + register GMarshalFunc_VOID__STRING_STRING_STRING_STRING_POINTER callback; + register GCClosure *cc = (GCClosure*) closure; + register gpointer data1, data2; + + g_return_if_fail (n_param_values == 6); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__STRING_STRING_STRING_STRING_POINTER) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_string (param_values + 1), + g_marshal_value_peek_string (param_values + 2), + g_marshal_value_peek_string (param_values + 3), + g_marshal_value_peek_string (param_values + 4), + g_marshal_value_peek_pointer (param_values + 5), + data2); +} +#define dbus_glib_marshal_auth_agent_NONE__STRING_STRING_STRING_STRING_POINTER dbus_glib_marshal_auth_agent_VOID__STRING_STRING_STRING_STRING_POINTER + +/* BOOLEAN:POINTER (/tmp/dbus-binding-tool-c-marshallers.9NIBEU:3) */ +extern void dbus_glib_marshal_auth_agent_BOOLEAN__POINTER (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +void +dbus_glib_marshal_auth_agent_BOOLEAN__POINTER (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef gboolean (*GMarshalFunc_BOOLEAN__POINTER) (gpointer data1, + gpointer arg_1, + gpointer data2); + register GMarshalFunc_BOOLEAN__POINTER callback; + register GCClosure *cc = (GCClosure*) closure; + register gpointer data1, data2; + gboolean v_return; + + g_return_if_fail (return_value != NULL); + g_return_if_fail (n_param_values == 2); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_BOOLEAN__POINTER) (marshal_data ? marshal_data : cc->callback); + + v_return = callback (data1, + g_marshal_value_peek_pointer (param_values + 1), + data2); + + g_value_set_boolean (return_value, v_return); +} + +G_END_DECLS + +#endif /* __dbus_glib_marshal_auth_agent_MARSHAL_H__ */ + +#include <dbus/dbus-glib.h> +static const DBusGMethodInfo dbus_glib_auth_agent_methods[] = { + { (GCallback) auth_agent_authorize, dbus_glib_marshal_auth_agent_NONE__STRING_STRING_STRING_STRING_POINTER, 0 }, + { (GCallback) auth_agent_cancel, dbus_glib_marshal_auth_agent_BOOLEAN__STRING_STRING_STRING_STRING_POINTER, 87 }, + { (GCallback) auth_agent_release, dbus_glib_marshal_auth_agent_BOOLEAN__POINTER, 171 }, +}; + +const DBusGObjectInfo dbus_glib_auth_agent_object_info = { + 0, + dbus_glib_auth_agent_methods, + 3, +"org.bluez.AuthorizationAgent\0Authorize\0A\0adapter\0I\0s\0address\0I\0s\0service\0I\0s\0uuid\0I\0s\0\0org.bluez.AuthorizationAgent\0Cancel\0S\0adapter\0I\0s\0address\0I\0s\0service\0I\0s\0uuid\0I\0s\0\0org.bluez.AuthorizationAgent\0Release\0S\0\0\0", +"\0", +"\0" +}; +
--- a/src/bluetooth/bluetooth.c Mon Jul 14 18:07:03 2008 +0200 +++ b/src/bluetooth/bluetooth.c Wed Jul 16 20:48:09 2008 +0300 @@ -1,16 +1,11 @@ -#include <dbus/dbus.h> -#include <dbus/dbus-glib.h> -#include <glib-object.h> -#include <stdio.h> #include "bluetooth.h" #include "marshal.h" #include "gui.h" #include "scan_gui.h" +#include "agent.h" #define DEBUG 1 static gboolean plugin_active = FALSE,exiting=FALSE; GList * current_device = NULL; -DBusGConnection * bus = NULL; -DBusGProxy * obj = NULL; gint config = 0; gint devices_no = 0; GStaticMutex mutex = G_STATIC_MUTEX_INIT; @@ -42,6 +37,8 @@ void bluetooth_init ( void ) { audio_devices = NULL; + bus = NULL; + obj = NULL; discover_devices(); } @@ -63,7 +60,7 @@ void bt_about( void ) { printf("about call\n"); - show_scan(); + run_agent(); } void bt_cfg(void) @@ -115,9 +112,35 @@ printf("Scanning please wait!\n"); } +void bounding_created(gchar* address) +{ + printf("Signal BoundingCreated : %s\n",address); + +} + +void bounding_removed(gchar* address) +{ + printf("Signal: BoundingRemoved: %s\n",address); + +} + + void connect_call(void) { - printf("connect function \n"); + + //I will have to enable the audio service if necessary + + /* dbus_g_object_register_marshaller(marshal_VOID__STRING_UINT_INT, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INT, G_TYPE_INVALID); + dbus_g_proxy_add_signal(obj, "BondingCreated", G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INT, G_TYPE_INVALID); + dbus_g_proxy_connect_signal(obj, "BondingCreated", G_CALLBACK(bounding_created), bus, NULL); + + dbus_g_proxy_add_signal(obj, "BondingRemoved", G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INT, G_TYPE_INVALID); + dbus_g_proxy_connect_signal(obj, "BondingRemoved", G_CALLBACK(bounding_removed), bus, NULL); + */ + dbus_g_proxy_call(obj,"CreateBonding",NULL,G_TYPE_STRING,"00:0D:3C:B1:1C:7A",G_TYPE_INVALID,G_TYPE_INVALID); + + + }
--- a/src/bluetooth/bluetooth.h Mon Jul 14 18:07:03 2008 +0200 +++ b/src/bluetooth/bluetooth.h Wed Jul 16 20:48:09 2008 +0300 @@ -1,5 +1,4 @@ #include <config.h> - #include <glib.h> #include <sys/types.h> #include <audacious/plugin.h> @@ -7,6 +6,11 @@ #include <audacious/i18n.h> #include <gtk/gtk.h> #include <audacious/util.h> +#include <dbus/dbus.h> +#include <dbus/dbus-glib.h> +#include <glib-object.h> +#include <stdio.h> + #include "gui.h" typedef struct { guint class; @@ -20,5 +24,7 @@ void connect_call(void); GList * audio_devices; gint discover_finish ; +DBusGConnection * bus; +DBusGProxy * obj;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/bluetooth/dbus-glue.h Wed Jul 16 20:48:09 2008 +0300 @@ -0,0 +1,813 @@ +/* Generated by dbus-binding-tool; do not edit! */ + +#include <glib/gtypes.h> +#include <glib/gerror.h> +#include <dbus/dbus-glib.h> + +G_BEGIN_DECLS + +#ifndef DBUS_GLIB_CLIENT_WRAPPERS_manager +#define DBUS_GLIB_CLIENT_WRAPPERS_manager + +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean +manager_default_adapter (DBusGProxy *proxy, char ** OUT_arg0, GError **error) + +{ + return dbus_g_proxy_call (proxy, "DefaultAdapter", error, G_TYPE_INVALID, G_TYPE_STRING, OUT_arg0, G_TYPE_INVALID); +} + +typedef void (*manager_default_adapter_reply) (DBusGProxy *proxy, char * OUT_arg0, GError *error, gpointer userdata); + +static void +manager_default_adapter_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) +{ + DBusGAsyncData *data = (DBusGAsyncData*) user_data; + GError *error = NULL; + char * OUT_arg0; + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_STRING, &OUT_arg0, G_TYPE_INVALID); + (*(manager_default_adapter_reply)data->cb) (proxy, OUT_arg0, error, data->userdata); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +manager_default_adapter_async (DBusGProxy *proxy, manager_default_adapter_reply callback, gpointer userdata) + +{ + DBusGAsyncData *stuff; + stuff = g_new (DBusGAsyncData, 1); + stuff->cb = G_CALLBACK (callback); + stuff->userdata = userdata; + return dbus_g_proxy_begin_call (proxy, "DefaultAdapter", manager_default_adapter_async_callback, stuff, g_free, G_TYPE_INVALID); +} +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean +manager_find_adapter (DBusGProxy *proxy, const char * IN_pattern, char ** OUT_arg1, GError **error) + +{ + return dbus_g_proxy_call (proxy, "FindAdapter", error, G_TYPE_STRING, IN_pattern, G_TYPE_INVALID, G_TYPE_STRING, OUT_arg1, G_TYPE_INVALID); +} + +typedef void (*manager_find_adapter_reply) (DBusGProxy *proxy, char * OUT_arg1, GError *error, gpointer userdata); + +static void +manager_find_adapter_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) +{ + DBusGAsyncData *data = (DBusGAsyncData*) user_data; + GError *error = NULL; + char * OUT_arg1; + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_STRING, &OUT_arg1, G_TYPE_INVALID); + (*(manager_find_adapter_reply)data->cb) (proxy, OUT_arg1, error, data->userdata); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +manager_find_adapter_async (DBusGProxy *proxy, const char * IN_pattern, manager_find_adapter_reply callback, gpointer userdata) + +{ + DBusGAsyncData *stuff; + stuff = g_new (DBusGAsyncData, 1); + stuff->cb = G_CALLBACK (callback); + stuff->userdata = userdata; + return dbus_g_proxy_begin_call (proxy, "FindAdapter", manager_find_adapter_async_callback, stuff, g_free, G_TYPE_STRING, IN_pattern, G_TYPE_INVALID); +} +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean +manager_list_adapters (DBusGProxy *proxy, char *** OUT_arg0, GError **error) + +{ + return dbus_g_proxy_call (proxy, "ListAdapters", error, G_TYPE_INVALID, G_TYPE_STRV, OUT_arg0, G_TYPE_INVALID); +} + +typedef void (*manager_list_adapters_reply) (DBusGProxy *proxy, char * *OUT_arg0, GError *error, gpointer userdata); + +static void +manager_list_adapters_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) +{ + DBusGAsyncData *data = (DBusGAsyncData*) user_data; + GError *error = NULL; + char ** OUT_arg0; + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_STRV, &OUT_arg0, G_TYPE_INVALID); + (*(manager_list_adapters_reply)data->cb) (proxy, OUT_arg0, error, data->userdata); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +manager_list_adapters_async (DBusGProxy *proxy, manager_list_adapters_reply callback, gpointer userdata) + +{ + DBusGAsyncData *stuff; + stuff = g_new (DBusGAsyncData, 1); + stuff->cb = G_CALLBACK (callback); + stuff->userdata = userdata; + return dbus_g_proxy_begin_call (proxy, "ListAdapters", manager_list_adapters_async_callback, stuff, g_free, G_TYPE_INVALID); +} +#endif /* defined DBUS_GLIB_CLIENT_WRAPPERS_manager */ + +#ifndef DBUS_GLIB_CLIENT_WRAPPERS_security +#define DBUS_GLIB_CLIENT_WRAPPERS_security + +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean +security_register_default_passkey_agent (DBusGProxy *proxy, const char * IN_path, GError **error) + +{ + return dbus_g_proxy_call (proxy, "RegisterDefaultPasskeyAgent", error, G_TYPE_STRING, IN_path, G_TYPE_INVALID, G_TYPE_INVALID); +} + +typedef void (*security_register_default_passkey_agent_reply) (DBusGProxy *proxy, GError *error, gpointer userdata); + +static void +security_register_default_passkey_agent_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) +{ + DBusGAsyncData *data = (DBusGAsyncData*) user_data; + GError *error = NULL; + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); + (*(security_register_default_passkey_agent_reply)data->cb) (proxy, error, data->userdata); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +security_register_default_passkey_agent_async (DBusGProxy *proxy, const char * IN_path, security_register_default_passkey_agent_reply callback, gpointer userdata) + +{ + DBusGAsyncData *stuff; + stuff = g_new (DBusGAsyncData, 1); + stuff->cb = G_CALLBACK (callback); + stuff->userdata = userdata; + return dbus_g_proxy_begin_call (proxy, "RegisterDefaultPasskeyAgent", security_register_default_passkey_agent_async_callback, stuff, g_free, G_TYPE_STRING, IN_path, G_TYPE_INVALID); +} +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean +security_unregister_default_passkey_agent (DBusGProxy *proxy, const char * IN_path, GError **error) + +{ + return dbus_g_proxy_call (proxy, "UnregisterDefaultPasskeyAgent", error, G_TYPE_STRING, IN_path, G_TYPE_INVALID, G_TYPE_INVALID); +} + +typedef void (*security_unregister_default_passkey_agent_reply) (DBusGProxy *proxy, GError *error, gpointer userdata); + +static void +security_unregister_default_passkey_agent_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) +{ + DBusGAsyncData *data = (DBusGAsyncData*) user_data; + GError *error = NULL; + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); + (*(security_unregister_default_passkey_agent_reply)data->cb) (proxy, error, data->userdata); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +security_unregister_default_passkey_agent_async (DBusGProxy *proxy, const char * IN_path, security_unregister_default_passkey_agent_reply callback, gpointer userdata) + +{ + DBusGAsyncData *stuff; + stuff = g_new (DBusGAsyncData, 1); + stuff->cb = G_CALLBACK (callback); + stuff->userdata = userdata; + return dbus_g_proxy_begin_call (proxy, "UnregisterDefaultPasskeyAgent", security_unregister_default_passkey_agent_async_callback, stuff, g_free, G_TYPE_STRING, IN_path, G_TYPE_INVALID); +} +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean +security_register_passkey_agent (DBusGProxy *proxy, const char * IN_path, const char * IN_address, GError **error) + +{ + return dbus_g_proxy_call (proxy, "RegisterPasskeyAgent", error, G_TYPE_STRING, IN_path, G_TYPE_STRING, IN_address, G_TYPE_INVALID, G_TYPE_INVALID); +} + +typedef void (*security_register_passkey_agent_reply) (DBusGProxy *proxy, GError *error, gpointer userdata); + +static void +security_register_passkey_agent_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) +{ + DBusGAsyncData *data = (DBusGAsyncData*) user_data; + GError *error = NULL; + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); + (*(security_register_passkey_agent_reply)data->cb) (proxy, error, data->userdata); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +security_register_passkey_agent_async (DBusGProxy *proxy, const char * IN_path, const char * IN_address, security_register_passkey_agent_reply callback, gpointer userdata) + +{ + DBusGAsyncData *stuff; + stuff = g_new (DBusGAsyncData, 1); + stuff->cb = G_CALLBACK (callback); + stuff->userdata = userdata; + return dbus_g_proxy_begin_call (proxy, "RegisterPasskeyAgent", security_register_passkey_agent_async_callback, stuff, g_free, G_TYPE_STRING, IN_path, G_TYPE_STRING, IN_address, G_TYPE_INVALID); +} +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean +security_unregister_passkey_agent (DBusGProxy *proxy, const char * IN_path, const char * IN_address, GError **error) + +{ + return dbus_g_proxy_call (proxy, "UnregisterPasskeyAgent", error, G_TYPE_STRING, IN_path, G_TYPE_STRING, IN_address, G_TYPE_INVALID, G_TYPE_INVALID); +} + +typedef void (*security_unregister_passkey_agent_reply) (DBusGProxy *proxy, GError *error, gpointer userdata); + +static void +security_unregister_passkey_agent_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) +{ + DBusGAsyncData *data = (DBusGAsyncData*) user_data; + GError *error = NULL; + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); + (*(security_unregister_passkey_agent_reply)data->cb) (proxy, error, data->userdata); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +security_unregister_passkey_agent_async (DBusGProxy *proxy, const char * IN_path, const char * IN_address, security_unregister_passkey_agent_reply callback, gpointer userdata) + +{ + DBusGAsyncData *stuff; + stuff = g_new (DBusGAsyncData, 1); + stuff->cb = G_CALLBACK (callback); + stuff->userdata = userdata; + return dbus_g_proxy_begin_call (proxy, "UnregisterPasskeyAgent", security_unregister_passkey_agent_async_callback, stuff, g_free, G_TYPE_STRING, IN_path, G_TYPE_STRING, IN_address, G_TYPE_INVALID); +} +#endif /* defined DBUS_GLIB_CLIENT_WRAPPERS_security */ + +#ifndef DBUS_GLIB_CLIENT_WRAPPERS_adapter +#define DBUS_GLIB_CLIENT_WRAPPERS_adapter + +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean +adapter_get_address (DBusGProxy *proxy, char ** OUT_arg0, GError **error) + +{ + return dbus_g_proxy_call (proxy, "GetAddress", error, G_TYPE_INVALID, G_TYPE_STRING, OUT_arg0, G_TYPE_INVALID); +} + +typedef void (*adapter_get_address_reply) (DBusGProxy *proxy, char * OUT_arg0, GError *error, gpointer userdata); + +static void +adapter_get_address_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) +{ + DBusGAsyncData *data = (DBusGAsyncData*) user_data; + GError *error = NULL; + char * OUT_arg0; + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_STRING, &OUT_arg0, G_TYPE_INVALID); + (*(adapter_get_address_reply)data->cb) (proxy, OUT_arg0, error, data->userdata); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +adapter_get_address_async (DBusGProxy *proxy, adapter_get_address_reply callback, gpointer userdata) + +{ + DBusGAsyncData *stuff; + stuff = g_new (DBusGAsyncData, 1); + stuff->cb = G_CALLBACK (callback); + stuff->userdata = userdata; + return dbus_g_proxy_begin_call (proxy, "GetAddress", adapter_get_address_async_callback, stuff, g_free, G_TYPE_INVALID); +} +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean +adapter_get_mode (DBusGProxy *proxy, char ** OUT_arg0, GError **error) + +{ + return dbus_g_proxy_call (proxy, "GetMode", error, G_TYPE_INVALID, G_TYPE_STRING, OUT_arg0, G_TYPE_INVALID); +} + +typedef void (*adapter_get_mode_reply) (DBusGProxy *proxy, char * OUT_arg0, GError *error, gpointer userdata); + +static void +adapter_get_mode_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) +{ + DBusGAsyncData *data = (DBusGAsyncData*) user_data; + GError *error = NULL; + char * OUT_arg0; + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_STRING, &OUT_arg0, G_TYPE_INVALID); + (*(adapter_get_mode_reply)data->cb) (proxy, OUT_arg0, error, data->userdata); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +adapter_get_mode_async (DBusGProxy *proxy, adapter_get_mode_reply callback, gpointer userdata) + +{ + DBusGAsyncData *stuff; + stuff = g_new (DBusGAsyncData, 1); + stuff->cb = G_CALLBACK (callback); + stuff->userdata = userdata; + return dbus_g_proxy_begin_call (proxy, "GetMode", adapter_get_mode_async_callback, stuff, g_free, G_TYPE_INVALID); +} +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean +adapter_get_name (DBusGProxy *proxy, char ** OUT_arg0, GError **error) + +{ + return dbus_g_proxy_call (proxy, "GetName", error, G_TYPE_INVALID, G_TYPE_STRING, OUT_arg0, G_TYPE_INVALID); +} + +typedef void (*adapter_get_name_reply) (DBusGProxy *proxy, char * OUT_arg0, GError *error, gpointer userdata); + +static void +adapter_get_name_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) +{ + DBusGAsyncData *data = (DBusGAsyncData*) user_data; + GError *error = NULL; + char * OUT_arg0; + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_STRING, &OUT_arg0, G_TYPE_INVALID); + (*(adapter_get_name_reply)data->cb) (proxy, OUT_arg0, error, data->userdata); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +adapter_get_name_async (DBusGProxy *proxy, adapter_get_name_reply callback, gpointer userdata) + +{ + DBusGAsyncData *stuff; + stuff = g_new (DBusGAsyncData, 1); + stuff->cb = G_CALLBACK (callback); + stuff->userdata = userdata; + return dbus_g_proxy_begin_call (proxy, "GetName", adapter_get_name_async_callback, stuff, g_free, G_TYPE_INVALID); +} +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean +adapter_get_major_class (DBusGProxy *proxy, char ** OUT_arg0, GError **error) + +{ + return dbus_g_proxy_call (proxy, "GetMajorClass", error, G_TYPE_INVALID, G_TYPE_STRING, OUT_arg0, G_TYPE_INVALID); +} + +typedef void (*adapter_get_major_class_reply) (DBusGProxy *proxy, char * OUT_arg0, GError *error, gpointer userdata); + +static void +adapter_get_major_class_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) +{ + DBusGAsyncData *data = (DBusGAsyncData*) user_data; + GError *error = NULL; + char * OUT_arg0; + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_STRING, &OUT_arg0, G_TYPE_INVALID); + (*(adapter_get_major_class_reply)data->cb) (proxy, OUT_arg0, error, data->userdata); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +adapter_get_major_class_async (DBusGProxy *proxy, adapter_get_major_class_reply callback, gpointer userdata) + +{ + DBusGAsyncData *stuff; + stuff = g_new (DBusGAsyncData, 1); + stuff->cb = G_CALLBACK (callback); + stuff->userdata = userdata; + return dbus_g_proxy_begin_call (proxy, "GetMajorClass", adapter_get_major_class_async_callback, stuff, g_free, G_TYPE_INVALID); +} +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean +adapter_get_minor_class (DBusGProxy *proxy, char ** OUT_arg0, GError **error) + +{ + return dbus_g_proxy_call (proxy, "GetMinorClass", error, G_TYPE_INVALID, G_TYPE_STRING, OUT_arg0, G_TYPE_INVALID); +} + +typedef void (*adapter_get_minor_class_reply) (DBusGProxy *proxy, char * OUT_arg0, GError *error, gpointer userdata); + +static void +adapter_get_minor_class_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) +{ + DBusGAsyncData *data = (DBusGAsyncData*) user_data; + GError *error = NULL; + char * OUT_arg0; + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_STRING, &OUT_arg0, G_TYPE_INVALID); + (*(adapter_get_minor_class_reply)data->cb) (proxy, OUT_arg0, error, data->userdata); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +adapter_get_minor_class_async (DBusGProxy *proxy, adapter_get_minor_class_reply callback, gpointer userdata) + +{ + DBusGAsyncData *stuff; + stuff = g_new (DBusGAsyncData, 1); + stuff->cb = G_CALLBACK (callback); + stuff->userdata = userdata; + return dbus_g_proxy_begin_call (proxy, "GetMinorClass", adapter_get_minor_class_async_callback, stuff, g_free, G_TYPE_INVALID); +} +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean +adapter_list_remote_devices (DBusGProxy *proxy, char *** OUT_arg0, GError **error) + +{ + return dbus_g_proxy_call (proxy, "ListRemoteDevices", error, G_TYPE_INVALID, G_TYPE_STRV, OUT_arg0, G_TYPE_INVALID); +} + +typedef void (*adapter_list_remote_devices_reply) (DBusGProxy *proxy, char * *OUT_arg0, GError *error, gpointer userdata); + +static void +adapter_list_remote_devices_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) +{ + DBusGAsyncData *data = (DBusGAsyncData*) user_data; + GError *error = NULL; + char ** OUT_arg0; + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_STRV, &OUT_arg0, G_TYPE_INVALID); + (*(adapter_list_remote_devices_reply)data->cb) (proxy, OUT_arg0, error, data->userdata); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +adapter_list_remote_devices_async (DBusGProxy *proxy, adapter_list_remote_devices_reply callback, gpointer userdata) + +{ + DBusGAsyncData *stuff; + stuff = g_new (DBusGAsyncData, 1); + stuff->cb = G_CALLBACK (callback); + stuff->userdata = userdata; + return dbus_g_proxy_begin_call (proxy, "ListRemoteDevices", adapter_list_remote_devices_async_callback, stuff, g_free, G_TYPE_INVALID); +} +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean +adapter_list_connections (DBusGProxy *proxy, char *** OUT_arg0, GError **error) + +{ + return dbus_g_proxy_call (proxy, "ListConnections", error, G_TYPE_INVALID, G_TYPE_STRV, OUT_arg0, G_TYPE_INVALID); +} + +typedef void (*adapter_list_connections_reply) (DBusGProxy *proxy, char * *OUT_arg0, GError *error, gpointer userdata); + +static void +adapter_list_connections_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) +{ + DBusGAsyncData *data = (DBusGAsyncData*) user_data; + GError *error = NULL; + char ** OUT_arg0; + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_STRV, &OUT_arg0, G_TYPE_INVALID); + (*(adapter_list_connections_reply)data->cb) (proxy, OUT_arg0, error, data->userdata); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +adapter_list_connections_async (DBusGProxy *proxy, adapter_list_connections_reply callback, gpointer userdata) + +{ + DBusGAsyncData *stuff; + stuff = g_new (DBusGAsyncData, 1); + stuff->cb = G_CALLBACK (callback); + stuff->userdata = userdata; + return dbus_g_proxy_begin_call (proxy, "ListConnections", adapter_list_connections_async_callback, stuff, g_free, G_TYPE_INVALID); +} +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean +adapter_list_bondings (DBusGProxy *proxy, char *** OUT_arg0, GError **error) + +{ + return dbus_g_proxy_call (proxy, "ListBondings", error, G_TYPE_INVALID, G_TYPE_STRV, OUT_arg0, G_TYPE_INVALID); +} + +typedef void (*adapter_list_bondings_reply) (DBusGProxy *proxy, char * *OUT_arg0, GError *error, gpointer userdata); + +static void +adapter_list_bondings_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) +{ + DBusGAsyncData *data = (DBusGAsyncData*) user_data; + GError *error = NULL; + char ** OUT_arg0; + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_STRV, &OUT_arg0, G_TYPE_INVALID); + (*(adapter_list_bondings_reply)data->cb) (proxy, OUT_arg0, error, data->userdata); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +adapter_list_bondings_async (DBusGProxy *proxy, adapter_list_bondings_reply callback, gpointer userdata) + +{ + DBusGAsyncData *stuff; + stuff = g_new (DBusGAsyncData, 1); + stuff->cb = G_CALLBACK (callback); + stuff->userdata = userdata; + return dbus_g_proxy_begin_call (proxy, "ListBondings", adapter_list_bondings_async_callback, stuff, g_free, G_TYPE_INVALID); +} +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean +adapter_list_trusts (DBusGProxy *proxy, char *** OUT_arg0, GError **error) + +{ + return dbus_g_proxy_call (proxy, "ListTrusts", error, G_TYPE_INVALID, G_TYPE_STRV, OUT_arg0, G_TYPE_INVALID); +} + +typedef void (*adapter_list_trusts_reply) (DBusGProxy *proxy, char * *OUT_arg0, GError *error, gpointer userdata); + +static void +adapter_list_trusts_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) +{ + DBusGAsyncData *data = (DBusGAsyncData*) user_data; + GError *error = NULL; + char ** OUT_arg0; + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_STRV, &OUT_arg0, G_TYPE_INVALID); + (*(adapter_list_trusts_reply)data->cb) (proxy, OUT_arg0, error, data->userdata); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +adapter_list_trusts_async (DBusGProxy *proxy, adapter_list_trusts_reply callback, gpointer userdata) + +{ + DBusGAsyncData *stuff; + stuff = g_new (DBusGAsyncData, 1); + stuff->cb = G_CALLBACK (callback); + stuff->userdata = userdata; + return dbus_g_proxy_begin_call (proxy, "ListTrusts", adapter_list_trusts_async_callback, stuff, g_free, G_TYPE_INVALID); +} +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean +adapter_disconnect_remote_device (DBusGProxy *proxy, const char * IN_address, GError **error) + +{ + return dbus_g_proxy_call (proxy, "DisconnectRemoteDevice", error, G_TYPE_STRING, IN_address, G_TYPE_INVALID, G_TYPE_INVALID); +} + +typedef void (*adapter_disconnect_remote_device_reply) (DBusGProxy *proxy, GError *error, gpointer userdata); + +static void +adapter_disconnect_remote_device_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) +{ + DBusGAsyncData *data = (DBusGAsyncData*) user_data; + GError *error = NULL; + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); + (*(adapter_disconnect_remote_device_reply)data->cb) (proxy, error, data->userdata); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +adapter_disconnect_remote_device_async (DBusGProxy *proxy, const char * IN_address, adapter_disconnect_remote_device_reply callback, gpointer userdata) + +{ + DBusGAsyncData *stuff; + stuff = g_new (DBusGAsyncData, 1); + stuff->cb = G_CALLBACK (callback); + stuff->userdata = userdata; + return dbus_g_proxy_begin_call (proxy, "DisconnectRemoteDevice", adapter_disconnect_remote_device_async_callback, stuff, g_free, G_TYPE_STRING, IN_address, G_TYPE_INVALID); +} +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean +adapter_create_bonding (DBusGProxy *proxy, const char * IN_address, GError **error) + +{ + return dbus_g_proxy_call (proxy, "CreateBonding", error, G_TYPE_STRING, IN_address, G_TYPE_INVALID, G_TYPE_INVALID); +} + +typedef void (*adapter_create_bonding_reply) (DBusGProxy *proxy, GError *error, gpointer userdata); + +static void +adapter_create_bonding_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) +{ + DBusGAsyncData *data = (DBusGAsyncData*) user_data; + GError *error = NULL; + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); + (*(adapter_create_bonding_reply)data->cb) (proxy, error, data->userdata); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +adapter_create_bonding_async (DBusGProxy *proxy, const char * IN_address, adapter_create_bonding_reply callback, gpointer userdata) + +{ + DBusGAsyncData *stuff; + stuff = g_new (DBusGAsyncData, 1); + stuff->cb = G_CALLBACK (callback); + stuff->userdata = userdata; + return dbus_g_proxy_begin_call (proxy, "CreateBonding", adapter_create_bonding_async_callback, stuff, g_free, G_TYPE_STRING, IN_address, G_TYPE_INVALID); +} +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean +adapter_remove_bonding (DBusGProxy *proxy, const char * IN_address, GError **error) + +{ + return dbus_g_proxy_call (proxy, "RemoveBonding", error, G_TYPE_STRING, IN_address, G_TYPE_INVALID, G_TYPE_INVALID); +} + +typedef void (*adapter_remove_bonding_reply) (DBusGProxy *proxy, GError *error, gpointer userdata); + +static void +adapter_remove_bonding_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) +{ + DBusGAsyncData *data = (DBusGAsyncData*) user_data; + GError *error = NULL; + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); + (*(adapter_remove_bonding_reply)data->cb) (proxy, error, data->userdata); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +adapter_remove_bonding_async (DBusGProxy *proxy, const char * IN_address, adapter_remove_bonding_reply callback, gpointer userdata) + +{ + DBusGAsyncData *stuff; + stuff = g_new (DBusGAsyncData, 1); + stuff->cb = G_CALLBACK (callback); + stuff->userdata = userdata; + return dbus_g_proxy_begin_call (proxy, "RemoveBonding", adapter_remove_bonding_async_callback, stuff, g_free, G_TYPE_STRING, IN_address, G_TYPE_INVALID); +} +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean +adapter_set_trusted (DBusGProxy *proxy, const char * IN_address, GError **error) + +{ + return dbus_g_proxy_call (proxy, "SetTrusted", error, G_TYPE_STRING, IN_address, G_TYPE_INVALID, G_TYPE_INVALID); +} + +typedef void (*adapter_set_trusted_reply) (DBusGProxy *proxy, GError *error, gpointer userdata); + +static void +adapter_set_trusted_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) +{ + DBusGAsyncData *data = (DBusGAsyncData*) user_data; + GError *error = NULL; + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); + (*(adapter_set_trusted_reply)data->cb) (proxy, error, data->userdata); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +adapter_set_trusted_async (DBusGProxy *proxy, const char * IN_address, adapter_set_trusted_reply callback, gpointer userdata) + +{ + DBusGAsyncData *stuff; + stuff = g_new (DBusGAsyncData, 1); + stuff->cb = G_CALLBACK (callback); + stuff->userdata = userdata; + return dbus_g_proxy_begin_call (proxy, "SetTrusted", adapter_set_trusted_async_callback, stuff, g_free, G_TYPE_STRING, IN_address, G_TYPE_INVALID); +} +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean +adapter_remove_trust (DBusGProxy *proxy, const char * IN_address, GError **error) + +{ + return dbus_g_proxy_call (proxy, "RemoveTrust", error, G_TYPE_STRING, IN_address, G_TYPE_INVALID, G_TYPE_INVALID); +} + +typedef void (*adapter_remove_trust_reply) (DBusGProxy *proxy, GError *error, gpointer userdata); + +static void +adapter_remove_trust_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) +{ + DBusGAsyncData *data = (DBusGAsyncData*) user_data; + GError *error = NULL; + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); + (*(adapter_remove_trust_reply)data->cb) (proxy, error, data->userdata); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +adapter_remove_trust_async (DBusGProxy *proxy, const char * IN_address, adapter_remove_trust_reply callback, gpointer userdata) + +{ + DBusGAsyncData *stuff; + stuff = g_new (DBusGAsyncData, 1); + stuff->cb = G_CALLBACK (callback); + stuff->userdata = userdata; + return dbus_g_proxy_begin_call (proxy, "RemoveTrust", adapter_remove_trust_async_callback, stuff, g_free, G_TYPE_STRING, IN_address, G_TYPE_INVALID); +} +#endif /* defined DBUS_GLIB_CLIENT_WRAPPERS_adapter */ + +G_END_DECLS
--- a/src/bluetooth/gui.c Mon Jul 14 18:07:03 2008 +0200 +++ b/src/bluetooth/gui.c Wed Jul 16 20:48:09 2008 +0300 @@ -156,14 +156,14 @@ path = gtk_tree_model_get_path (model, &iter); sel = gtk_tree_path_get_indices (path)[0]; printf("i=%d\n",sel); - dev = audio_devices; + selected_dev = audio_devices; for(i=0;i<sel;i++) - dev = g_list_next(dev); + selected_dev = g_list_next(dev); if(dev != NULL) { - temp = g_strdup_printf("0x%x",((DeviceData*)(dev->data))->class); - gtk_label_set_text(GTK_LABEL(label_prod),((DeviceData*)(dev->data))->name); + temp = g_strdup_printf("0x%x",((DeviceData*)(selected_dev->data))->class); + gtk_label_set_text(GTK_LABEL(label_prod),((DeviceData*)(selected_dev->data))->name); gtk_label_set_text(GTK_LABEL(label_class),temp); - gtk_label_set_text(GTK_LABEL(label_address),((DeviceData*)(dev->data))->address); + gtk_label_set_text(GTK_LABEL(label_address),((DeviceData*)(selected_dev->data))->address); gtk_tree_path_free (path); g_free(temp); }else @@ -174,11 +174,12 @@ } void refresh_resultsui(){ - gtk_widget_destroy (window); - window = NULL; - refresh_call(); + gtk_widget_destroy (window); + window = NULL; + selected_dev = NULL; + refresh_call(); } - + void results_ui() {
--- a/src/bluetooth/gui.h Mon Jul 14 18:07:03 2008 +0200 +++ b/src/bluetooth/gui.h Wed Jul 16 20:48:09 2008 +0300 @@ -1,5 +1,7 @@ #include <gtk/gtk.h> #include <glib.h> + +GList *selected_dev ; void refresh_tree(void); void results_ui();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/bluetooth/passkey-agent-glue.h Wed Jul 16 20:48:09 2008 +0300 @@ -0,0 +1,264 @@ +/* Generated by dbus-binding-tool; do not edit! */ + + +#ifndef __dbus_glib_marshal_passkey_agent_MARSHAL_H__ +#define __dbus_glib_marshal_passkey_agent_MARSHAL_H__ + +#include <glib-object.h> + +G_BEGIN_DECLS + +#ifdef G_ENABLE_DEBUG +#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v) +#define g_marshal_value_peek_char(v) g_value_get_char (v) +#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v) +#define g_marshal_value_peek_int(v) g_value_get_int (v) +#define g_marshal_value_peek_uint(v) g_value_get_uint (v) +#define g_marshal_value_peek_long(v) g_value_get_long (v) +#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v) +#define g_marshal_value_peek_int64(v) g_value_get_int64 (v) +#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v) +#define g_marshal_value_peek_enum(v) g_value_get_enum (v) +#define g_marshal_value_peek_flags(v) g_value_get_flags (v) +#define g_marshal_value_peek_float(v) g_value_get_float (v) +#define g_marshal_value_peek_double(v) g_value_get_double (v) +#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v) +#define g_marshal_value_peek_param(v) g_value_get_param (v) +#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v) +#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v) +#define g_marshal_value_peek_object(v) g_value_get_object (v) +#else /* !G_ENABLE_DEBUG */ +/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API. + * Do not access GValues directly in your code. Instead, use the + * g_value_get_*() functions + */ +#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int +#define g_marshal_value_peek_char(v) (v)->data[0].v_int +#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint +#define g_marshal_value_peek_int(v) (v)->data[0].v_int +#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint +#define g_marshal_value_peek_long(v) (v)->data[0].v_long +#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong +#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64 +#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64 +#define g_marshal_value_peek_enum(v) (v)->data[0].v_long +#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong +#define g_marshal_value_peek_float(v) (v)->data[0].v_float +#define g_marshal_value_peek_double(v) (v)->data[0].v_double +#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer +#endif /* !G_ENABLE_DEBUG */ + + +/* BOOLEAN:STRING,STRING,POINTER (/tmp/dbus-binding-tool-c-marshallers.70BCEU:1) */ +extern void dbus_glib_marshal_passkey_agent_BOOLEAN__STRING_STRING_POINTER (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +void +dbus_glib_marshal_passkey_agent_BOOLEAN__STRING_STRING_POINTER (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef gboolean (*GMarshalFunc_BOOLEAN__STRING_STRING_POINTER) (gpointer data1, + gpointer arg_1, + gpointer arg_2, + gpointer arg_3, + gpointer data2); + register GMarshalFunc_BOOLEAN__STRING_STRING_POINTER callback; + register GCClosure *cc = (GCClosure*) closure; + register gpointer data1, data2; + gboolean v_return; + + g_return_if_fail (return_value != NULL); + g_return_if_fail (n_param_values == 4); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_BOOLEAN__STRING_STRING_POINTER) (marshal_data ? marshal_data : cc->callback); + + v_return = callback (data1, + g_marshal_value_peek_string (param_values + 1), + g_marshal_value_peek_string (param_values + 2), + g_marshal_value_peek_pointer (param_values + 3), + data2); + + g_value_set_boolean (return_value, v_return); +} + +/* NONE:STRING,STRING,POINTER (/tmp/dbus-binding-tool-c-marshallers.70BCEU:2) */ +extern void dbus_glib_marshal_passkey_agent_VOID__STRING_STRING_POINTER (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +void +dbus_glib_marshal_passkey_agent_VOID__STRING_STRING_POINTER (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__STRING_STRING_POINTER) (gpointer data1, + gpointer arg_1, + gpointer arg_2, + gpointer arg_3, + gpointer data2); + register GMarshalFunc_VOID__STRING_STRING_POINTER callback; + register GCClosure *cc = (GCClosure*) closure; + register gpointer data1, data2; + + g_return_if_fail (n_param_values == 4); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__STRING_STRING_POINTER) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_string (param_values + 1), + g_marshal_value_peek_string (param_values + 2), + g_marshal_value_peek_pointer (param_values + 3), + data2); +} +#define dbus_glib_marshal_passkey_agent_NONE__STRING_STRING_POINTER dbus_glib_marshal_passkey_agent_VOID__STRING_STRING_POINTER + +/* NONE:STRING,STRING,STRING,POINTER (/tmp/dbus-binding-tool-c-marshallers.70BCEU:3) */ +extern void dbus_glib_marshal_passkey_agent_VOID__STRING_STRING_STRING_POINTER (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +void +dbus_glib_marshal_passkey_agent_VOID__STRING_STRING_STRING_POINTER (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__STRING_STRING_STRING_POINTER) (gpointer data1, + gpointer arg_1, + gpointer arg_2, + gpointer arg_3, + gpointer arg_4, + gpointer data2); + register GMarshalFunc_VOID__STRING_STRING_STRING_POINTER callback; + register GCClosure *cc = (GCClosure*) closure; + register gpointer data1, data2; + + g_return_if_fail (n_param_values == 5); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__STRING_STRING_STRING_POINTER) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_string (param_values + 1), + g_marshal_value_peek_string (param_values + 2), + g_marshal_value_peek_string (param_values + 3), + g_marshal_value_peek_pointer (param_values + 4), + data2); +} +#define dbus_glib_marshal_passkey_agent_NONE__STRING_STRING_STRING_POINTER dbus_glib_marshal_passkey_agent_VOID__STRING_STRING_STRING_POINTER + +/* BOOLEAN:POINTER (/tmp/dbus-binding-tool-c-marshallers.70BCEU:4) */ +extern void dbus_glib_marshal_passkey_agent_BOOLEAN__POINTER (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +void +dbus_glib_marshal_passkey_agent_BOOLEAN__POINTER (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef gboolean (*GMarshalFunc_BOOLEAN__POINTER) (gpointer data1, + gpointer arg_1, + gpointer data2); + register GMarshalFunc_BOOLEAN__POINTER callback; + register GCClosure *cc = (GCClosure*) closure; + register gpointer data1, data2; + gboolean v_return; + + g_return_if_fail (return_value != NULL); + g_return_if_fail (n_param_values == 2); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_BOOLEAN__POINTER) (marshal_data ? marshal_data : cc->callback); + + v_return = callback (data1, + g_marshal_value_peek_pointer (param_values + 1), + data2); + + g_value_set_boolean (return_value, v_return); +} + +G_END_DECLS + +#endif /* __dbus_glib_marshal_passkey_agent_MARSHAL_H__ */ + +#include <dbus/dbus-glib.h> +static const DBusGMethodInfo dbus_glib_passkey_agent_methods[] = { + { (GCallback) passkey_agent_request, dbus_glib_marshal_passkey_agent_NONE__STRING_STRING_POINTER, 0 }, + { (GCallback) passkey_agent_confirm, dbus_glib_marshal_passkey_agent_NONE__STRING_STRING_STRING_POINTER, 68 }, + { (GCallback) passkey_agent_cancel, dbus_glib_marshal_passkey_agent_BOOLEAN__STRING_STRING_POINTER, 133 }, + { (GCallback) passkey_agent_release, dbus_glib_marshal_passkey_agent_BOOLEAN__POINTER, 187 }, +}; + +const DBusGObjectInfo dbus_glib_passkey_agent_object_info = { + 0, + dbus_glib_passkey_agent_methods, + 4, +"org.bluez.PasskeyAgent\0Request\0A\0path\0I\0s\0address\0I\0s\0arg2\0O\0F\0N\0s\0\0org.bluez.PasskeyAgent\0Confirm\0A\0path\0I\0s\0address\0I\0s\0value\0I\0s\0\0org.bluez.PasskeyAgent\0Cancel\0S\0path\0I\0s\0address\0I\0s\0\0org.bluez.PasskeyAgent\0Release\0S\0\0\0", +"\0", +"\0" +}; +