summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2012-12-05 13:11:41 +0200
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-12-05 15:58:52 +0200
commit635c64efa9425970354a56d9e63fbb73f525da2b (patch)
treeec4774cd8bdae4768d31ec06022b1f4bea4235f2 /test
parent7eca6ac7c527155c2bbe20fd33dbdde0c8660d88 (diff)
downloadconnman-635c64efa9425970354a56d9e63fbb73f525da2b.tar.gz
connman-635c64efa9425970354a56d9e63fbb73f525da2b.tar.bz2
connman-635c64efa9425970354a56d9e63fbb73f525da2b.zip
test: simple-agent must monitor vpn status
simple-agent needs to monitor vpnd status as vpnd can stop if there are no vpn configured. When vpnd quits we must not quit the agent as then wifi questions would not be asked from the user any more.
Diffstat (limited to 'test')
-rwxr-xr-xtest/simple-agent18
1 files changed, 17 insertions, 1 deletions
diff --git a/test/simple-agent b/test/simple-agent
index f501b1e5..ebb44c57 100755
--- a/test/simple-agent
+++ b/test/simple-agent
@@ -180,7 +180,6 @@ class VpnAgent(dbus.service.Object):
in_signature='', out_signature='')
def Release(self):
print("Release VPN agent")
- mainloop.quit()
def input_cookie(self):
response = {}
@@ -267,6 +266,21 @@ class VpnAgent(dbus.service.Object):
def Cancel(self):
print "Cancel"
+def vpnNameOwnerChanged(proxy):
+ if proxy:
+ print("vpnd is connected to system bus")
+ try:
+ path = "/test/vpn_agent"
+ vpn_manager = dbus.Interface(bus.get_object('net.connman.vpn',
+ "/"),
+ 'net.connman.vpn.Manager')
+ vpn_manager.RegisterAgent(path)
+ except:
+ print "vpn agent registered"
+ else:
+ print("vpnd is disconnected from system bus")
+ vpn_manager = None
+
def print_usage():
print "Usage:"
print "For hidden service:"
@@ -328,6 +342,8 @@ if __name__ == '__main__':
vpn_manager.RegisterAgent(path)
+ bus.watch_name_owner('net.connman.vpn', vpnNameOwnerChanged)
+
mainloop = gobject.MainLoop()
mainloop.run()