test: add script to set credentials for cdma connection
authorGuillaume Zajac <guillaume.zajac@linux.intel.com>
Wed, 27 Jul 2011 14:19:29 +0000 (16:19 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 27 Jul 2011 14:32:55 +0000 (16:32 +0200)
Makefile.am
test/cdma-set-credentials [new file with mode: 0755]

index d44e62b..89190ad 100644 (file)
@@ -528,6 +528,7 @@ test_scripts = test/backtrace \
                test/cdma-list-call \
                test/cdma-dial-number \
                test/cdma-hangup \
+               test/cdma-set-credentials \
                test/disable-call-forwarding \
                test/list-messages \
                test/test-sms \
diff --git a/test/cdma-set-credentials b/test/cdma-set-credentials
new file mode 100755 (executable)
index 0000000..249ac11
--- /dev/null
@@ -0,0 +1,28 @@
+#!/usr/bin/python
+
+import dbus
+import sys
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+                                               'org.ofono.Manager')
+
+modems = manager.GetModems()
+
+for path, properties in modems:
+       if "org.ofono.cdma.ConnectionManager" not in properties["Interfaces"]:
+               continue
+
+       cm = dbus.Interface(bus.get_object('org.ofono', path),
+                                       'org.ofono.cdma.ConnectionManager')
+
+       print "Connecting CDMA Packet Data Service on modem %s..." % path
+
+       if len(sys.argv) > 1:
+               cm.SetProperty("Username", (sys.argv[1]))
+               print "Setting Username to %s" % (sys.argv[1])
+
+       if len(sys.argv) > 2:
+               cm.SetProperty("Password", (sys.argv[2]))
+               print "Setting Password to %s" % (sys.argv[2])