mirror of git://git.sysmocom.de/ofono
test: Remove test-ussd as it is redundant
This commit is contained in:
parent
335b349423
commit
8eefc22bb1
|
@ -583,7 +583,6 @@ test_scripts = test/backtrace \
|
||||||
test/test-ss-control-cf \
|
test/test-ss-control-cf \
|
||||||
test/test-ss-control-cs \
|
test/test-ss-control-cs \
|
||||||
test/test-voicecall \
|
test/test-voicecall \
|
||||||
test/test-ussd \
|
|
||||||
test/send-ussd \
|
test/send-ussd \
|
||||||
test/cancel-ussd \
|
test/cancel-ussd \
|
||||||
test/initiate-ussd \
|
test/initiate-ussd \
|
||||||
|
|
|
@ -1,75 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
|
|
||||||
import sys
|
|
||||||
import gobject
|
|
||||||
import os
|
|
||||||
|
|
||||||
import dbus
|
|
||||||
import dbus.mainloop.glib
|
|
||||||
|
|
||||||
state = None
|
|
||||||
|
|
||||||
def ussd_notification_received(content):
|
|
||||||
print("Network sent a Notification: " + content)
|
|
||||||
|
|
||||||
def ussd_request_received(content):
|
|
||||||
print("Network sent a Request: " + content)
|
|
||||||
ss.Cancel()
|
|
||||||
|
|
||||||
def ussd_property_changed(name, value):
|
|
||||||
global state
|
|
||||||
if name != "State":
|
|
||||||
return
|
|
||||||
print("USSD session state is " + value)
|
|
||||||
state = str(value)
|
|
||||||
|
|
||||||
def stdin_handler(fd, condition):
|
|
||||||
s = os.read(fd.fileno(), 160).rstrip()
|
|
||||||
if not s:
|
|
||||||
ss.Cancel()
|
|
||||||
elif state == "user-response":
|
|
||||||
print ss.Respond(s, timeout = 100)
|
|
||||||
elif state == "idle":
|
|
||||||
print ss.Initiate(s, timeout = 100)
|
|
||||||
else:
|
|
||||||
print "Invalid state", state
|
|
||||||
return True
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
if (len(sys.argv) < 2):
|
|
||||||
print "Usage: %s [modem] <ussd-string>" % (sys.argv[0])
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
|
|
||||||
|
|
||||||
bus = dbus.SystemBus()
|
|
||||||
|
|
||||||
manager = dbus.Interface(bus.get_object('org.ofono', '/'),
|
|
||||||
'org.ofono.Manager')
|
|
||||||
|
|
||||||
modems = manager.GetModems()
|
|
||||||
modem = modems[0][0]
|
|
||||||
|
|
||||||
if (len(sys.argv) == 2):
|
|
||||||
ussd = sys.argv[1]
|
|
||||||
else:
|
|
||||||
modem = sys.argv[1]
|
|
||||||
ussd = sys.argv[2]
|
|
||||||
|
|
||||||
ss = dbus.Interface(bus.get_object('org.ofono', modem),
|
|
||||||
'org.ofono.SupplementaryServices')
|
|
||||||
|
|
||||||
props = ss.GetProperties()
|
|
||||||
for p in props:
|
|
||||||
ussd_property_changed(p, props[p])
|
|
||||||
|
|
||||||
ss.connect_to_signal("NotificationReceived", ussd_notification_received)
|
|
||||||
ss.connect_to_signal("RequestReceived", ussd_request_received)
|
|
||||||
ss.connect_to_signal("PropertyChanged", ussd_property_changed)
|
|
||||||
|
|
||||||
print ss.Initiate(ussd, timeout=100)
|
|
||||||
|
|
||||||
gobject.io_add_watch(sys.stdin, gobject.IO_IN, stdin_handler)
|
|
||||||
|
|
||||||
mainloop = gobject.MainLoop()
|
|
||||||
mainloop.run()
|
|
Loading…
Reference in New Issue