1 From 395d388931d37b6760d7b9f59a5710dfe42662c7 Mon Sep 17 00:00:00 2001
2 From: Chengyi Zhao <chengyi1.zhao@archermind.com>
3 Date: Thu, 11 Jul 2013 10:29:38 +0800
4 Subject: [PATCH 22/32] Tethering: Add test script of open and hidden AP
6 Change-Id: I8dbeaeba5848c8a8739422a93786b2ca6ed31b21
8 test/enable-tethering | 34 +++++++++++++++++++++++++++-------
9 1 file changed, 27 insertions(+), 7 deletions(-)
10 mode change 100755 => 100644 test/enable-tethering
12 diff --git a/test/enable-tethering b/test/enable-tethering
15 index cbcd4e7..674b3c9
16 --- a/test/enable-tethering
17 +++ b/test/enable-tethering
22 -if (len(sys.argv) >= 3 and len(sys.argv) != 4 and sys.argv[1] == "wifi"):
23 - print "Usage: %s wifi [SSID] [passphrase]" % (sys.argv[0])
24 +if (len(sys.argv) >= 2 and len(sys.argv) < 4 and sys.argv[1] == "wifi"):
25 + print "Usage: %s wifi [SSID] [passphrase] [hidden]" % (sys.argv[0])
27 + print "Create the open system access point:"
28 + print "%s wifi abcd \"\"" % (sys.argv[0])
29 + print "Create the security access point:"
30 + print "%s wifi abcd 123456789" % (sys.argv[0])
31 + print "Create the hidden access point:"
32 + print "%s wifi abcd 123456789 hidden" % (sys.argv[0])
33 + print "Create the open and hidden access point:"
34 + print "%s wifi abcd \"\" hidden" % (sys.argv[0])
36 elif (len(sys.argv) < 2):
37 print "Usage: %s type" % (sys.argv[0])
38 @@ -15,7 +24,7 @@ bus = dbus.SystemBus()
39 manager = dbus.Interface(bus.get_object('net.connman', "/"),
40 'net.connman.Manager')
42 -def technology_enable_tethering(path, tech_type, ssid, psk):
43 +def technology_enable_tethering(path, tech_type, ssid, psk, hidden):
44 tech = dbus.Interface(bus.get_object("net.connman", path),
45 "net.connman.Technology")
47 @@ -27,9 +36,17 @@ def technology_enable_tethering(path, tech_type, ssid, psk):
49 tech.SetProperty("TetheringIdentifier",
52 tech.SetProperty("TetheringPassphrase",
54 + if tech_type == "wifi":
56 + if hidden == "hidden":
57 + tech.SetProperty("Hidden",dbus.Boolean(1))
59 + tech.SetProperty("Hidden",dbus.Boolean(0))
61 + tech.SetProperty("Hidden",dbus.Boolean(0))
63 print "Enabling %s tethering" % tech_type
64 tech.SetProperty("Tethering", dbus.Boolean(1))
66 @@ -41,11 +58,14 @@ technologies = manager.GetTechnologies()
69 for path,_ in technologies:
70 - if (len(sys.argv) == 4):
71 + if (len(sys.argv) == 5):
72 + tech = technology_enable_tethering(path,
73 + sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])
74 + elif (len(sys.argv) == 4):
75 tech = technology_enable_tethering(path,
76 - sys.argv[1], sys.argv[2], sys.argv[3])
77 + sys.argv[1], sys.argv[2], sys.argv[3], "")
79 - tech = technology_enable_tethering(path, sys.argv[1], "", "")
80 + tech = technology_enable_tethering(path, sys.argv[1], "", "", "")