mirror of git://git.sysmocom.de/ofono
test: add set-call-forwarding
This commit is contained in:
parent
8c7925841f
commit
5213119ac5
|
@ -449,7 +449,8 @@ test_scripts = test/backtrace \
|
||||||
test/set-tty \
|
test/set-tty \
|
||||||
test/set-gsm-band \
|
test/set-gsm-band \
|
||||||
test/set-umts-band \
|
test/set-umts-band \
|
||||||
test/lockdown-modem
|
test/lockdown-modem \
|
||||||
|
test/set-call-forwarding
|
||||||
|
|
||||||
if TEST
|
if TEST
|
||||||
testdir = $(pkglibdir)/test
|
testdir = $(pkglibdir)/test
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import gobject
|
||||||
|
|
||||||
|
import dbus
|
||||||
|
import dbus.mainloop.glib
|
||||||
|
|
||||||
|
def property_changed(property, value):
|
||||||
|
if len(value.__str__()) > 0:
|
||||||
|
print "CF property %s changed to %s" % (property, value)
|
||||||
|
else:
|
||||||
|
print "CF property %s changed to disabled" % (property)
|
||||||
|
|
||||||
|
if canexit:
|
||||||
|
mainloop.quit();
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
if len(sys.argv) < 3:
|
||||||
|
print "Usage: %s <property> <value>" % (sys.argv[0])
|
||||||
|
print "Properties can be: VoiceUnconditional, VoiceBusy,"
|
||||||
|
print " VoiceNoReply, VoiceNoReplyTimeout, VoiceNotReachable"
|
||||||
|
print "Value: number to or the timeout"
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
property = sys.argv[1]
|
||||||
|
value = sys.argv[2]
|
||||||
|
|
||||||
|
canexit = False
|
||||||
|
|
||||||
|
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()
|
||||||
|
|
||||||
|
cf = dbus.Interface(bus.get_object('org.ofono', modems[0][0]),
|
||||||
|
'org.ofono.CallForwarding')
|
||||||
|
|
||||||
|
cf.connect_to_signal("PropertyChanged", property_changed)
|
||||||
|
|
||||||
|
if (property == "VoiceNoReplyTimeout"):
|
||||||
|
try:
|
||||||
|
cf.SetProperty(property, dbus.UInt16(value),
|
||||||
|
timeout = 100)
|
||||||
|
except dbus.DBusException, e:
|
||||||
|
print "Unable SetProperty", e
|
||||||
|
sys.exit(1);
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
cf.SetProperty(property, value, timeout = 100)
|
||||||
|
except dbus.DBusException, e:
|
||||||
|
print "Unable SetProperty", e
|
||||||
|
sys.exit(1);
|
||||||
|
|
||||||
|
print "Set Property successfull"
|
||||||
|
|
||||||
|
canexit = True
|
||||||
|
|
||||||
|
mainloop = gobject.MainLoop()
|
||||||
|
mainloop.run()
|
Loading…
Reference in New Issue