changeset 2840:50507763fd31

working basic pairing / bounding
author Paula Stanciu <paula.stanciu@gmail.com>
date Fri, 18 Jul 2008 11:46:56 +0300
parents 22a5075fc7f7
children 9637eab5a3dd
files src/bluetooth/agent.c src/bluetooth/agent.h src/bluetooth/bluetooth.c
diffstat 3 files changed, 22 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/bluetooth/agent.c	Wed Jul 16 20:57:17 2008 +0300
+++ b/src/bluetooth/agent.c	Fri Jul 18 11:46:56 2008 +0300
@@ -54,7 +54,7 @@
     agent_window = NULL;
 }
 
-void run_agent()
+void gui_agent()
 {
     if (!agent_window)
     {
@@ -280,6 +280,8 @@
 
 	enable_blinking();
 */
+printf("passkey callback\n");
+passkey_callback(GTK_RESPONSE_ACCEPT,input);
 }
 
 static void confirm_dialog(const char *path, const char *address,
@@ -362,6 +364,7 @@
 
 static void passkey_agent_init(PasskeyAgent *obj)
 {
+g_printf("passkeyagent init\n");
 }
 
 static void passkey_agent_class_init(PasskeyAgentClass *klass)
@@ -381,7 +384,7 @@
 	agent = g_object_new(PASSKEY_AGENT_OBJECT_TYPE, NULL);
 
 	dbus_g_connection_register_g_object(connection, path, G_OBJECT(agent));
-
+    g_printf("new passkey agent \n");
 	return agent;
 }
 
@@ -391,7 +394,8 @@
 				const char *path, const char *address,
 					DBusGMethodInvocation *context)
 {
-	DBusGProxy *object;
+    printf("passkey_agent request\n");
+    DBusGProxy *object;
 	const char *adapter = NULL, *name = NULL;
 	gchar *device, *line;
 
@@ -414,7 +418,7 @@
 		device = g_strdup(address);
 
 	passkey_dialog(path, address, device, context);
-
+    printf ("pairing request for device :%s",address);
 	/* translators: this is a popup telling you a particular device
 	 * has asked for pairing */
 	line = g_strdup_printf(_("Pairing request for '%s'"), device);
@@ -730,7 +734,7 @@
 
 	agent = auth_agent_new(AUTH_AGENT_PATH);
 
-	return 0;
+ 	return 0;
 }
 
 void cleanup_agents(void)
@@ -742,7 +746,8 @@
 
 void show_agents(void)
 {
-	//close_notification();
+printf("show_agents\n");
+//close_notification();
 
 //	g_list_foreach(input_list, show_dialog, NULL);
 
@@ -753,3 +758,11 @@
 {
 	auto_authorize = value;
 }
+void run_agents()
+{
+    setup_agents(bus);
+
+    register_agents();
+ 
+}
+
--- a/src/bluetooth/agent.h	Wed Jul 16 20:57:17 2008 +0300
+++ b/src/bluetooth/agent.h	Fri Jul 18 11:46:56 2008 +0300
@@ -25,7 +25,7 @@
 #include <gtk/gtk.h>
 #include <glib.h>
 #include <dbus/dbus-glib.h>
-void run_agent(void);
+void run_agents(void);
 int setup_agents(DBusGConnection *conn);
 void cleanup_agents(void);
 
--- a/src/bluetooth/bluetooth.c	Wed Jul 16 20:57:17 2008 +0300
+++ b/src/bluetooth/bluetooth.c	Fri Jul 18 11:46:56 2008 +0300
@@ -78,7 +78,6 @@
 void bt_about( void )
 {
     printf("about call\n");
-    run_agent();
 }
 
 void bt_cfg(void)
@@ -155,9 +154,9 @@
     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);
    */ 
+     run_agents();
     dbus_g_proxy_call(obj,"CreateBonding",NULL,G_TYPE_STRING,"00:0D:3C:B1:1C:7A",G_TYPE_INVALID,G_TYPE_INVALID);  
-
-
+   
 
 }