Adding basic Call Forwarding test scripts

This commit is contained in:
Denis Kenzior 2009-05-21 16:18:49 -05:00
parent 6fb0d8dbfe
commit 3016d0859d
2 changed files with 200 additions and 0 deletions

122
test/test-call-forwarding Executable file
View File

@ -0,0 +1,122 @@
#!/usr/bin/python
import gobject
import dbus
import dbus.mainloop.glib
def property_changed(property, value):
print "CallForwarding property %s changed to %s" % (property, value)
def print_properties(cf):
properties = cf.GetProperties()
for p in properties:
if len(properties[p].__str__()) > 0:
print "%s call forwarding rule is: %s" % (p, properties[p])
else:
print "%s call forwarding rule disabled" % (p)
if __name__ == "__main__":
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object('org.ofono', '/'),
'org.ofono.Manager')
try:
modems = manager.GetProperties()['Modems']
except dbus.DBusException, e:
print "Unable to get the modem list %s" % e
cf = dbus.Interface(bus.get_object('org.ofono', modems[0]),
'org.ofono.CallForwarding')
cf.connect_to_signal("PropertyChanged", property_changed)
print_properties(cf)
try:
cf.SetProperty("FoobarNoReplyTimeout", dbus.UInt16(19))
except dbus.DBusException, e:
print "Unable to set timeout - Good"
try:
cf.SetProperty("VoiceNotReachableTimeout", dbus.UInt16(19))
except dbus.DBusException, e:
print "Unable to set timeout - Good"
try:
cf.SetProperty("VoiceNoReplyTimeout", dbus.UInt16(19))
except dbus.DBusException, e:
print "Unable to set timeout - Good"
try:
cf.SetProperty("DataNoReplyTimeout", dbus.UInt16(19))
except dbus.DBusException, e:
print "Unable to set timeout - Good"
try:
cf.SetProperty("FaxNoReplyTimeout", dbus.UInt16(19))
except dbus.DBusException, e:
print "Unable to set timeout - Good"
try:
cf.SetProperty("SmsNoReplyTimeout", dbus.UInt16(19))
except dbus.DBusException, e:
print "Unable to set timeout - Good"
try:
cf.SetProperty("VoiceNoReply", "")
except dbus.DBusException, e:
print "Unable to erase voice no reply rule - Bad"
try:
cf.SetProperty("VoiceNoReply", "+134444")
except dbus.DBusException, e:
print "Unable to register voice no reply rule - Bad"
try:
cf.SetProperty("VoiceNoReplyTimeout", dbus.UInt16(30))
except dbus.DBusException, e:
print "Unable to set voice no reply timeout - Bad"
properties = cf.GetProperties()
print properties["VoiceNoReply"]
print properties["VoiceNoReplyTimeout"]
try:
cf.SetProperty("VoiceUnconditional", "+155555")
except dbus.DBusException, e:
print "Unable to set Voice Unconditional - Bad"
properties = cf.GetProperties()
print properties["VoiceUnconditional"]
try:
cf.DisableAll("foobar")
except dbus.DBusException, e:
print "Unable to delete invalids - Good"
try:
cf.DisableAll("conditional")
except dbus.DBusException, e:
print "Unable to delete all conditional - Bad"
properties = cf.GetProperties()
print properties["VoiceNoReply"]
print properties["VoiceNoReplyTimeout"]
try:
cf.DisableAll("all")
except dbus.DBusException, e:
print "Unable to delete all conditional - Bad"
print properties["VoiceUnconditional"]
mainloop = gobject.MainLoop()
mainloop.run()

78
test/test-ss-control-cf Executable file
View File

@ -0,0 +1,78 @@
#!/usr/bin/python
import gobject
import dbus
import dbus.mainloop.glib
def property_changed(property, value):
print "CallForwarding property %s changed to %s" % (property, value)
def print_properties(cf):
properties = cf.GetProperties()
for p in properties:
if len(properties[p].__str__()) > 0:
value = properties[p]
else:
value = "disabled"
print "%s call forwarding rule: %s" % (p, value)
if __name__ == "__main__":
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object('org.ofono', '/'),
'org.ofono.Manager')
try:
modems = manager.GetProperties()['Modems']
except dbus.DBusException, e:
print "Unable to get the Modems property %s" % e
cf = dbus.Interface(bus.get_object('org.ofono', modems[0]),
'org.ofono.CallForwarding')
cf.connect_to_signal("PropertyChanged", property_changed)
ss = dbus.Interface(bus.get_object('org.ofono', modems[0]),
'org.ofono.SupplementaryServices')
# Clear everything
ss.Initiate("##002#")
print_properties(cf)
# Busy To +155542, for Voice
print "Setting Busy Voice rule to +155542"
print ss.Initiate("*67*+155542*11#")
print_properties(cf)
# Not Reachable to +155543, Voice
print "Setting Voice Not Reachable rule to +155543"
print ss.Initiate("**62*+155543*11#")
# Not Reachable to +155544, Voice service
print "Setting Voice No Reply rule to +155544, timeout=30"
print ss.Initiate("**61*+155544*11*30#")
# Unconditional to +155547, Voice
print "Setting Unconditional for Voice to +155545"
print ss.Initiate("*21*+155545*10#")
print_properties(cf)
print "Query all voice forwardings"
print ss.Initiate("*#002**11#")
print "Query no reply voice forwardings"
print ss.Initiate("*#61**11#")
# Deactivate everything
print "Deactivating everything"
print ss.Initiate("##002#")
print_properties(cf)
mainloop = gobject.MainLoop()
mainloop.run()