blob: 435594c91ebdcc6544c9f3e284a6284df3598afc [file] [log] [blame]
from gi.repository import GLib
import dbus
import dbus.mainloop.glib
import sys
def property_changed(name, value):
print("CallSettings property: '%s' changed to '%s'" % (name, value))
if canexit:
if __name__ == "__main__":
if len(sys.argv) < 3:
print("Usage: %s [modem] <property> <newvalue>" % (sys.argv[0]))
print("Properties can be: VoiceCallWaiting,")
print(" ConnectedLineRestriction, CallingLineRestriction,")
print(" CallingLinePresentation, CalledLinePresentation,")
print(" ConnectedLinePresentation, HideCallerId")
canexit = False
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems()
modem = modems[0][0]
if (len(sys.argv) == 4):
modem = sys.argv[1]
property = sys.argv[2]
newvalue = sys.argv[3]
property = sys.argv[1]
newvalue = sys.argv[2]
print("Using modem %s" % modem)
cs = dbus.Interface(bus.get_object('org.ofono', modem),
cs.connect_to_signal("PropertyChanged", property_changed)
properties = cs.GetProperties()
print("Current Property values:")
print("Network Status of Call Waiting - Voice: %s" %\
print("Network Status of Connected Line Restriction: %s" %\
print("Network Status of Calling Line Restriction: %s" %\
print("Network Status of Calling Line Presentation: %s" %\
print("Network Status of Called Line Presentation: %s" %\
print("Network Status of Connected Line Presentation: %s" %\
print("Hide my Caller Id: %s" % (properties['HideCallerId']))
cs.SetProperty(property, newvalue)
except dbus.DBusException as e:
print("Unable to set property: %s" % e)
print("Setting successful")
if (properties[property] == newvalue):
print("Setting was already set to this value")
canexit = True
mainloop = GLib.MainLoop()