simple-agent: update to new agent api
authorKalle Valo <kalle.valo@canonical.com>
Mon, 11 Oct 2010 12:12:10 +0000 (15:12 +0300)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 11 Oct 2010 14:36:03 +0000 (16:36 +0200)
simple-agent was still using the old agent api and didn't work anymore.
Update it to use the new api.

test/simple-agent

index b8e4efc..7e1ce8b 100755 (executable)
@@ -20,24 +20,17 @@ class Agent(dbus.service.Object):
                mainloop.quit()
 
        @dbus.service.method("org.moblin.connman.Agent",
-                                       in_signature='o', out_signature='')
-       def RequestPassphrase(self, path):
-               print "PassphraseRequested (%s)" % (path)
+                                       in_signature='oa{sv}',
+                                       out_signature='a{sv}')
+       def RequestInput(self, path, fields):
+               print "RequestInput (%s,%s)" % (path, fields)
 
-               service = dbus.Interface(bus.get_object("org.moblin.connman",
-                                                       path),
-                                        "org.moblin.connman.Service")
+               response = {}
+               response["Passphrase"] = self.passphrase
 
-               try:
-                       print "setting passphrase (%s)" % (self.passphrase)
+               print "returning (%s)" % (response)
 
-                       service.SetProperty("Passphrase",
-                                           dbus.String(self.passphrase,
-                                                       variant_level=1))
-
-                       service.Connect(timeout=60000)
-               except dbus.DBusException, error:
-                       print "%s: %s" % (error._dbus_error_name, error.message)
+               return response
 
        @dbus.service.method("org.moblin.connman.Agent",
                                        in_signature='', out_signature='')