Update test script for service connections
[framework/connectivity/connman.git] / test / connect-service
1 #!/usr/bin/python
2
3 import sys
4 import dbus
5
6 if (len(sys.argv) < 2):
7         print "Usage: %s <ssid> [passphrase] [security]" % (sys.argv[0])
8         sys.exit(1)
9
10 bus = dbus.SystemBus()
11
12 manager = dbus.Interface(bus.get_object("org.moblin.connman", "/"),
13                                         "org.moblin.connman.Manager")
14
15 print "Attempting to connect service %s" % (sys.argv[1])
16
17 if len(sys.argv) > 2:
18         if len(sys.argv) > 3:
19                 security = sys.argv[3]
20         else:
21                 security = "rsn"
22         passphrase = sys.argv[2]
23 else:
24         security = "none"
25         passphrase = ""
26
27 path = manager.ConnectService(({ "Type": "wifi", "Mode": "managed",
28                                         "SSID": sys.argv[1],
29                                         "Security": security,
30                                         "Passphrase": passphrase }));
31 print "Service path is %s" %(path)