diff options
author | Philippe Nunes <philippe.nunes@linux.intel.com> | 2012-07-26 17:57:54 +0200 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2012-07-27 00:30:57 -0500 |
commit | 335b349423d63f577d9339ffc718d747cc2a6f2c (patch) | |
tree | 6895379a4bcbfd90c9a8e92d9cc54bb8e36d1a9b /test/send-ussd | |
parent | 9f3f5bce6f89045918ae9b7fede66abf0c51d59e (diff) | |
download | ofono-335b349423d63f577d9339ffc718d747cc2a6f2c.tar.bz2 |
test: Add send-ussd script
Simpler script that test-ussd that is still capable of replying to
network initiated USSD requests and USSD dialogs.
Diffstat (limited to 'test/send-ussd')
-rwxr-xr-x | test/send-ussd | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/test/send-ussd b/test/send-ussd new file mode 100755 index 00000000..fcabd21c --- /dev/null +++ b/test/send-ussd @@ -0,0 +1,57 @@ +#!/usr/bin/python + +import sys +import dbus + +if (len(sys.argv) < 2): + print "Usage: %s [modem] <ussd-string>" % (sys.argv[0]) + sys.exit(1) + +bus = dbus.SystemBus() + +manager = dbus.Interface(bus.get_object('org.ofono', '/'), + 'org.ofono.Manager') + +modems = manager.GetModems() + +if (len(sys.argv) == 2): + path = modems[0][0] + ussdstring = sys.argv[1] +else: + path = sys.argv[1] + ussdstring = sys.argv[2] + +ussd = dbus.Interface(bus.get_object('org.ofono', path), + 'org.ofono.SupplementaryServices') + +properties = ussd.GetProperties() +state = properties["State"] + +print "State: %s" % (state) + +if state == "idle": + result = ussd.Initiate(ussdstring, timeout=100) + print result[0] + ": " + result[1] +elif state == "user-response": + print ussd.Respond(ussdstring, timeout=100) +else: + sys.exit(1); + +properties = ussd.GetProperties() +state = properties["State"] + +if state == "idle": + sys.exit(0) + +print "State: %s" % (state) + +while state == "user-response": + response = raw_input("Enter response: ") + + print ussd.Respond(response, timeout=100) + + properties = ussd.GetProperties() + state = properties["State"] + + if state != "idle": + print "State: %s" % (state) |