7 import dbus.mainloop.glib
10 class Canceled(dbus.DBusException):
11 _dbus_error_name = "net.connman.Error.Canceled"
13 class Agent(dbus.service.Object):
16 @dbus.service.method("net.connman.Agent",
17 in_signature='', out_signature='')
22 @dbus.service.method("net.connman.Agent",
23 in_signature='oa{sv}',
24 out_signature='a{sv}')
25 def RequestInput(self, path, fields):
26 print "RequestInput (%s,%s)" % (path, fields)
29 response["Passphrase"] = self.passphrase
31 print "returning (%s)" % (response)
35 @dbus.service.method("net.connman.Agent",
38 def ReportError(self, path, error):
39 print "ReportError %s, %s" % (path, error)
40 retry = raw_input("Retry service (yes/no): ")
42 class Retry(dbus.DBusException):
43 _dbus_error_name = "net.connman.Agent.Error.Retry"
45 raise Retry("retry service")
50 @dbus.service.method("net.connman.Agent",
51 in_signature='', out_signature='')
57 if __name__ == '__main__':
59 print "Usage: %s <passphrase>" % (sys.argv[0])
62 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
64 bus = dbus.SystemBus()
65 manager = dbus.Interface(bus.get_object('net.connman', "/"),
66 'net.connman.Manager')
69 object = Agent(bus, path)
70 object.passphrase = sys.argv[1]
72 manager.RegisterAgent(path)
74 mainloop = gobject.MainLoop()
77 #manager.UnregisterAgent(path)