summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtest/test-adapter70
-rwxr-xr-xtest/test-audio27
-rwxr-xr-xtest/test-device94
-rwxr-xr-xtest/test-discovery17
-rwxr-xr-xtest/test-input27
-rwxr-xr-xtest/test-network24
-rwxr-xr-xtest/test-serial23
-rwxr-xr-xtest/test-service26
-rwxr-xr-xtest/test-telephony110
9 files changed, 273 insertions, 145 deletions
diff --git a/test/test-adapter b/test/test-adapter
index 4c1a28adc..00ef6f5d2 100755
--- a/test/test-adapter
+++ b/test/test-adapter
@@ -3,15 +3,29 @@
import sys
import dbus
import time
+from optparse import OptionParser, make_option
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.bluez.Manager")
-adapter = dbus.Interface(bus.get_object("org.bluez", manager.DefaultAdapter()),
+option_list = [
+ make_option("-i", "--device", action="store",
+ type="string", dest="dev_id"),
+ ]
+parser = OptionParser(option_list=option_list)
+
+(options, args) = parser.parse_args()
+
+if options.dev_id:
+ adapter_path = manager.FindAdapter(options.dev_id)
+else:
+ adapter_path = manager.DefaultAdapter()
+
+adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
"org.bluez.Adapter")
-if (len(sys.argv) < 2):
+if (len(args) < 1):
print "Usage: %s <command>" % (sys.argv[0])
print ""
print " address"
@@ -24,80 +38,80 @@ if (len(sys.argv) < 2):
print " discovering"
sys.exit(1)
-if (sys.argv[1] == "address"):
+if (args[0] == "address"):
properties = adapter.GetProperties()
print properties["Address"]
sys.exit(0)
-if (sys.argv[1] == "name"):
- if (len(sys.argv) < 3):
+if (args[0] == "name"):
+ if (len(args) < 2):
properties = adapter.GetProperties()
print properties["Name"]
else:
- adapter.SetProperty("Name", sys.argv[2])
+ adapter.SetProperty("Name", args[1])
sys.exit(0)
-if (sys.argv[1] == "powered"):
- if (len(sys.argv) < 3):
+if (args[0] == "powered"):
+ if (len(args) < 2):
properties = adapter.GetProperties()
print properties["Powered"]
else:
- if (sys.argv[2] == "on"):
+ if (args[1] == "on"):
value = dbus.Boolean(1)
- elif (sys.argv[2] == "off"):
+ elif (args[1] == "off"):
value = dbus.Boolean(0)
else:
- value = dbus.Boolean(sys.argv[2])
+ value = dbus.Boolean(args[1])
adapter.SetProperty("Powered", value)
sys.exit(0)
-if (sys.argv[1] == "pairable"):
- if (len(sys.argv) < 3):
+if (args[0] == "pairable"):
+ if (len(args) < 2):
properties = adapter.GetProperties()
print properties["Pairable"]
else:
- if (sys.argv[2] == "on"):
+ if (args[1] == "on"):
value = dbus.Boolean(1)
- elif (sys.argv[2] == "off"):
+ elif (args[1] == "off"):
value = dbus.Boolean(0)
else:
- value = dbus.Boolean(sys.argv[2])
+ value = dbus.Boolean(args[1])
adapter.SetProperty("Pairable", value)
sys.exit(0)
-if (sys.argv[1] == "pairabletimeout"):
- if (len(sys.argv) < 3):
+if (args[0] == "pairabletimeout"):
+ if (len(args) < 2):
properties = adapter.GetProperties()
print properties["PairableTimeout"]
else:
- timeout = dbus.UInt32(sys.argv[2])
+ timeout = dbus.UInt32(args[1])
adapter.SetProperty("PairableTimeout", timeout)
sys.exit(0)
-if (sys.argv[1] == "discoverable"):
- if (len(sys.argv) < 3):
+if (args[0] == "discoverable"):
+ if (len(args) < 2):
properties = adapter.GetProperties()
print properties["Discoverable"]
else:
- if (sys.argv[2] == "on"):
+ if (args[1] == "on"):
value = dbus.Boolean(1)
- elif (sys.argv[2] == "off"):
+ elif (args[1] == "off"):
value = dbus.Boolean(0)
else:
- value = dbus.Boolean(sys.argv[2])
+ value = dbus.Boolean(args[1])
adapter.SetProperty("Discoverable", value)
sys.exit(0)
-if (sys.argv[1] == "discoverabletimeout"):
- if (len(sys.argv) < 3):
+if (args[0] == "discoverabletimeout"):
+ if (len(args) < 2):
properties = adapter.GetProperties()
print properties["DiscoverableTimeout"]
else:
- timeout = dbus.UInt32(sys.argv[2])
+ timeout = dbus.UInt32(args[1])
adapter.SetProperty("DiscoverableTimeout", timeout)
sys.exit(0)
-if (sys.argv[1] == "discovering"):
+if (args[0] == "discovering"):
properties = adapter.GetProperties()
print properties["Discovering"]
sys.exit(0)
diff --git a/test/test-audio b/test/test-audio
index 4f3e17844..8b7a62d7a 100755
--- a/test/test-audio
+++ b/test/test-audio
@@ -2,14 +2,29 @@
import sys
import dbus
+from optparse import OptionParser, make_option
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.bluez.Manager")
-adapter = dbus.Interface(bus.get_object("org.bluez", manager.DefaultAdapter()),
- "org.bluez.Adapter")
-if len(sys.argv) < 3:
+option_list = [
+ make_option("-i", "--device", action="store",
+ type="string", dest="dev_id"),
+ ]
+parser = OptionParser(option_list=option_list)
+
+(options, args) = parser.parse_args()
+
+if options.dev_id:
+ adapter_path = manager.FindAdapter(options.dev_id)
+else:
+ adapter_path = manager.DefaultAdapter()
+
+adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
+ "org.bluez.Adapter")
+
+if len(args) < 2:
print """Usage: %s <command>
connect <bdaddr>
@@ -17,13 +32,13 @@ if len(sys.argv) < 3:
""" % sys.argv[0]
sys.exit(1)
-device = adapter.FindDevice(sys.argv[2])
+device = adapter.FindDevice(args[1])
audio = dbus.Interface(bus.get_object("org.bluez", device),
"org.bluez.Audio")
-if sys.argv[1] == "connect":
+if args[0] == "connect":
audio.Connect()
-elif sys.argv[1] == "disconnect":
+elif args[0] == "disconnect":
audio.Disconnect()
else:
print "Unknown command"
diff --git a/test/test-device b/test/test-device
index b44b91df1..770cc6e58 100755
--- a/test/test-device
+++ b/test/test-device
@@ -3,15 +3,29 @@
import sys
import dbus
import re
+from optparse import OptionParser, make_option
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.bluez.Manager")
-adapter = dbus.Interface(bus.get_object("org.bluez", manager.DefaultAdapter()),
+option_list = [
+ make_option("-i", "--device", action="store",
+ type="string", dest="dev_id"),
+ ]
+parser = OptionParser(option_list=option_list)
+
+(options, args) = parser.parse_args()
+
+if options.dev_id:
+ adapter_path = manager.FindAdapter(options.dev_id)
+else:
+ adapter_path = manager.DefaultAdapter()
+
+adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
"org.bluez.Adapter")
-if (len(sys.argv) < 2):
+if (len(args) < 1):
print "Usage: %s <command>" % (sys.argv[0])
print ""
print " list"
@@ -25,41 +39,41 @@ if (len(sys.argv) < 2):
print " blocked <address> [yes/no]"
sys.exit(1)
-if (sys.argv[1] == "list"):
+if (args[0] == "list"):
list = adapter.ListDevices()
print list
sys.exit(0)
-if (sys.argv[1] == "create"):
- if (len(sys.argv) < 3):
+if (args[0] == "create"):
+ if (len(args) < 2):
print "Need address parameter"
else:
- device = adapter.CreateDevice(sys.argv[2])
+ device = adapter.CreateDevice(args[1])
print device
sys.exit(0)
-if (sys.argv[1] == "remove"):
- if (len(sys.argv) < 3):
+if (args[0] == "remove"):
+ if (len(args) < 2):
print "Need address or object path parameter"
else:
try:
- path = adapter.FindDevice(sys.argv[2])
+ path = adapter.FindDevice(args[1])
except:
- path = sys.argv[2]
+ path = args[1]
adapter.RemoveDevice(path)
sys.exit(0)
-if (sys.argv[1] == "discover"):
- if (len(sys.argv) < 3):
+if (args[0] == "discover"):
+ if (len(args) < 2):
print "Need address parameter"
else:
- path = adapter.FindDevice(sys.argv[2])
+ path = adapter.FindDevice(args[1])
device = dbus.Interface(bus.get_object("org.bluez", path),
"org.bluez.Device")
- if (len(sys.argv) < 4):
+ if (len(args) < 3):
pattern = ""
else:
- pattern = sys.argv[3]
+ pattern = args[2]
services = device.DiscoverServices(pattern);
for key in services.keys():
p = re.compile(">.*?<")
@@ -69,79 +83,79 @@ if (sys.argv[1] == "discover"):
print
sys.exit(0)
-if (sys.argv[1] == "class"):
- if (len(sys.argv) < 3):
+if (args[0] == "class"):
+ if (len(args) < 2):
print "Need address parameter"
else:
- path = adapter.FindDevice(sys.argv[2])
+ path = adapter.FindDevice(args[1])
device = dbus.Interface(bus.get_object("org.bluez", path),
"org.bluez.Device")
properties = device.GetProperties()
print "0x%06x" % (properties["Class"])
sys.exit(0)
-if (sys.argv[1] == "name"):
- if (len(sys.argv) < 3):
+if (args[0] == "name"):
+ if (len(args) < 2):
print "Need address parameter"
else:
- path = adapter.FindDevice(sys.argv[2])
+ path = adapter.FindDevice(args[1])
device = dbus.Interface(bus.get_object("org.bluez", path),
"org.bluez.Device")
properties = device.GetProperties()
print properties["Name"]
sys.exit(0)
-if (sys.argv[1] == "alias"):
- if (len(sys.argv) < 3):
+if (args[0] == "alias"):
+ if (len(args) < 2):
print "Need address parameter"
else:
- path = adapter.FindDevice(sys.argv[2])
+ path = adapter.FindDevice(args[1])
device = dbus.Interface(bus.get_object("org.bluez", path),
"org.bluez.Device")
- if (len(sys.argv) < 4):
+ if (len(args) < 3):
properties = device.GetProperties()
print properties["Alias"]
else:
- device.SetProperty("Alias", sys.argv[3])
+ device.SetProperty("Alias", args[2])
sys.exit(0)
-if (sys.argv[1] == "trusted"):
- if (len(sys.argv) < 3):
+if (args[0] == "trusted"):
+ if (len(args) < 2):
print "Need address parameter"
else:
- path = adapter.FindDevice(sys.argv[2])
+ path = adapter.FindDevice(args[1])
device = dbus.Interface(bus.get_object("org.bluez", path),
"org.bluez.Device")
- if (len(sys.argv) < 4):
+ if (len(args) < 3):
properties = device.GetProperties()
print properties["Trusted"]
else:
- if (sys.argv[3] == "yes"):
+ if (args[2] == "yes"):
value = dbus.Boolean(1)
- elif (sys.argv[3] == "no"):
+ elif (args[2] == "no"):
value = dbus.Boolean(0)
else:
- value = dbus.Boolean(sys.argv[3])
+ value = dbus.Boolean(args[2])
device.SetProperty("Trusted", value)
sys.exit(0)
-if (sys.argv[1] == "blocked"):
- if (len(sys.argv) < 3):
+if (args[0] == "blocked"):
+ if (len(args) < 2):
print "Need address parameter"
else:
- path = adapter.FindDevice(sys.argv[2])
+ path = adapter.FindDevice(args[1])
device = dbus.Interface(bus.get_object("org.bluez", path),
"org.bluez.Device")
- if (len(sys.argv) < 4):
+ if (len(args) < 3):
properties = device.GetProperties()
print properties["Blocked"]
else:
- if (sys.argv[3] == "yes"):
+ if (args[2] == "yes"):
value = dbus.Boolean(1)
- elif (sys.argv[3] == "no"):
+ elif (args[2] == "no"):
value = dbus.Boolean(0)
else:
- value = dbus.Boolean(sys.argv[3])
+ value = dbus.Boolean(args[2])
device.SetProperty("Blocked", value)
sys.exit(0)
diff --git a/test/test-discovery b/test/test-discovery
index e45bcc026..22c88c3a6 100755
--- a/test/test-discovery
+++ b/test/test-discovery
@@ -4,6 +4,7 @@ import gobject
import dbus
import dbus.mainloop.glib
+from optparse import OptionParser, make_option
def device_found(address, properties):
print "[ " + address + " ]"
@@ -26,8 +27,20 @@ if __name__ == '__main__':
manager = dbus.Interface(bus.get_object("org.bluez", "/"),
"org.bluez.Manager")
- path = manager.DefaultAdapter()
- adapter = dbus.Interface(bus.get_object("org.bluez", path),
+ option_list = [
+ make_option("-i", "--device", action="store",
+ type="string", dest="dev_id"),
+ ]
+ parser = OptionParser(option_list=option_list)
+
+ (options, args) = parser.parse_args()
+
+ if options.dev_id:
+ adapter_path = manager.FindAdapter(options.dev_id)
+ else:
+ adapter_path = manager.DefaultAdapter()
+
+ adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
"org.bluez.Adapter")
bus.add_signal_receiver(device_found,
diff --git a/test/test-input b/test/test-input
index d72285ccd..405bb5928 100755
--- a/test/test-input
+++ b/test/test-input
@@ -2,14 +2,29 @@
import sys
import dbus
+from optparse import OptionParser, make_option
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.bluez.Manager")
-adapter = dbus.Interface(bus.get_object("org.bluez", manager.DefaultAdapter()),
- "org.bluez.Adapter")
-if len(sys.argv) < 3:
+option_list = [
+ make_option("-i", "--device", action="store",
+ type="string", dest="dev_id"),
+ ]
+parser = OptionParser(option_list=option_list)
+
+(options, args) = parser.parse_args()
+
+if options.dev_id:
+ adapter_path = manager.FindAdapter(options.dev_id)
+else:
+ adapter_path = manager.DefaultAdapter()
+
+adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
+ "org.bluez.Adapter")
+
+if len(args) < 2:
print """Usage: %s <command>
connect <bdaddr>
@@ -17,13 +32,13 @@ if len(sys.argv) < 3:
""" % sys.argv[0]
sys.exit(1)
-device = adapter.FindDevice(sys.argv[2])
+device = adapter.FindDevice(args[1])
input = dbus.Interface(bus.get_object("org.bluez", device),
"org.bluez.Input")
-if sys.argv[1] == "connect":
+if args[0] == "connect":
input.Connect()
-elif sys.argv[1] == "disconnect":
+elif args[0] == "disconnect":
input.Disconnect()
else:
print "Unknown command"
diff --git a/test/test-network b/test/test-network
index 6f75bed66..676fb302e 100755
--- a/test/test-network
+++ b/test/test-network
@@ -3,25 +3,39 @@
import sys
import time
import dbus
+from optparse import OptionParser, make_option
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object("org.bluez", "/"),
"org.bluez.Manager")
-adapter = dbus.Interface(bus.get_object("org.bluez", manager.DefaultAdapter()),
+option_list = [
+ make_option("-i", "--device", action="store",
+ type="string", dest="dev_id"),
+ ]
+parser = OptionParser(option_list=option_list)
+
+(options, args) = parser.parse_args()
+
+if options.dev_id:
+ adapter_path = manager.FindAdapter(options.dev_id)
+else:
+ adapter_path = manager.DefaultAdapter()
+
+adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
"org.bluez.Adapter")
-if (len(sys.argv) < 2):
+if (len(args) < 1):
print "Usage: %s <address> [service]" % (sys.argv[0])
sys.exit(1)
-address = sys.argv[1]
+address = args[0]
-if (len(sys.argv) < 3):
+if (len(args) < 2):
service = "panu"
else:
- service = sys.argv[2]
+ service = args[1]
device = adapter.FindDevice(address)
diff --git a/test/test-serial b/test/test-serial
index f6d60224d..ed151dc8a 100755
--- a/test/test-serial
+++ b/test/test-serial
@@ -3,25 +3,38 @@
import sys
import time
import dbus
+from optparse import OptionParser, make_option
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object("org.bluez", "/"),
"org.bluez.Manager")
+option_list = [
+ make_option("-i", "--device", action="store",
+ type="string", dest="dev_id"),
+ ]
+parser = OptionParser(option_list=option_list)
-adapter = dbus.Interface(bus.get_object("org.bluez", manager.DefaultAdapter()),
+(options, args) = parser.parse_args()
+
+if options.dev_id:
+ adapter_path = manager.FindAdapter(options.dev_id)
+else:
+ adapter_path = manager.DefaultAdapter()
+
+adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
"org.bluez.Adapter")
-if (len(sys.argv) < 2):
+if (len(args) < 1):
print "Usage: %s <address> [service]" % (sys.argv[0])
sys.exit(1)
-address = sys.argv[1]
+address = sys.argv[0]
-if (len(sys.argv) < 3):
+if (len(args) < 2):
service = "spp"
else:
- service = sys.argv[2]
+ service = args[1]
path = adapter.FindDevice(address)
diff --git a/test/test-service b/test/test-service
index e00520135..dae40fc5a 100755
--- a/test/test-service
+++ b/test/test-service
@@ -3,25 +3,39 @@
import sys
import dbus
import time
+from optparse import OptionParser, make_option
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.bluez.Manager")
-adapter = dbus.Interface(bus.get_object("org.bluez", manager.FindAdapter("any")),
- "org.bluez.Service")
+option_list = [
+ make_option("-i", "--device", action="store",
+ type="string", dest="dev_id"),
+ ]
+parser = OptionParser(option_list=option_list)
-if (len(sys.argv) < 2):
+(options, args) = parser.parse_args()
+
+if options.dev_id:
+ adapter_path = manager.FindAdapter(options.dev_id)
+else:
+ adapter_path = manager.DefaultAdapter()
+
+adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
+ "org.bluez.Adapter")
+
+if (len(args) < 1):
print "Usage: %s <command>" % (sys.argv[0])
print ""
print " addrecord <file>"
sys.exit(1)
-if (sys.argv[1] == "addrecord"):
- if (len(sys.argv) < 3):
+if (args[0] == "addrecord"):
+ if (len(args) < 2):
print "Need file parameter"
else:
- f = open(sys.argv[2])
+ f = open(args[1])
record = f.read()
f.close()
handle = adapter.AddRecord(record)
diff --git a/test/test-telephony b/test/test-telephony
index eb695117c..5ef0ac8ac 100755
--- a/test/test-telephony
+++ b/test/test-telephony
@@ -2,16 +2,32 @@
import sys
import dbus
+from optparse import OptionParser, make_option
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.bluez.Manager")
-adapter = dbus.Interface(bus.get_object("org.bluez", manager.DefaultAdapter()),
- "org.bluez.Adapter")
+
+option_list = [
+ make_option("-i", "--device", action="store",
+ type="string", dest="dev_id"),
+ ]
+parser = OptionParser(option_list=option_list)
+
+(options, args) = parser.parse_args()
+
+if options.dev_id:
+ adapter_path = manager.FindAdapter(options.dev_id)
+else:
+ adapter_path = manager.DefaultAdapter()
+
+adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
+ "org.bluez.Adapter")
+
test = dbus.Interface(bus.get_object("org.bluez", "/org/bluez/test"),
"org.bluez.TelephonyTest")
-if len(sys.argv) < 2:
+if len(args) < 1:
print """Usage: %s <command>
connect <bdaddr>
@@ -31,127 +47,127 @@ if len(sys.argv) < 2:
""" % sys.argv[0]
sys.exit(1)
-if sys.argv[1] == "connect":
- if len(sys.argv) < 3:
+if args[0] == "connect":
+ if len(args) < 2:
print "Need device address parameter"
sys.exit(1)
- device = adapter.FindDevice(sys.argv[2])
+ device = adapter.FindDevice(args[1])
headset = dbus.Interface(bus.get_object("org.bluez", device),
"org.bluez.Headset")
headset.Connect()
sys.exit(0)
-if sys.argv[1] == "disconnect":
- if len(sys.argv) < 3:
+if args[0] == "disconnect":
+ if len(args) < 2:
print "Need device address parameter"
sys.exit(1)
- device = adapter.FindDevice(sys.argv[2])
+ device = adapter.FindDevice(args[1])
headset = dbus.Interface(bus.get_object("org.bluez", device),
"org.bluez.Headset")
headset.Disconnect()
sys.exit(0)
-if sys.argv[1] == "speakergain":
- if len(sys.argv) < 3:
+if args[0] == "speakergain":
+ if len(args) < 2:
print "Need device address parameter"
sys.exit(1)
- device = adapter.FindDevice(sys.argv[2])
+ device = adapter.FindDevice(args[1])
headset = dbus.Interface(bus.get_object("org.bluez", device),
"org.bluez.Headset")
- if len(sys.argv) > 3:
- headset.SetProperty('SpeakerGain', dbus.UInt16(sys.argv[3]))
+ if len(args) > 2:
+ headset.SetProperty('SpeakerGain', dbus.UInt16(args[2]))
else:
props = headset.GetProperties()
print props['SpeakerGain']
sys.exit(0)
-if sys.argv[1] == "microphonegain":
- if len(sys.argv) < 3:
+if args[0] == "microphonegain":
+ if len(args) < 2:
print "Need device address parameter"
sys.exit(1)
- device = adapter.FindDevice(sys.argv[2])
+ device = adapter.FindDevice(args[1])
headset = dbus.Interface(bus.get_object("org.bluez", device),
"org.bluez.Headset")
- if len(sys.argv) > 3:
- headset.SetProperty('MicrophoneGain', dbus.UInt16(sys.argv[3]))
+ if len(args) > 2:
+ headset.SetProperty('MicrophoneGain', dbus.UInt16(args[2]))
else:
props = headset.GetProperties()
print props['MicrophoneGain']
sys.exit(0)
-if sys.argv[1] == "play":
- if len(sys.argv) < 3:
+if args[0] == "play":
+ if len(args) < 2:
print "Need device address parameter"
sys.exit(1)
- device = adapter.FindDevice(sys.argv[2])
+ device = adapter.FindDevice(args[1])
headset = dbus.Interface(bus.get_object("org.bluez", device),
"org.bluez.Headset")
headset.Play()
sys.exit(0)
-if sys.argv[1] == "stop":
- if len(sys.argv) < 3:
+if args[0] == "stop":
+ if len(args) < 2:
print "Need device address parameter"
sys.exit(1)
- device = adapter.FindDevice(sys.argv[2])
+ device = adapter.FindDevice(args[1])
headset = dbus.Interface(bus.get_object("org.bluez", device),
"org.bluez.Headset")
headset.Stop()
sys.exit(0)
-if sys.argv[1] == "outgoing":
- if len(sys.argv) > 2:
- test.OutgoingCall(sys.argv[2])
+if args[0] == "outgoing":
+ if len(args) > 1:
+ test.OutgoingCall(args[1])
else:
print "Need number parameter"
sys.exit(0)
-if sys.argv[1] == "incoming":
- if len(sys.argv) > 2:
- test.IncomingCall(sys.argv[2])
+if args[0] == "incoming":
+ if len(args) > 1:
+ test.IncomingCall(args[1])
else:
print "Need number parameter"
sys.exit(0)
-if sys.argv[1] == "cancel":
+if args[0] == "cancel":
test.CancelCall()
sys.exit(0)
-if sys.argv[1] == "signal":
- if len(sys.argv) > 2:
- test.SignalStrength(sys.argv[2])
+if args[0] == "signal":
+ if len(args) > 1:
+ test.SignalStrength(args[1])
else:
print "Need signal strength parameter"
sys.exit(0)
-if sys.argv[1] == "battery":
- if len(sys.argv) > 2:
- test.BatteryLevel(sys.argv[2])
+if args[0] == "battery":
+ if len(args) > 1:
+ test.BatteryLevel(args[1])
else:
print "Need battery level parameter"
sys.exit(0)
-if sys.argv[1] == "roaming":
- if len(sys.argv) > 2:
- test.RoamingStatus(sys.argv[2] == "yes" or False)
+if args[0] == "roaming":
+ if len(args) > 1:
+ test.RoamingStatus(args[1] == "yes" or False)
else:
print "Need yes/no parameter"
sys.exit(0)
-if sys.argv[1] == "registration":
- if len(sys.argv) > 2:
- test.RegistrationStatus(sys.argv[2] == "yes" or False)
+if args[0] == "registration":
+ if len(args) > 1:
+ test.RegistrationStatus(args[1] == "yes" or False)
else:
print "Need yes/no parameter"
sys.exit(0)
-if sys.argv[1] == "subscriber":
- if len(sys.argv) > 2:
- test.SetSubscriberNumber(sys.argv[2])
+if args[0] == "subscriber":
+ if len(args) > 1:
+ test.SetSubscriberNumber(args[1])
else:
print "Need number parameter"
sys.exit(0)