Add support for more advanced service property listing
[platform/upstream/connman.git] / test / simple-agent
1 #!/usr/bin/python
2
3 import gobject
4
5 import dbus
6 import dbus.service
7 import dbus.mainloop.glib
8
9 class Canceled(dbus.DBusException):
10         _dbus_error_name = "org.moblin.connman.Error.Canceled"
11
12 class Agent(dbus.service.Object):
13         @dbus.service.method("org.moblin.connman.Agent",
14                                         in_signature='', out_signature='')
15         def Release(self):
16                 print("Release")
17                 mainloop.quit()
18         @dbus.service.method("org.moblin.connman.Agent",
19                                         in_signature='o', out_signature='s')
20         def RequestPassphrase(self, service):
21                 print "PassphraseRequested (%s)" % (service)
22                 raise Canceled("Canceled")
23
24         @dbus.service.method("org.moblin.connman.Agent",
25                                         in_signature='', out_signature='')
26         def Cancel(self):
27                 print "Cancel"
28
29 if __name__ == '__main__':
30         dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
31
32         bus = dbus.SystemBus()
33         manager = dbus.Interface(bus.get_object('org.moblin.connman', "/"),
34                                         'org.moblin.connman.Manager')
35
36         path = "/test/agent"
37         object = Agent(bus, path)
38
39         manager.RegisterAgent(path)
40
41         mainloop = gobject.MainLoop()
42         mainloop.run()
43
44         #manager.UnregisterAgent(path)