From: Marcel Holtmann Date: Mon, 16 Aug 2010 17:09:30 +0000 (+0200) Subject: Add another test script for USSD transactions X-Git-Tag: 0.27~197 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0e4aaf004258188561cf58737e772deb4b2e4216;p=platform%2Fupstream%2Fofono.git Add another test script for USSD transactions --- diff --git a/Makefile.am b/Makefile.am index d704768..16a3a3d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -339,6 +339,7 @@ test_scripts = test/activate-context \ test/test-voicecall \ test/test-ussd \ test/cancel-ussd \ + test/initiate-ussd \ test/offline-modem \ test/online-modem \ test/get-tech-preference \ diff --git a/test/cancel-ussd b/test/cancel-ussd index 3bccb98..65b0f55 100755 --- a/test/cancel-ussd +++ b/test/cancel-ussd @@ -9,10 +9,15 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'), 'org.ofono.Manager') properties = manager.GetProperties() - path = properties["Modems"][0] ussd = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.SupplementaryServices') -ussd.Cancel() +properties = ussd.GetProperties() +state = properties["State"] + +print "State: %s" % (state) + +if state != "idle": + ussd.Cancel() diff --git a/test/initiate-ussd b/test/initiate-ussd new file mode 100755 index 0000000..ab0a8c4 --- /dev/null +++ b/test/initiate-ussd @@ -0,0 +1,59 @@ +#!/usr/bin/python + +import sys +import dbus + +if (len(sys.argv) < 2): + print "Usage: %s " % (sys.argv[0]) + sys.exit(1) + +bus = dbus.SystemBus() + +manager = dbus.Interface(bus.get_object('org.ofono', '/'), + 'org.ofono.Manager') + +properties = manager.GetProperties() +path = properties["Modems"][0] + +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": + sys.exit(1); + +result = ussd.Initiate(sys.argv[1], timeout=100) + +properties = ussd.GetProperties() +state = properties["State"] + +print result[0] + ": " + result[1] + +if state == "idle": + sys.exit(0) + +print "State: %s" % (state) + +if state != "user-response": + ussd.Cancel() + sys.exit(0) + +response = raw_input("Enter response: ") + +result = ussd.Respond(response) + +properties = ussd.GetProperties() +state = properties["State"] + +print result + +if state == "idle": + sys.exit(0) + +print "State: %s" % (state) + +ussd.Cancel()