test: Make print calls compatible with Python 3

Turn print calls into print() function calls and avoid using
comma-separated arguments, so that they work and look the same with
both Python 2 and 3.
This commit is contained in:
Martin Pitt 2014-03-11 17:39:18 +01:00 committed by Denis Kenzior
parent c54e4763f8
commit 0c1fcd2b50
86 changed files with 576 additions and 576 deletions

View File

@ -20,7 +20,7 @@ for path, properties in modems:
contexts = connman.GetContexts() contexts = connman.GetContexts()
if (len(contexts) == 0): if (len(contexts) == 0):
print "No context available" print("No context available")
sys.exit(1) sys.exit(1)
connman.SetProperty("Powered", dbus.Boolean(1)) connman.SetProperty("Powered", dbus.Boolean(1))
@ -36,5 +36,5 @@ for path, properties in modems:
try: try:
context.SetProperty("Active", dbus.Boolean(1), timeout = 100) context.SetProperty("Active", dbus.Boolean(1), timeout = 100)
except dbus.DBusException, e: except dbus.DBusException, e:
print "Error activating %s: %s" % (path, str(e)) print("Error activating %s: %s" % (path, str(e)))
exit(2) exit(2)

View File

@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems() modems = manager.GetModems()
for path, properties in modems: for path, properties in modems:
print "[ %s ]" % (path) print("[ %s ]" % (path))
if "org.ofono.VoiceCallManager" not in properties["Interfaces"]: if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
continue continue
@ -22,7 +22,7 @@ for path, properties in modems:
for path, properties in calls: for path, properties in calls:
state = properties["State"] state = properties["State"]
print "[ %s ] %s" % (path, state) print("[ %s ] %s" % (path, state))
if state != "incoming": if state != "incoming":
continue continue

View File

@ -6,7 +6,7 @@ import sys
import subprocess import subprocess
if (len(sys.argv) < 3): if (len(sys.argv) < 3):
print "Usage: %s [binary] [log]" % (sys.argv[0]) print("Usage: %s [binary] [log]" % (sys.argv[0]))
sys.exit(1) sys.exit(1)
binary = sys.argv[1] binary = sys.argv[1]
@ -50,8 +50,8 @@ child_stdout.close()
frame_count = len(frames); frame_count = len(frames);
count = 0 count = 0
print "-------- backtrace --------" print("-------- backtrace --------")
while count < frame_count: while count < frame_count:
print "[%d]: %s() [%s]" % (count/2, frames[count], frames[count + 1]) print("[%d]: %s() [%s]" % (count/2, frames[count], frames[count + 1]))
count = count + 2 count = count + 2
print "---------------------------" print("---------------------------")

View File

@ -21,7 +21,7 @@ ussd = dbus.Interface(bus.get_object('org.ofono', path),
properties = ussd.GetProperties() properties = ussd.GetProperties()
state = properties["State"] state = properties["State"]
print "State: %s" % (state) print("State: %s" % (state))
if state != "idle": if state != "idle":
ussd.Cancel() ussd.Cancel()

View File

@ -13,7 +13,7 @@ else:
modems = manager.GetModems() modems = manager.GetModems()
path = modems[0][0] path = modems[0][0]
print "Disconnecting CDMA Packet Data Service on modem %s..." % path print("Disconnecting CDMA Packet Data Service on modem %s..." % path)
cm = dbus.Interface(bus.get_object('org.ofono', path), cm = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.cdma.ConnectionManager') 'org.ofono.cdma.ConnectionManager')

View File

@ -13,7 +13,7 @@ else:
modems = manager.GetModems() modems = manager.GetModems()
path = modems[0][0] path = modems[0][0]
print "Connecting CDMA Packet Data Service on modem %s..." % path print("Connecting CDMA Packet Data Service on modem %s..." % path)
cm = dbus.Interface(bus.get_object('org.ofono', path), cm = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.cdma.ConnectionManager') 'org.ofono.cdma.ConnectionManager')

View File

@ -16,7 +16,7 @@ else:
path, properties = modems[0] path, properties = modems[0]
number = sys.argv[1] number = sys.argv[1]
print "Using modem %s" % path print("Using modem %s" % path)
manager = dbus.Interface(bus.get_object('org.ofono', path), manager = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.cdma.VoiceCallManager') 'org.ofono.cdma.VoiceCallManager')

View File

@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems() modems = manager.GetModems()
for path, properties in modems: for path, properties in modems:
print "[ %s ]" % (path) print("[ %s ]" % (path))
if "org.ofono.cdma.VoiceCallManager" not in properties["Interfaces"]: if "org.ofono.cdma.VoiceCallManager" not in properties["Interfaces"]:
continue continue
@ -22,4 +22,4 @@ for path, properties in modems:
for key in properties.keys(): for key in properties.keys():
val = str(properties[key]) val = str(properties[key])
print " %s = %s" % (key, val) print(" %s = %s" % (key, val))

View File

@ -17,12 +17,12 @@ for path, properties in modems:
cm = dbus.Interface(bus.get_object('org.ofono', path), cm = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.cdma.ConnectionManager') 'org.ofono.cdma.ConnectionManager')
print "Connecting CDMA Packet Data Service on modem %s..." % path print("Connecting CDMA Packet Data Service on modem %s..." % path)
if len(sys.argv) > 1: if len(sys.argv) > 1:
cm.SetProperty("Username", (sys.argv[1])) cm.SetProperty("Username", (sys.argv[1]))
print "Setting Username to %s" % (sys.argv[1]) print("Setting Username to %s" % (sys.argv[1]))
if len(sys.argv) > 2: if len(sys.argv) > 2:
cm.SetProperty("Password", (sys.argv[2])) cm.SetProperty("Password", (sys.argv[2]))
print "Setting Password to %s" % (sys.argv[2]) print("Setting Password to %s" % (sys.argv[2]))

View File

@ -19,10 +19,10 @@ elif len(sys.argv) == 3:
old_pin = sys.argv[2] old_pin = sys.argv[2]
new_pin = sys.argv[3] new_pin = sys.argv[3]
else: else:
print "%s [PATH] pin_type old_pin new_pin" % (sys.argv[0]) print("%s [PATH] pin_type old_pin new_pin" % (sys.argv[0]))
sys.exit(0) sys.exit(0)
print "Change %s for modem %s..." % (pin_type, path) print("Change %s for modem %s..." % (pin_type, path))
simmanager = dbus.Interface(bus.get_object('org.ofono', path), simmanager = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.SimManager') 'org.ofono.SimManager')

View File

@ -27,21 +27,21 @@ for path, properties in modems:
if path == "": if path == "":
path = connman.AddContext("internet") path = connman.AddContext("internet")
print "Created new context %s" % (path) print("Created new context %s" % (path))
else: else:
print "Found context %s" % (path) print("Found context %s" % (path))
context = dbus.Interface(bus.get_object('org.ofono', path), context = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.ConnectionContext') 'org.ofono.ConnectionContext')
if len(sys.argv) > 1: if len(sys.argv) > 1:
context.SetProperty("AccessPointName", sys.argv[1]) context.SetProperty("AccessPointName", sys.argv[1])
print "Setting APN to %s" % (sys.argv[1]) print("Setting APN to %s" % (sys.argv[1]))
if len(sys.argv) > 2: if len(sys.argv) > 2:
context.SetProperty("Username", sys.argv[2]) context.SetProperty("Username", sys.argv[2])
print "Setting username to %s" % (sys.argv[2]) print("Setting username to %s" % (sys.argv[2]))
if len(sys.argv) > 3: if len(sys.argv) > 3:
context.SetProperty("Password", sys.argv[3]) context.SetProperty("Password", sys.argv[3])
print "Setting password to %s" % (sys.argv[3]) print("Setting password to %s" % (sys.argv[3]))

View File

@ -27,21 +27,21 @@ for path, properties in modems:
if path == "": if path == "":
path = connman.AddContext("mms") path = connman.AddContext("mms")
print "Created new context %s" % (path) print("Created new context %s" % (path))
else: else:
print "Found context %s" % (path) print("Found context %s" % (path))
context = dbus.Interface(bus.get_object('org.ofono', path), context = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.ConnectionContext') 'org.ofono.ConnectionContext')
if len(sys.argv) > 1: if len(sys.argv) > 1:
context.SetProperty("AccessPointName", sys.argv[1]) context.SetProperty("AccessPointName", sys.argv[1])
print "Setting APN to %s" % (sys.argv[1]) print("Setting APN to %s" % (sys.argv[1]))
if len(sys.argv) > 2: if len(sys.argv) > 2:
context.SetProperty("Username", sys.argv[2]) context.SetProperty("Username", sys.argv[2])
print "Setting username to %s" % (sys.argv[2]) print("Setting username to %s" % (sys.argv[2]))
if len(sys.argv) > 3: if len(sys.argv) > 3:
context.SetProperty("Password", sys.argv[3]) context.SetProperty("Password", sys.argv[3])
print "Setting password to %s" % (sys.argv[3]) print("Setting password to %s" % (sys.argv[3]))

View File

@ -21,4 +21,4 @@ manager = dbus.Interface(bus.get_object('org.ofono', path),
mpty = manager.CreateMultiparty() mpty = manager.CreateMultiparty()
for path in mpty: for path in mpty:
print path print(path)

View File

@ -20,7 +20,7 @@ for path, properties in modems:
contexts = connman.GetContexts() contexts = connman.GetContexts()
if (len(contexts) == 0): if (len(contexts) == 0):
print "No context available" print("No context available")
sys.exit(1) sys.exit(1)
if len(sys.argv) > 1: if len(sys.argv) > 1:
@ -34,5 +34,5 @@ for path, properties in modems:
try: try:
context.SetProperty("Active", dbus.Boolean(0)) context.SetProperty("Active", dbus.Boolean(0))
except dbus.DBusException, e: except dbus.DBusException, e:
print "Error activating %s: %s" % (path, str(e)) print("Error activating %s: %s" % (path, str(e)))
exit(2) exit(2)

View File

@ -4,7 +4,7 @@ import sys
import dbus import dbus
if (len(sys.argv) < 2): if (len(sys.argv) < 2):
print "Usage: %s [modem] <number> [hide_callerid]" % (sys.argv[0]) print("Usage: %s [modem] <number> [hide_callerid]" % (sys.argv[0]))
sys.exit(1) sys.exit(1)
bus = dbus.SystemBus() bus = dbus.SystemBus()
@ -32,11 +32,11 @@ else:
number = sys.argv[2] number = sys.argv[2]
hide_callerid = sys.argv[3] hide_callerid = sys.argv[3]
print "Using modem %s" % modem print("Using modem %s" % modem)
vcm = dbus.Interface(bus.get_object('org.ofono', modem), vcm = dbus.Interface(bus.get_object('org.ofono', modem),
'org.ofono.VoiceCallManager') 'org.ofono.VoiceCallManager')
path = vcm.Dial(number, hide_callerid) path = vcm.Dial(number, hide_callerid)
print path print(path)

View File

@ -8,17 +8,17 @@ import dbus.mainloop.glib
def property_changed(property, value): def property_changed(property, value):
if len(value.__str__()) > 0: if len(value.__str__()) > 0:
print "CF property %s changed to %s" % (property, value) print("CF property %s changed to %s" % (property, value))
else: else:
print "CF property %s changed to disabled" % (property) print("CF property %s changed to disabled" % (property))
if canexit: if canexit:
mainloop.quit(); mainloop.quit();
if __name__ == "__main__": if __name__ == "__main__":
if len(sys.argv) < 2: if len(sys.argv) < 2:
print "Usage: %s <type>" % (sys.argv[0]) print("Usage: %s <type>" % (sys.argv[0]))
print "Type can be: all, conditional" print("Type can be: all, conditional")
sys.exit(1) sys.exit(1)
canexit = False canexit = False
@ -42,10 +42,10 @@ if __name__ == "__main__":
try: try:
cf.DisableAll(type, timeout = 100) cf.DisableAll(type, timeout = 100)
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to DisableAll", e print("Unable to DisableAll %s" % e)
sys.exit(1); sys.exit(1);
print "DisableAll successful" print("DisableAll successful")
canexit = True canexit = True

View File

@ -13,7 +13,7 @@ else:
modems = manager.GetModems() modems = manager.GetModems()
path = modems[0][0] path = modems[0][0]
print "Disconnecting GPRS on modem %s..." % path print("Disconnecting GPRS on modem %s..." % path)
cm = dbus.Interface(bus.get_object('org.ofono', path), cm = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.ConnectionManager') 'org.ofono.ConnectionManager')

View File

@ -13,7 +13,7 @@ else:
modems = manager.GetModems() modems = manager.GetModems()
path = modems[0][0] path = modems[0][0]
print "Disconnecting modem %s..." % path print("Disconnecting modem %s..." % path)
modem = dbus.Interface(bus.get_object('org.ofono', path), modem = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.Modem') 'org.ofono.Modem')

View File

@ -4,7 +4,7 @@ import sys
import dbus import dbus
if (len(sys.argv) < 2): if (len(sys.argv) < 2):
print "Usage: %s [modem] icon_id" % (sys.argv[0]) print("Usage: %s [modem] icon_id" % (sys.argv[0]))
sys.exit(1) sys.exit(1)
bus = dbus.SystemBus() bus = dbus.SystemBus()
@ -21,7 +21,7 @@ elif (len(sys.argv) == 3):
modem = sys.argv[1] modem = sys.argv[1]
icon = sys.argv[2] icon = sys.argv[2]
print "Using modem %s" % modem print("Using modem %s" % modem)
sim = dbus.Interface(bus.get_object('org.ofono', modem), sim = dbus.Interface(bus.get_object('org.ofono', modem),
'org.ofono.SimManager') 'org.ofono.SimManager')

View File

@ -13,7 +13,7 @@ else:
devices = manager.GetDevices() devices = manager.GetDevices()
path = devices[0][0] path = devices[0][0]
print "Connect device %s..." % path print("Connect device %s..." % path)
device = dbus.Interface(bus.get_object('org.ofono.dundee', path), device = dbus.Interface(bus.get_object('org.ofono.dundee', path),
'org.ofono.dundee.Device') 'org.ofono.dundee.Device')

View File

@ -13,7 +13,7 @@ else:
devices = manager.GetDevices() devices = manager.GetDevices()
path = devices[0][0] path = devices[0][0]
print "Disconnect device %s..." % path print("Disconnect device %s..." % path)
device = dbus.Interface(bus.get_object('org.ofono.dundee', path), device = dbus.Interface(bus.get_object('org.ofono.dundee', path),
'org.ofono.dundee.Device') 'org.ofono.dundee.Device')

View File

@ -13,7 +13,7 @@ else:
modems = manager.GetModems() modems = manager.GetModems()
path = modems[0][0] path = modems[0][0]
print "Enabling cell broadcast on modem %s..." % path print("Enabling cell broadcast on modem %s..." % path)
cbs = dbus.Interface(bus.get_object('org.ofono', path), cbs = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.CellBroadcast') 'org.ofono.CellBroadcast')

View File

@ -13,7 +13,7 @@ else:
modems = manager.GetModems() modems = manager.GetModems()
path = modems[0][0] path = modems[0][0]
print "Connecting modem %s..." % path print("Connecting modem %s..." % path)
cm = dbus.Interface(bus.get_object('org.ofono', path), cm = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.ConnectionManager') 'org.ofono.ConnectionManager')

View File

@ -13,7 +13,7 @@ else:
modems = manager.GetModems() modems = manager.GetModems()
path = modems[0][0] path = modems[0][0]
print "Connecting modem %s..." % path print("Connecting modem %s..." % path)
modem = dbus.Interface(bus.get_object('org.ofono', path), modem = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.Modem') 'org.ofono.Modem')

View File

@ -17,10 +17,10 @@ elif len(sys.argv) == 3:
pin_type = sys.argv[1] pin_type = sys.argv[1]
pin = sys.argv[2] pin = sys.argv[2]
else: else:
print "%s [PATH] pin_type pin" % (sys.argv[0]) print("%s [PATH] pin_type pin" % (sys.argv[0]))
sys.exit(0) sys.exit(0)
print "Enter Pin for modem %s..." % path print("Enter Pin for modem %s..." % path)
simmanager = dbus.Interface(bus.get_object('org.ofono', path), simmanager = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.SimManager') 'org.ofono.SimManager')

View File

@ -8,7 +8,7 @@ bus = dbus.SystemBus()
if len(sys.argv) == 2: if len(sys.argv) == 2:
id = sys.argv[1] id = sys.argv[1]
else: else:
print "%s <icon id>" % (sys.argv[0]) print("%s <icon id>" % (sys.argv[0]))
sys.exit(0) sys.exit(0)
manager = dbus.Interface(bus.get_object("org.ofono", "/"), manager = dbus.Interface(bus.get_object("org.ofono", "/"),
@ -28,4 +28,4 @@ icon = sim.GetIcon(dbus.Byte(int(sys.argv[1])))
xpm = "" xpm = ""
for byte in icon: for byte in icon:
xpm += str(byte) xpm += str(byte)
print xpm print(xpm)

View File

@ -22,7 +22,7 @@ for entry in operators:
path = entry[0] path = entry[0]
properties = entry[1] properties = entry[1]
print "[ %s ]" % (path) print("[ %s ]" % (path))
for key in properties.keys(): for key in properties.keys():
if key in ["Technologies"]: if key in ["Technologies"]:
@ -31,7 +31,7 @@ for entry in operators:
val += i + " " val += i + " "
else: else:
val = str(properties[key]) val = str(properties[key])
print " %s = %s" % (key, val) print(" %s = %s" % (key, val))
print print('')

View File

@ -17,4 +17,4 @@ radiosettings = dbus.Interface(bus.get_object('org.ofono', path),
properties = radiosettings.GetProperties() properties = radiosettings.GetProperties()
print "Technology preference: %s" % (properties["TechnologyPreference"]) print("Technology preference: %s" % (properties["TechnologyPreference"]))

View File

@ -18,7 +18,7 @@ calls = manager.GetCalls()
for path, properties in calls: for path, properties in calls:
state = properties["State"] state = properties["State"]
print "[ %s ] %s" % (path, state) print("[ %s ] %s" % (path, state))
if state != "active": if state != "active":
continue continue

View File

@ -6,7 +6,7 @@ import dbus
bus = dbus.SystemBus() bus = dbus.SystemBus()
if (len(sys.argv) < 2): if (len(sys.argv) < 2):
print "Usage: %s [ Call Path ]" % (sys.argv[0]) print("Usage: %s [ Call Path ]" % (sys.argv[0]))
sys.exit(1) sys.exit(1)
call = dbus.Interface(bus.get_object('org.ofono', sys.argv[1]), call = dbus.Interface(bus.get_object('org.ofono', sys.argv[1]),

View File

@ -4,7 +4,7 @@ import sys
import dbus import dbus
if (len(sys.argv) < 2): if (len(sys.argv) < 2):
print "Usage: %s [modem] <ussd-string>" % (sys.argv[0]) print("Usage: %s [modem] <ussd-string>" % (sys.argv[0]))
sys.exit(1) sys.exit(1)
bus = dbus.SystemBus() bus = dbus.SystemBus()
@ -27,7 +27,7 @@ ussd = dbus.Interface(bus.get_object('org.ofono', path),
properties = ussd.GetProperties() properties = ussd.GetProperties()
state = properties["State"] state = properties["State"]
print "State: %s" % (state) print("State: %s" % (state))
if state != "idle": if state != "idle":
sys.exit(1); sys.exit(1);
@ -37,12 +37,12 @@ result = ussd.Initiate(ussdstring, timeout=100)
properties = ussd.GetProperties() properties = ussd.GetProperties()
state = properties["State"] state = properties["State"]
print result[0] + ": " + result[1] print(result[0] + ": " + result[1])
if state == "idle": if state == "idle":
sys.exit(0) sys.exit(0)
print "State: %s" % (state) print("State: %s" % (state))
while state == "user-response": while state == "user-response":
response = raw_input("Enter response: ") response = raw_input("Enter response: ")
@ -52,7 +52,7 @@ while state == "user-response":
properties = ussd.GetProperties() properties = ussd.GetProperties()
state = properties["State"] state = properties["State"]
print result print(result)
if state != "idle": if state != "idle":
print "State: %s" % (state) print("State: %s" % (state))

View File

@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems() modems = manager.GetModems()
for path, properties in modems: for path, properties in modems:
print "[ %s ]" % (path) print("[ %s ]" % (path))
if "org.ofono.VoiceCallManager" not in properties["Interfaces"]: if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
continue continue
@ -21,11 +21,11 @@ for path, properties in modems:
calls = mgr.GetCalls() calls = mgr.GetCalls()
for path, properties in calls: for path, properties in calls:
print " [ %s ]" % (path) print(" [ %s ]" % (path))
for key in properties.keys(): for key in properties.keys():
if key == 'Icon': if key == 'Icon':
print " %s = %d" % (key, properties[key]) print(" %s = %d" % (key, properties[key]))
else: else:
val = str(properties[key]) val = str(properties[key])
print " %s = %s" % (key, val) print(" %s = %s" % (key, val))

View File

@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems() modems = manager.GetModems()
for path, properties in modems: for path, properties in modems:
print "[ %s ]" % (path) print("[ %s ]" % (path))
if "org.ofono.ConnectionManager" not in properties["Interfaces"]: if "org.ofono.ConnectionManager" not in properties["Interfaces"]:
continue continue
@ -21,7 +21,7 @@ for path, properties in modems:
contexts = connman.GetContexts() contexts = connman.GetContexts()
for path, properties in contexts: for path, properties in contexts:
print " [ %s ]" % (path) print(" [ %s ]" % (path))
for key in properties.keys(): for key in properties.keys():
if key in ["Settings"] or key in ["IPv6.Settings"]: if key in ["Settings"] or key in ["IPv6.Settings"]:
@ -39,6 +39,6 @@ for path, properties in modems:
val += " }" val += " }"
else: else:
val = str(properties[key]) val = str(properties[key])
print " %s = %s" % (key, val) print(" %s = %s" % (key, val))
print print('')

View File

@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems() modems = manager.GetModems()
for path, properties in modems: for path, properties in modems:
print "[ %s ]" % (path) print("[ %s ]" % (path))
if "org.ofono.MessageManager" not in properties["Interfaces"]: if "org.ofono.MessageManager" not in properties["Interfaces"]:
continue continue
@ -21,10 +21,10 @@ for path, properties in modems:
contexts = connman.GetMessages() contexts = connman.GetMessages()
for path, properties in contexts: for path, properties in contexts:
print " [ %s ]" % (path) print(" [ %s ]" % (path))
for key in properties.keys(): for key in properties.keys():
val = str(properties[key]) val = str(properties[key])
print " %s = %s" % (key, val) print(" %s = %s" % (key, val))
print print('')

View File

@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems() modems = manager.GetModems()
for path, properties in modems: for path, properties in modems:
print "[ %s ]" % (path) print("[ %s ]" % (path))
for key in properties.keys(): for key in properties.keys():
if key in ["Interfaces", "Features"]: if key in ["Interfaces", "Features"]:
@ -19,13 +19,13 @@ for path, properties in modems:
val += i + " " val += i + " "
else: else:
val = properties[key] val = properties[key]
print " %s = %s" % (key, val) print(" %s = %s" % (key, val))
for interface in properties["Interfaces"]: for interface in properties["Interfaces"]:
object = dbus.Interface(bus.get_object('org.ofono', path), object = dbus.Interface(bus.get_object('org.ofono', path),
interface) interface)
print " [ %s ]" % (interface) print(" [ %s ]" % (interface))
try: try:
properties = object.GetProperties() properties = object.GetProperties()
@ -77,6 +77,6 @@ for path, properties in modems:
val += " }" val += " }"
else: else:
val = properties[key] val = properties[key]
print " %s = %s" % (key, val) print(" %s = %s" % (key, val))
print print('')

View File

@ -11,7 +11,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems() modems = manager.GetModems()
for path, properties in modems: for path, properties in modems:
print "[ %s ]" % (path) print("[ %s ]" % (path))
if "org.ofono.NetworkRegistration" not in properties["Interfaces"]: if "org.ofono.NetworkRegistration" not in properties["Interfaces"]:
continue continue
@ -25,7 +25,7 @@ for path, properties in modems:
operators = netreg.GetOperators() operators = netreg.GetOperators()
for path, properties in operators: for path, properties in operators:
print " [ %s ]" % (path) print(" [ %s ]" % (path))
for key in properties.keys(): for key in properties.keys():
if key in ["Technologies"]: if key in ["Technologies"]:
@ -34,6 +34,6 @@ for path, properties in modems:
val += i + " " val += i + " "
else: else:
val = str(properties[key]) val = str(properties[key])
print " %s = %s" % (key, val) print(" %s = %s" % (key, val))
print print('')

View File

@ -17,10 +17,10 @@ elif len(sys.argv) == 3:
pin_type = sys.argv[1] pin_type = sys.argv[1]
pin = sys.argv[2] pin = sys.argv[2]
else: else:
print "%s [PATH] pin_type pin" % (sys.argv[0]) print("%s [PATH] pin_type pin" % (sys.argv[0]))
sys.exit(0) sys.exit(0)
print "Lock %s %s for modem %s..." % (pin_type, pin, path) print("Lock %s %s for modem %s..." % (pin_type, pin, path))
simmanager = dbus.Interface(bus.get_object('org.ofono', path), simmanager = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.SimManager') 'org.ofono.SimManager')

View File

@ -13,13 +13,13 @@ else:
modems = manager.GetModems() modems = manager.GetModems()
path = modems[0][0] path = modems[0][0]
print "Locking and disconnecting modem %s..." % path print("Locking and disconnecting modem %s..." % path)
modem = dbus.Interface(bus.get_object('org.ofono', path), modem = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.Modem') 'org.ofono.Modem')
modem.SetProperty("Lockdown", dbus.Boolean(1)) modem.SetProperty("Lockdown", dbus.Boolean(1))
print "press ENTER to unlock the modem %s" % path print("press ENTER to unlock the modem %s" % path)
sys.stdin.readline() sys.stdin.readline()
modem.SetProperty("Lockdown", dbus.Boolean(0)) modem.SetProperty("Lockdown", dbus.Boolean(0))

View File

@ -52,32 +52,32 @@ def pretty(d):
def property_changed(name, value, path, interface): def property_changed(name, value, path, interface):
iface = interface[interface.rfind(".") + 1:] iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s = %s" % (iface, path, name, pretty(value)) print("{%s} [%s] %s = %s" % (iface, path, name, pretty(value)))
def added(name, value, member, path, interface): def added(name, value, member, path, interface):
iface = interface[interface.rfind(".") + 1:] iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s %s" % (iface, member, name, pretty(value)) print("{%s} [%s] %s %s" % (iface, member, name, pretty(value)))
def removed(name, member, path, interface): def removed(name, member, path, interface):
iface = interface[interface.rfind(".") + 1:] iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s" % (iface, member, name) print("{%s} [%s] %s" % (iface, member, name))
def event(member, path, interface): def event(member, path, interface):
iface = interface[interface.rfind(".") + 1:] iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s" % (iface, path, member) print("{%s} [%s] %s" % (iface, path, member))
def message(msg, args, member, path, interface): def message(msg, args, member, path, interface):
iface = interface[interface.rfind(".") + 1:] iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s %s (%s)" % (iface, path, member, print("{%s} [%s] %s %s (%s)" % (iface, path, member,
str(msg), pretty(args)) str(msg), pretty(args)))
def ussd(msg, member, path, interface): def ussd(msg, member, path, interface):
iface = interface[interface.rfind(".") + 1:] iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s %s" % (iface, path, member, str(msg)) print("{%s} [%s] %s %s" % (iface, path, member, str(msg)))
def value(value, member, path, interface): def value(value, member, path, interface):
iface = interface[interface.rfind(".") + 1:] iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s %s" % (iface, path, member, str(value)) print("{%s} [%s] %s %s" % (iface, path, member, str(value)))
if __name__ == '__main__': if __name__ == '__main__':
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)

View File

@ -55,32 +55,32 @@ def pretty(d):
def property_changed(name, value, path, interface): def property_changed(name, value, path, interface):
iface = interface[interface.rfind(".") + 1:] iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s = %s" % (iface, path, name, pretty(value)) print("{%s} [%s] %s = %s" % (iface, path, name, pretty(value)))
def added(name, value, member, path, interface): def added(name, value, member, path, interface):
iface = interface[interface.rfind(".") + 1:] iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s %s" % (iface, member, name, pretty(value)) print("{%s} [%s] %s %s" % (iface, member, name, pretty(value)))
def removed(name, member, path, interface): def removed(name, member, path, interface):
iface = interface[interface.rfind(".") + 1:] iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s" % (iface, name, member) print("{%s} [%s] %s" % (iface, name, member))
def event(member, path, interface): def event(member, path, interface):
iface = interface[interface.rfind(".") + 1:] iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s" % (iface, path, member) print("{%s} [%s] %s" % (iface, path, member))
def message(msg, args, member, path, interface): def message(msg, args, member, path, interface):
iface = interface[interface.rfind(".") + 1:] iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s %s (%s)" % (iface, path, member, print("{%s} [%s] %s %s (%s)" % (iface, path, member,
msg, pretty(args)) msg, pretty(args)))
def ussd(msg, member, path, interface): def ussd(msg, member, path, interface):
iface = interface[interface.rfind(".") + 1:] iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s %s" % (iface, path, member, msg) print("{%s} [%s] %s %s" % (iface, path, member, msg))
def value(value, member, path, interface): def value(value, member, path, interface):
iface = interface[interface.rfind(".") + 1:] iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s %s" % (iface, path, member, str(value)) print("{%s} [%s] %s %s" % (iface, path, member, str(value)))
if __name__ == '__main__': if __name__ == '__main__':
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)

View File

@ -12,6 +12,6 @@ else:
modems = manager.GetModems() modems = manager.GetModems()
path = modems[0][0] path = modems[0][0]
print "Setting modem %s offline..." % path print("Setting modem %s offline..." % path)
modem = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.Modem') modem = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.Modem')
modem.SetProperty("Online", dbus.Boolean(0), timeout = 120) modem.SetProperty("Online", dbus.Boolean(0), timeout = 120)

View File

@ -12,6 +12,6 @@ else:
modems = manager.GetModems() modems = manager.GetModems()
path = modems[0][0] path = modems[0][0]
print "Setting modem %s online..." % path print("Setting modem %s online..." % path)
modem = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.Modem') modem = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.Modem')
modem.SetProperty("Online", dbus.Boolean(1), timeout = 120) modem.SetProperty("Online", dbus.Boolean(1), timeout = 120)

View File

@ -23,4 +23,4 @@ manager = dbus.Interface(bus.get_object('org.ofono', path),
mpty = manager.PrivateChat(callid, timeout=100) mpty = manager.PrivateChat(callid, timeout=100)
for path in mpty: for path in mpty:
print path print(path)

View File

@ -23,7 +23,7 @@ for path, properties in modems:
if properties["Active"] == dbus.Boolean(0): if properties["Active"] == dbus.Boolean(0):
continue continue
print "Configuring %s" % (path) print("Configuring %s" % (path))
settings = properties["Settings"] settings = properties["Settings"]
@ -35,20 +35,20 @@ for path, properties in modems:
gateway = "0.0.0.0"; gateway = "0.0.0.0";
if settings["Method"] == "dhcp": if settings["Method"] == "dhcp":
print " Run DHCP on interface %s" % (interface) print(" Run DHCP on interface %s" % (interface))
else: else:
print " Interface is %s" % (interface) print(" Interface is %s" % (interface))
print " IP address is %s" % (address) print(" IP address is %s" % (address))
print " Gateway is %s" % (gateway) print(" Gateway is %s" % (gateway))
cmd = "ifconfig " + interface + " " + address cmd = "ifconfig " + interface + " " + address
cmd += " netmask 255.255.255.255" cmd += " netmask 255.255.255.255"
os.system(cmd); os.system(cmd);
for i in settings["DomainNameServers"]: for i in settings["DomainNameServers"]:
print " Nameserver is %s" % (i) print(" Nameserver is %s" % (i))
cmd = "route add -host " + i cmd = "route add -host " + i
cmd +=" dev " + interface cmd +=" dev " + interface
os.system(cmd); os.system(cmd);
print print('')

View File

@ -6,11 +6,11 @@ import dbus
import dbus.mainloop.glib import dbus.mainloop.glib
def incoming_message(message, details, path, interface): def incoming_message(message, details, path, interface):
print "%s" % (message) print("%s" % (message))
for key in details: for key in details:
val = details[key] val = details[key]
print " %s = %s" % (key, val) print(" %s = %s" % (key, val))
if __name__ == '__main__': if __name__ == '__main__':
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)

View File

@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems() modems = manager.GetModems()
for path, properties in modems: for path, properties in modems:
print "[ %s ]" % (path) print("[ %s ]" % (path))
if "org.ofono.VoiceCallManager" not in properties["Interfaces"]: if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
continue continue
@ -22,7 +22,7 @@ for path, properties in modems:
for path, properties in calls: for path, properties in calls:
state = properties["State"] state = properties["State"]
print "[ %s ] %s" % (path, state) print("[ %s ] %s" % (path, state))
if state != "incoming": if state != "incoming":
continue continue

View File

@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems() modems = manager.GetModems()
for path, properties in modems: for path, properties in modems:
print "[ %s ]" % (path) print("[ %s ]" % (path))
if "org.ofono.VoiceCallManager" not in properties["Interfaces"]: if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
continue continue

View File

@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems() modems = manager.GetModems()
for path, properties in modems: for path, properties in modems:
print "[ %s ]" % (path) print("[ %s ]" % (path))
if "org.ofono.VoiceCallManager" not in properties["Interfaces"]: if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
continue continue

View File

@ -20,4 +20,4 @@ for path, properties in modems:
for path, properties in contexts: for path, properties in contexts:
connman.RemoveContext(path) connman.RemoveContext(path)
print"Removed: [ %s ]" % (path) print("Removed: [ %s ]" % (path))

View File

@ -14,9 +14,9 @@ elif len(sys.argv) == 4:
path = modems[0][0] path = modems[0][0]
puk_type, puk, pin = sys.argv[1:] puk_type, puk, pin = sys.argv[1:]
else: else:
print "%s [PATH] puk_type puk pin" % (sys.argv[0]) print("%s [PATH] puk_type puk pin" % (sys.argv[0]))
print "Reset pin for modem %s..." % path print("Reset pin for modem %s..." % path)
simmanager = dbus.Interface(bus.get_object('org.ofono', path), simmanager = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.SimManager') 'org.ofono.SimManager')

View File

@ -13,7 +13,7 @@ else:
modems = manager.GetModems() modems = manager.GetModems()
path = modems[0][0] path = modems[0][0]
print "Scanning operators on modem %s..." % path print("Scanning operators on modem %s..." % path)
netreg = dbus.Interface(bus.get_object('org.ofono', path), netreg = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.NetworkRegistration') 'org.ofono.NetworkRegistration')
@ -23,7 +23,7 @@ for entry in operators:
path = entry[0] path = entry[0]
properties = entry[1] properties = entry[1]
print "[ %s ]" % (path) print("[ %s ]" % (path))
for key in properties.keys(): for key in properties.keys():
if key in ["Technologies"]: if key in ["Technologies"]:
@ -32,7 +32,7 @@ for entry in operators:
val += i + " " val += i + " "
else: else:
val = str(properties[key]) val = str(properties[key])
print " %s = %s" % (key, val) print(" %s = %s" % (key, val))
print print('')

View File

@ -4,8 +4,8 @@ import sys
import dbus import dbus
if len(sys.argv) < 4: if len(sys.argv) < 4:
print "Usage: %s [modem] <to> <message> <delivery report>" %\ print("Usage: %s [modem] <to> <message> <delivery report>" %\
(sys.argv[0]) (sys.argv[0]))
sys.exit(1) sys.exit(1)
bus = dbus.SystemBus() bus = dbus.SystemBus()
@ -18,7 +18,7 @@ else:
modems = manager.GetModems() modems = manager.GetModems()
path = modems[0][0] path = modems[0][0]
print "Send message using modem %s ..." % path print("Send message using modem %s ..." % path)
mm = dbus.Interface(bus.get_object('org.ofono', path), mm = dbus.Interface(bus.get_object('org.ofono', path),
@ -31,4 +31,4 @@ else:
mm.SetProperty("UseDeliveryReports", dbus.Boolean(int(sys.argv[3]))) mm.SetProperty("UseDeliveryReports", dbus.Boolean(int(sys.argv[3])))
path = mm.SendMessage(sys.argv[1], sys.argv[2]) path = mm.SendMessage(sys.argv[1], sys.argv[2])
print path print(path)

View File

@ -4,7 +4,7 @@ import sys
import dbus import dbus
if (len(sys.argv) < 2): if (len(sys.argv) < 2):
print "Usage: %s [modem] <ussd-string>" % (sys.argv[0]) print("Usage: %s [modem] <ussd-string>" % (sys.argv[0]))
sys.exit(1) sys.exit(1)
bus = dbus.SystemBus() bus = dbus.SystemBus()
@ -27,13 +27,13 @@ ussd = dbus.Interface(bus.get_object('org.ofono', path),
properties = ussd.GetProperties() properties = ussd.GetProperties()
state = properties["State"] state = properties["State"]
print "State: %s" % (state) print("State: %s" % (state))
if state == "idle": if state == "idle":
result = ussd.Initiate(ussdstring, timeout=100) result = ussd.Initiate(ussdstring, timeout=100)
print result[0] + ": " + result[1] print(result[0] + ": " + result[1])
elif state == "user-response": elif state == "user-response":
print ussd.Respond(ussdstring, timeout=100) print(ussd.Respond(ussdstring, timeout=100))
else: else:
sys.exit(1); sys.exit(1);
@ -43,15 +43,15 @@ state = properties["State"]
if state == "idle": if state == "idle":
sys.exit(0) sys.exit(0)
print "State: %s" % (state) print("State: %s" % (state))
while state == "user-response": while state == "user-response":
response = raw_input("Enter response: ") response = raw_input("Enter response: ")
print ussd.Respond(response, timeout=100) print(ussd.Respond(response, timeout=100))
properties = ussd.GetProperties() properties = ussd.GetProperties()
state = properties["State"] state = properties["State"]
if state != "idle": if state != "idle":
print "State: %s" % (state) print("State: %s" % (state))

View File

@ -4,7 +4,7 @@ import sys
import dbus import dbus
if len(sys.argv) < 3: if len(sys.argv) < 3:
print "Usage: %s [modem] <to> <vcal file>" % (sys.argv[0]) print("Usage: %s [modem] <to> <vcal file>" % (sys.argv[0]))
sys.exit(1) sys.exit(1)
bus = dbus.SystemBus() bus = dbus.SystemBus()
@ -17,7 +17,7 @@ else:
modems = manager.GetModems() modems = manager.GetModems()
path = modems[0][0] path = modems[0][0]
print "Send vcal using modem %s ..." % path print("Send vcal using modem %s ..." % path)
sm = dbus.Interface(bus.get_object('org.ofono', path), sm = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.SmartMessaging') 'org.ofono.SmartMessaging')
@ -29,4 +29,4 @@ else:
vcal = file(sys.argv[2]).read() vcal = file(sys.argv[2]).read()
path = sm.SendAppointment(sys.argv[1], vcal) path = sm.SendAppointment(sys.argv[1], vcal)
print path print(path)

View File

@ -4,7 +4,7 @@ import sys
import dbus import dbus
if len(sys.argv) < 3: if len(sys.argv) < 3:
print "Usage: %s [modem] <to> <vcard file>" % (sys.argv[0]) print("Usage: %s [modem] <to> <vcard file>" % (sys.argv[0]))
sys.exit(1) sys.exit(1)
bus = dbus.SystemBus() bus = dbus.SystemBus()
@ -17,7 +17,7 @@ else:
modems = manager.GetModems() modems = manager.GetModems()
path = modems[0][0] path = modems[0][0]
print "Send vcard using modem %s ..." % path print("Send vcard using modem %s ..." % path)
sm = dbus.Interface(bus.get_object('org.ofono', path), sm = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.SmartMessaging') 'org.ofono.SmartMessaging')
@ -29,4 +29,4 @@ else:
vcard = file(sys.argv[2]).read() vcard = file(sys.argv[2]).read()
path = sm.SendBusinessCard(sys.argv[1], vcard) path = sm.SendBusinessCard(sys.argv[1], vcard)
print path print(path)

View File

@ -8,19 +8,19 @@ import dbus.mainloop.glib
def property_changed(property, value): def property_changed(property, value):
if len(value.__str__()) > 0: if len(value.__str__()) > 0:
print "CF property %s changed to %s" % (property, value) print("CF property %s changed to %s" % (property, value))
else: else:
print "CF property %s changed to disabled" % (property) print("CF property %s changed to disabled" % (property))
if canexit: if canexit:
mainloop.quit(); mainloop.quit();
if __name__ == "__main__": if __name__ == "__main__":
if len(sys.argv) < 3: if len(sys.argv) < 3:
print "Usage: %s <property> <value>" % (sys.argv[0]) print("Usage: %s <property> <value>" % (sys.argv[0]))
print "Properties can be: VoiceUnconditional, VoiceBusy," print("Properties can be: VoiceUnconditional, VoiceBusy,")
print " VoiceNoReply, VoiceNoReplyTimeout, VoiceNotReachable" print(" VoiceNoReply, VoiceNoReplyTimeout, VoiceNotReachable")
print "Value: number to or the timeout" print("Value: number to or the timeout")
sys.exit(1) sys.exit(1)
property = sys.argv[1] property = sys.argv[1]
@ -47,16 +47,16 @@ if __name__ == "__main__":
cf.SetProperty(property, dbus.UInt16(value), cf.SetProperty(property, dbus.UInt16(value),
timeout = 100) timeout = 100)
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable SetProperty", e print("Unable SetProperty %s" % e)
sys.exit(1); sys.exit(1);
else: else:
try: try:
cf.SetProperty(property, value, timeout = 100) cf.SetProperty(property, value, timeout = 100)
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable SetProperty", e print("Unable SetProperty %s" % e)
sys.exit(1); sys.exit(1);
print "Set Property successful" print("Set Property successful")
canexit = True canexit = True

View File

@ -15,9 +15,9 @@ elif len(sys.argv) == 2:
path = modems[0][0] path = modems[0][0]
topics = sys.argv[1] topics = sys.argv[1]
else: else:
print "%s [PATH] topics" % (sys.argv[0]) print("%s [PATH] topics" % (sys.argv[0]))
print "Setting cell broadcast topics for modem %s..." % path print("Setting cell broadcast topics for modem %s..." % path)
cbs = dbus.Interface(bus.get_object('org.ofono', path), cbs = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.CellBroadcast') 'org.ofono.CellBroadcast')

View File

@ -4,7 +4,7 @@ import sys
import dbus import dbus
if len(sys.argv) < 4: if len(sys.argv) < 4:
print "Usage: set-context-property <context> <name> <value>" print("Usage: set-context-property <context> <name> <value>")
sys.exit(1) sys.exit(1)
bus = dbus.SystemBus() bus = dbus.SystemBus()
@ -24,7 +24,7 @@ for path, properties in modems:
contexts = connman.GetContexts() contexts = connman.GetContexts()
if (len(contexts) == 0): if (len(contexts) == 0):
print "No context available" print("No context available")
sys.exit(1) sys.exit(1)
path = contexts[int(sys.argv[1])][0] path = contexts[int(sys.argv[1])][0]
@ -34,6 +34,6 @@ for path, properties in modems:
try: try:
context.SetProperty(sys.argv[2], sys.argv[3]) context.SetProperty(sys.argv[2], sys.argv[3])
except dbus.DBusException, e: except dbus.DBusException, e:
print "Error setting context %s property %s: %s" %\ print("Error setting context %s property %s: %s" %\
(path, sys.argv[2], str(e)) (path, sys.argv[2], str(e)))
exit(2) exit(2)

View File

@ -15,10 +15,10 @@ elif len(sys.argv) == 2:
path = modems[0][0] path = modems[0][0]
enable = int(sys.argv[1]) enable = int(sys.argv[1])
else: else:
print "%s [PATH] {0|1}" % (sys.argv[0]) print("%s [PATH] {0|1}" % (sys.argv[0]))
exit(1) exit(1)
print "Setting fast dormancy for modem %s..." % path print("Setting fast dormancy for modem %s..." % path)
radiosettings = dbus.Interface(bus.get_object('org.ofono', path), radiosettings = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.RadioSettings') 'org.ofono.RadioSettings')

View File

@ -15,10 +15,10 @@ elif len(sys.argv) == 2:
path = modems[0][0] path = modems[0][0]
band = sys.argv[1] band = sys.argv[1]
else: else:
print "%s [PATH] band" % (sys.argv[0]) print("%s [PATH] band" % (sys.argv[0]))
exit(1) exit(1)
print "Setting gsm band for modem %s..." % path print("Setting gsm band for modem %s..." % path)
radiosettings = dbus.Interface(bus.get_object('org.ofono', path), radiosettings = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.RadioSettings') 'org.ofono.RadioSettings')

View File

@ -26,18 +26,18 @@ for path, properties in modems:
break break
if path == "": if path == "":
print "No MMS context" print("No MMS context")
exit(1) exit(1)
context = dbus.Interface(bus.get_object('org.ofono', path), context = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.ConnectionContext') 'org.ofono.ConnectionContext')
if len(sys.argv) < 3: if len(sys.argv) < 3:
print "Usage: %s <proxy> <center>" % (sys.argv[0]) print("Usage: %s <proxy> <center>" % (sys.argv[0]))
exit(1) exit(1)
context.SetProperty("MessageProxy", sys.argv[1]) context.SetProperty("MessageProxy", sys.argv[1])
print "Setting MMS Proxy to %s" % (sys.argv[1]) print("Setting MMS Proxy to %s" % (sys.argv[1]))
context.SetProperty("MessageCenter", sys.argv[2]) context.SetProperty("MessageCenter", sys.argv[2])
print "Setting MMSC to %s" % (sys.argv[2]) print("Setting MMSC to %s" % (sys.argv[2]))

View File

@ -15,10 +15,10 @@ elif len(sys.argv) == 2:
path = modems[0][0] path = modems[0][0]
number = sys.argv[1] number = sys.argv[1]
else: else:
print "%s [PATH] <number>" % (sys.argv[0]) print("%s [PATH] <number>" % (sys.argv[0]))
exit(1) exit(1)
print "Setting MSISDN for modem %s..." % path print("Setting MSISDN for modem %s..." % path)
sim = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.SimManager') sim = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.SimManager')
sim.SetProperty("SubscriberNumbers", [number]); sim.SetProperty("SubscriberNumbers", [number]);

View File

@ -24,4 +24,4 @@ for path, properties in modems:
connman.SetProperty("RoamingAllowed", allowed) connman.SetProperty("RoamingAllowed", allowed)
print "Setting %s to RoamingAllowed=%d" % (path, allowed) print("Setting %s to RoamingAllowed=%d" % (path, allowed))

View File

@ -15,9 +15,9 @@ elif len(sys.argv) == 2:
path = modems[0][0] path = modems[0][0]
tech = sys.argv[1] tech = sys.argv[1]
else: else:
print "%s [PATH] technology" % (sys.argv[0]) print("%s [PATH] technology" % (sys.argv[0]))
print "Setting technology preference for modem %s..." % path print("Setting technology preference for modem %s..." % path)
radiosettings = dbus.Interface(bus.get_object('org.ofono', path), radiosettings = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.RadioSettings') 'org.ofono.RadioSettings')

View File

@ -15,10 +15,10 @@ elif len(sys.argv) == 2:
path = modems[0][0] path = modems[0][0]
enable = int(sys.argv[1]) enable = int(sys.argv[1])
else: else:
print "%s [PATH] {0|1}" % (sys.argv[0]) print("%s [PATH] {0|1}" % (sys.argv[0]))
exit(1) exit(1)
print "Setting TTY for modem %s..." % path print("Setting TTY for modem %s..." % path)
texttelephony = dbus.Interface(bus.get_object('org.ofono', path), texttelephony = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.TextTelephony') 'org.ofono.TextTelephony')

View File

@ -15,10 +15,10 @@ elif len(sys.argv) == 2:
path = modems[0][0] path = modems[0][0]
band = sys.argv[1] band = sys.argv[1]
else: else:
print "%s [PATH] band" % (sys.argv[0]) print("%s [PATH] band" % (sys.argv[0]))
exit(1) exit(1)
print "Setting umts band for modem %s..." % path print("Setting umts band for modem %s..." % path)
radiosettings = dbus.Interface(bus.get_object('org.ofono', path), radiosettings = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.RadioSettings') 'org.ofono.RadioSettings')

View File

@ -19,10 +19,10 @@ elif len(sys.argv) == 2:
if sys.argv[1] == "off": if sys.argv[1] == "off":
enabled = 0 enabled = 0
else: else:
print "%s [PATH] on/off" % (sys.argv[0]) print("%s [PATH] on/off" % (sys.argv[0]))
sys.exit(1) sys.exit(1)
print "Setting delivery report use for modem %s..." % path print("Setting delivery report use for modem %s..." % path)
sms = dbus.Interface(bus.get_object('org.ofono', path), sms = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.MessageManager') 'org.ofono.MessageManager')

View File

@ -7,16 +7,16 @@ import dbus.mainloop.glib
def cm_property_changed(name, value): def cm_property_changed(name, value):
print "CallMeter property: '%s' changed to '%s'" % (name, str(value)) print("CallMeter property: '%s' changed to '%s'" % (name, str(value)))
if canexit: if canexit:
mainloop.quit() mainloop.quit()
def cm_maximum_reached(): def cm_maximum_reached():
print "Only 30 seconds call time remains, recharge." print("Only 30 seconds call time remains, recharge.")
def print_useage(s): def print_useage(s):
print "Usage: %s <property> <newvalue> <password>" % (s) print("Usage: %s <property> <newvalue> <password>" % (s))
print "Usage: %s reset <password>" % (s) print("Usage: %s reset <password>" % (s))
sys.exit(1); sys.exit(1);
if __name__ == "__main__": if __name__ == "__main__":
@ -51,24 +51,24 @@ if __name__ == "__main__":
properties = cm.GetProperties() properties = cm.GetProperties()
print "Currency: %s" % (properties['Currency']) print("Currency: %s" % (properties['Currency']))
print "PricePerUnit %s" % (properties['PricePerUnit']) print("PricePerUnit %s" % (properties['PricePerUnit']))
print "Call meter for the current call: %s" % (properties['CallMeter']) print("Call meter for the current call: %s" % (properties['CallMeter']))
print "Call meter for current and previous calls: %s" %\ print("Call meter for current and previous calls: %s" %\
properties['AccumulatedCallMeter'] properties['AccumulatedCallMeter'])
print "Call meter maximum, once reached calls are not possible: %s" %\ print("Call meter maximum, once reached calls are not possible: %s" %\
properties['AccumulatedCallMeterMaximum'] properties['AccumulatedCallMeterMaximum'])
total = properties['PricePerUnit'] * properties['AccumulatedCallMeter'] total = properties['PricePerUnit'] * properties['AccumulatedCallMeter']
print "Accumulated Meter in Currency: %s %s" %\ print("Accumulated Meter in Currency: %s %s" %\
(total, properties['Currency']) (total, properties['Currency']))
if (sys.argv[1] == 'reset'): if (sys.argv[1] == 'reset'):
print "Resetting Accumulated Call Meter" print("Resetting Accumulated Call Meter")
try: try:
cm.Reset(pin) cm.Reset(pin)
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to reset ACM: ", e print("Unable to reset ACM: %s" % e)
sys.exit(1) sys.exit(1)
else: else:
try: try:
@ -78,7 +78,7 @@ if __name__ == "__main__":
newvalue = float(newvalue) newvalue = float(newvalue)
cm.SetProperty(property, newvalue, pin) cm.SetProperty(property, newvalue, pin)
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to set property: ", e print("Unable to set property: %s" % e)
sys.exit(1) sys.exit(1)
canexit = True canexit = True

View File

@ -7,14 +7,14 @@ import dbus.mainloop.glib
def property_changed(name, value): def property_changed(name, value):
print "CallBarring property: '%s' changed to '%s'" % (name, str(value)) print("CallBarring property: '%s' changed to '%s'" % (name, str(value)))
if canexit: if canexit:
mainloop.quit() mainloop.quit()
def print_useage(s): def print_useage(s):
print "Usage: %s <property> <newvalue> <password>" % (s) print("Usage: %s <property> <newvalue> <password>" % (s))
print "Usage: %s disableall <password>" % (s) print("Usage: %s disableall <password>" % (s))
print "Usage: %s passwd <old_password> <new_password>" % (s) print("Usage: %s passwd <old_password> <new_password>" % (s))
sys.exit(1); sys.exit(1);
if __name__ == "__main__": if __name__ == "__main__":
@ -51,31 +51,31 @@ if __name__ == "__main__":
properties = cb.GetProperties() properties = cb.GetProperties()
print "Barring settings for Incoming Voice calls: %s" %\ print("Barring settings for Incoming Voice calls: %s" %\
(properties['VoiceIncoming']) (properties['VoiceIncoming']))
print "Barring settings for Outgoing Calls: %s" %\ print("Barring settings for Outgoing Calls: %s" %\
(properties['VoiceOutgoing']) (properties['VoiceOutgoing']))
if (sys.argv[1] == 'disableall'): if (sys.argv[1] == 'disableall'):
print "Disabling all barrings" print("Disabling all barrings")
try: try:
cb.DisableAll(pin) cb.DisableAll(pin)
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to Disable All barrings: ", e print("Unable to Disable All barrings: ", e)
sys.exit(1) sys.exit(1)
elif (sys.argv[1] == 'passwd'): elif (sys.argv[1] == 'passwd'):
try: try:
cb.ChangePassword(old_password, new_password) cb.ChangePassword(old_password, new_password)
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to change password: ", e print("Unable to change password: ", e)
sys.exit(1) sys.exit(1)
print "Password changed" print("Password changed")
sys.exit(0) sys.exit(0)
else: else:
try: try:
cb.SetProperty(property, newvalue, pin) cb.SetProperty(property, newvalue, pin)
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to set property: ", e print("Unable to set property: ", e)
sys.exit(1) sys.exit(1)
canexit = True canexit = True

View File

@ -6,16 +6,16 @@ import dbus
import dbus.mainloop.glib import dbus.mainloop.glib
def property_changed(property, value): def property_changed(property, value):
print "CallForwarding property %s changed to %s" % (property, value) print("CallForwarding property %s changed to %s" % (property, value))
def print_properties(cf): def print_properties(cf):
properties = cf.GetProperties() properties = cf.GetProperties()
for p in properties: for p in properties:
if len(properties[p].__str__()) > 0: if len(properties[p].__str__()) > 0:
print "%s call forwarding rule is: %s" % (p, properties[p]) print("%s call forwarding rule is: %s" % (p, properties[p]))
else: else:
print "%s call forwarding rule disabled" % (p) print("%s call forwarding rule disabled" % (p))
if __name__ == "__main__": if __name__ == "__main__":
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
@ -37,83 +37,83 @@ if __name__ == "__main__":
try: try:
cf.SetProperty("FoobarNoReplyTimeout", dbus.UInt16(19)) cf.SetProperty("FoobarNoReplyTimeout", dbus.UInt16(19))
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to set timeout - Good" print("Unable to set timeout - Good")
try: try:
cf.SetProperty("VoiceNotReachableTimeout", dbus.UInt16(19)) cf.SetProperty("VoiceNotReachableTimeout", dbus.UInt16(19))
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to set timeout - Good" print("Unable to set timeout - Good")
try: try:
cf.SetProperty("VoiceNoReplyTimeout", dbus.UInt16(19)) cf.SetProperty("VoiceNoReplyTimeout", dbus.UInt16(19))
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to set timeout - Good" print("Unable to set timeout - Good")
try: try:
cf.SetProperty("DataNoReplyTimeout", dbus.UInt16(19)) cf.SetProperty("DataNoReplyTimeout", dbus.UInt16(19))
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to set timeout - Good" print("Unable to set timeout - Good")
try: try:
cf.SetProperty("FaxNoReplyTimeout", dbus.UInt16(19)) cf.SetProperty("FaxNoReplyTimeout", dbus.UInt16(19))
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to set timeout - Good" print("Unable to set timeout - Good")
try: try:
cf.SetProperty("SmsNoReplyTimeout", dbus.UInt16(19)) cf.SetProperty("SmsNoReplyTimeout", dbus.UInt16(19))
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to set timeout - Good" print("Unable to set timeout - Good")
try: try:
cf.SetProperty("VoiceNoReply", "") cf.SetProperty("VoiceNoReply", "")
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to erase voice no reply rule - Bad" print("Unable to erase voice no reply rule - Bad")
try: try:
cf.SetProperty("VoiceNoReply", "+134444") cf.SetProperty("VoiceNoReply", "+134444")
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to register voice no reply rule - Bad" print("Unable to register voice no reply rule - Bad")
try: try:
cf.SetProperty("VoiceNoReplyTimeout", dbus.UInt16(30)) cf.SetProperty("VoiceNoReplyTimeout", dbus.UInt16(30))
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to set voice no reply timeout - Bad" print("Unable to set voice no reply timeout - Bad")
properties = cf.GetProperties() properties = cf.GetProperties()
print properties["VoiceNoReply"] print(properties["VoiceNoReply"])
print properties["VoiceNoReplyTimeout"] print(properties["VoiceNoReplyTimeout"])
try: try:
cf.SetProperty("VoiceUnconditional", "+155555") cf.SetProperty("VoiceUnconditional", "+155555")
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to set Voice Unconditional - Bad" print("Unable to set Voice Unconditional - Bad")
properties = cf.GetProperties() properties = cf.GetProperties()
print properties["VoiceUnconditional"] print(properties["VoiceUnconditional"])
try: try:
cf.DisableAll("foobar") cf.DisableAll("foobar")
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to delete invalids - Good" print("Unable to delete invalids - Good")
try: try:
cf.DisableAll("conditional") cf.DisableAll("conditional")
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to delete all conditional - Bad" print("Unable to delete all conditional - Bad")
properties = cf.GetProperties() properties = cf.GetProperties()
print properties["VoiceNoReply"] print(properties["VoiceNoReply"])
print properties["VoiceNoReplyTimeout"] print(properties["VoiceNoReplyTimeout"])
try: try:
cf.DisableAll("all") cf.DisableAll("all")
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to delete all conditional - Bad" print("Unable to delete all conditional - Bad")
print properties["VoiceUnconditional"] print(properties["VoiceUnconditional"])
mainloop = gobject.MainLoop() mainloop = gobject.MainLoop()
mainloop.run() mainloop.run()

View File

@ -7,18 +7,18 @@ import dbus.mainloop.glib
import sys import sys
def property_changed(name, value): def property_changed(name, value):
print "CallSettings property: '%s' changed to '%s'" % (name, value) print("CallSettings property: '%s' changed to '%s'" % (name, value))
if canexit: if canexit:
mainloop.quit(); mainloop.quit();
if __name__ == "__main__": if __name__ == "__main__":
if len(sys.argv) < 3: if len(sys.argv) < 3:
print "Usage: %s [modem] <property> <newvalue>" % (sys.argv[0]) print("Usage: %s [modem] <property> <newvalue>" % (sys.argv[0]))
print "Properties can be: VoiceCallWaiting," print("Properties can be: VoiceCallWaiting,")
print " ConnectedLineRestriction, CallingLineRestriction," print(" ConnectedLineRestriction, CallingLineRestriction,")
print " CallingLinePresentation, CalledLinePresentation," print(" CallingLinePresentation, CalledLinePresentation,")
print " ConnectedLinePresentation, HideCallerId" print(" ConnectedLinePresentation, HideCallerId")
sys.exit(1) sys.exit(1)
canexit = False canexit = False
@ -41,7 +41,7 @@ if __name__ == "__main__":
property = sys.argv[1] property = sys.argv[1]
newvalue = sys.argv[2] newvalue = sys.argv[2]
print "Using modem %s" % modem print("Using modem %s" % modem)
cs = dbus.Interface(bus.get_object('org.ofono', modem), cs = dbus.Interface(bus.get_object('org.ofono', modem),
'org.ofono.CallSettings') 'org.ofono.CallSettings')
@ -50,31 +50,31 @@ if __name__ == "__main__":
properties = cs.GetProperties() properties = cs.GetProperties()
print "Current Property values:" print("Current Property values:")
print "Network Status of Call Waiting - Voice: %s" %\ print("Network Status of Call Waiting - Voice: %s" %\
(properties['VoiceCallWaiting']) (properties['VoiceCallWaiting']))
print "Network Status of Connected Line Restriction: %s" %\ print("Network Status of Connected Line Restriction: %s" %\
(properties['ConnectedLineRestriction']) (properties['ConnectedLineRestriction']))
print "Network Status of Calling Line Restriction: %s" %\ print("Network Status of Calling Line Restriction: %s" %\
(properties['CallingLineRestriction']) (properties['CallingLineRestriction']))
print "Network Status of Calling Line Presentation: %s" %\ print("Network Status of Calling Line Presentation: %s" %\
(properties['CallingLinePresentation']) (properties['CallingLinePresentation']))
print "Network Status of Called Line Presentation: %s" %\ print("Network Status of Called Line Presentation: %s" %\
(properties['CalledLinePresentation']) (properties['CalledLinePresentation']))
print "Network Status of Connected Line Presentation: %s" %\ print("Network Status of Connected Line Presentation: %s" %\
(properties['ConnectedLinePresentation']) (properties['ConnectedLinePresentation']))
print "Hide my Caller Id: %s" % (properties['HideCallerId']) print("Hide my Caller Id: %s" % (properties['HideCallerId']))
try: try:
cs.SetProperty(property, newvalue) cs.SetProperty(property, newvalue)
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to set property: ", e print("Unable to set property: %s" % e)
sys.exit(1); sys.exit(1);
print "Setting successful" print("Setting successful")
if (properties[property] == newvalue): if (properties[property] == newvalue):
print "Setting was already set to this value" print("Setting was already set to this value")
sys.exit(1); sys.exit(1);
canexit = True canexit = True

View File

@ -7,69 +7,69 @@ import gobject
import os import os
def print_menu(): def print_menu():
print "Select test case" print("Select test case")
print "----------------------------------------------------------------" print("----------------------------------------------------------------")
print "[0] Activate cbs" print("[0] Activate cbs")
print "[1] Deactivate cbs" print("[1] Deactivate cbs")
print "[2] Get cbs properties" print("[2] Get cbs properties")
print "[3] Set/Register topics" print("[3] Set/Register topics")
print " If several - give topics separated with comma. \ print(" If several - give topics separated with comma. \
\n E.g. 20,50-51,60" \n E.g. 20,50-51,60")
print "[4] Clear/Unregister topics" print("[4] Clear/Unregister topics")
print "[5] NetReg Base Station - Get current serving cell" print("[5] NetReg Base Station - Get current serving cell")
print "[x] Exit" print("[x] Exit")
print "----------------------------------------------------------------" print("----------------------------------------------------------------")
def property_changed(property, value): def property_changed(property, value):
if value == "" and property == "Topics": if value == "" and property == "Topics":
print "User selected Topics have been cleared. \ print("User selected Topics have been cleared. \
\nRegistered for emergency topics only." \nRegistered for emergency topics only.")
else: else:
print "Cell Broadcast property %s is changed to %s" % (property, value) print("Cell Broadcast property %s is changed to %s" % (property, value))
print "\nPress ENTER to continue" print("\nPress ENTER to continue")
def incoming_broadcast(text, topic): def incoming_broadcast(text, topic):
print "Broadcast msg: %s \n Topic channel: %s" % (text, topic) print("Broadcast msg: %s \n Topic channel: %s" % (text, topic))
print "\nPress ENTER to continue" print("\nPress ENTER to continue")
def emergency_broadcast(text, properties): def emergency_broadcast(text, properties):
emergType = properties["EmergencyType"] emergType = properties["EmergencyType"]
emergAlert = properties["EmergencyAlert"] emergAlert = properties["EmergencyAlert"]
print "Broadcast msg: %s \n\t Type: %s \n\t Alert: %s \n\t Popup: %s" \ print("Broadcast msg: %s \n\t Type: %s \n\t Alert: %s \n\t Popup: %s" \
% (text, emergType, emergAlert, popup) % (text, emergType, emergAlert, popup))
if properties["Popup"] == True: if properties["Popup"] == True:
print "Popup required." print("Popup required.")
print "\nPress ENTER to continue" print("\nPress ENTER to continue")
def set_cbs_state(cbs, state): def set_cbs_state(cbs, state):
if state == True: if state == True:
print "Activating cell broadcast..." print("Activating cell broadcast...")
cbs.SetProperty("Powered", dbus.Boolean(1)) cbs.SetProperty("Powered", dbus.Boolean(1))
else: else:
print "Deactivating cell broadcast..." print("Deactivating cell broadcast...")
cbs.SetProperty("Powered", dbus.Boolean(0)) cbs.SetProperty("Powered", dbus.Boolean(0))
print "-----------------------------------------------------------" print("-----------------------------------------------------------")
def print_cbs_properties(cbs): def print_cbs_properties(cbs):
properties = cbs.GetProperties() properties = cbs.GetProperties()
print "---------------------PROPERTIES----------------------------" print("---------------------PROPERTIES----------------------------")
for p in properties: for p in properties:
if len(properties[p].__str__()) > 0: if len(properties[p].__str__()) > 0:
if p == "Powered": if p == "Powered":
if properties[p] == True: if properties[p] == True:
print "Cell Broadcast is Activated." print("Cell Broadcast is Activated.")
else: else:
print "Cell Broadcast is Deactivated." print("Cell Broadcast is Deactivated.")
elif p == "Topics": elif p == "Topics":
print "Currently set CBS %s are: %s" \ print("Currently set CBS %s are: %s" \
% (p, properties[p]) % (p, properties[p]))
topics_available = True topics_available = True
else: else:
print "Cell Broadcast %s value empty" % (p) print("Cell Broadcast %s value empty" % (p))
print "-----------------------------------------------------------" print("-----------------------------------------------------------")
def set_topics(cbs): def set_topics(cbs):
print_cbs_properties(cbs) print_cbs_properties(cbs)
@ -86,27 +86,27 @@ def set_topics(cbs):
elif topics[index] >= '0' and topics[index] <= '9': elif topics[index] >= '0' and topics[index] <= '9':
topicTemp = topicTemp + topics[index] topicTemp = topicTemp + topics[index]
else: else:
print "Invalid char. \"%s\" entered. Topic not set." \ print("Invalid char. \"%s\" entered. Topic not set." \
% (topics[index]) % (topics[index]))
invalidData = True invalidData = True
break break
if topicTemp: if topicTemp:
if int(topicTemp) > 999: if int(topicTemp) > 999:
invalidData = True invalidData = True
print "Invalid Topic ID %s (range 0-999). \ print("Invalid Topic ID %s (range 0-999). \
\nCould not register." % topicTemp \nCould not register." % topicTemp)
index = index + 1 index = index + 1
if invalidData == False: if invalidData == False:
try: try:
print "Setting Cell Broadcast topics..." print("Setting Cell Broadcast topics...")
cbs.SetProperty("Topics", topics); cbs.SetProperty("Topics", topics);
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to set topic: ", e print("Unable to set topic: %s" % e)
print "-----------------------------------------------------------" print("-----------------------------------------------------------")
def get_serving_cell_name(netReg): def get_serving_cell_name(netReg):
wasFound = False; wasFound = False;
@ -115,17 +115,17 @@ def get_serving_cell_name(netReg):
for p in properties: for p in properties:
if p == "BaseStation": if p == "BaseStation":
if len(properties[p].__str__()) > 0: if len(properties[p].__str__()) > 0:
print "Current serving cell name: %s" \ print("Current serving cell name: %s" \
% (properties["BaseStation"]) % (properties["BaseStation"]))
wasFound = True; wasFound = True;
else: else:
print "Current Serving cell name empty. \ print("Current Serving cell name empty. \
Base Station CBS not available." Base Station CBS not available.")
if wasFound == False: if wasFound == False:
print "Base Station parameter not found. \ print("Base Station parameter not found. \
\nBase Station CBS not available." \nBase Station CBS not available.")
print "-----------------------------------------------------------" print("-----------------------------------------------------------")
def stdin_handler(fd, condition, cbs, netReg): def stdin_handler(fd, condition, cbs, netReg):
in_key = os.read(fd.fileno(), 160).rstrip() in_key = os.read(fd.fileno(), 160).rstrip()
@ -151,7 +151,7 @@ def stdin_handler(fd, condition, cbs, netReg):
elif in_key == 'x': elif in_key == 'x':
sys.exit(1) sys.exit(1)
print '\n' * 2 print('\n' * 2)
print_menu() print_menu()
return True return True
@ -177,7 +177,7 @@ if __name__ == "__main__":
cbs.connect_to_signal("IncomingBroadcast", incoming_broadcast) cbs.connect_to_signal("IncomingBroadcast", incoming_broadcast)
cbs.connect_to_signal("EmergencyBroadcast", emergency_broadcast) cbs.connect_to_signal("EmergencyBroadcast", emergency_broadcast)
print '\n' * 2 print('\n' * 2)
print_menu() print_menu()

View File

@ -15,27 +15,27 @@ class PositioningAgent(dbus.service.Object):
@dbus.service.method(AGENT_INTERFACE, @dbus.service.method(AGENT_INTERFACE,
in_signature="", out_signature="") in_signature="", out_signature="")
def Release(self): def Release(self):
print "Release" print("Release")
mainloop.quit() mainloop.quit()
@dbus.service.method(AGENT_INTERFACE, @dbus.service.method(AGENT_INTERFACE,
in_signature="s", out_signature="") in_signature="s", out_signature="")
def Request(self, xml): def Request(self, xml):
print "positioning data: %s" % (xml) print("positioning data: %s" % (xml))
@dbus.service.method(AGENT_INTERFACE, @dbus.service.method(AGENT_INTERFACE,
in_signature="", out_signature="") in_signature="", out_signature="")
def ResetAssistanceData(self): def ResetAssistanceData(self):
print "Reset Assistance Data request received" print("Reset Assistance Data request received")
def print_menu(): def print_menu():
print "Select test case" print("Select test case")
print "-----------------------------------------------------------" print("-----------------------------------------------------------")
print "[0] SendPositioningElement" print("[0] SendPositioningElement")
print "[1] RegisterPositioningRequestAgent" print("[1] RegisterPositioningRequestAgent")
print "[2] UnregisterPositioningRequestAgent" print("[2] UnregisterPositioningRequestAgent")
print "[x] Exit" print("[x] Exit")
print "-----------------------------------------------------------" print("-----------------------------------------------------------")
def stdin_handler(fd, condition, gnss, path): def stdin_handler(fd, condition, gnss, path):
in_key = os.read(fd.fileno(), 8).rstrip() in_key = os.read(fd.fileno(), 8).rstrip()
@ -43,23 +43,23 @@ def stdin_handler(fd, condition, gnss, path):
xml = raw_input('type the element and press enter: ') xml = raw_input('type the element and press enter: ')
try: try:
gnss.SendPositioningElement(dbus.String(xml)) gnss.SendPositioningElement(dbus.String(xml))
print "ok" print("ok")
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to send positioning element" print("Unable to send positioning element")
elif in_key == '1': elif in_key == '1':
try: try:
gnss.RegisterPositioningRequestAgent("/test/posagent") gnss.RegisterPositioningRequestAgent("/test/posagent")
print "ok" print("ok")
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to register positioning agent" print("Unable to register positioning agent")
elif in_key == '2': elif in_key == '2':
try: try:
gnss.UnregisterPositioningRequestAgent(path) gnss.UnregisterPositioningRequestAgent(path)
print "ok" print("ok")
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to unregister positioning agent" print("Unable to unregister positioning agent")
elif in_key == 'x': elif in_key == 'x':
sys.exit(1) sys.exit(1)

View File

@ -7,11 +7,11 @@ import dbus.mainloop.glib
def mw_property_changed(name, value): def mw_property_changed(name, value):
if name == 'VoicemailMessageCount': if name == 'VoicemailMessageCount':
print "MessageWaiting property: '%s' changed to '%d'" %\ print("MessageWaiting property: '%s' changed to '%d'" %\
(name,value) (name,value))
else: else:
print "MessageWaiting property: '%s' changed to '%s'" %\ print("MessageWaiting property: '%s' changed to '%s'" %\
(name,value) (name,value))
if __name__ == "__main__": if __name__ == "__main__":
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
@ -30,11 +30,11 @@ if __name__ == "__main__":
properties = mw.GetProperties() properties = mw.GetProperties()
print "Voicemail waiting: %s" % (properties['VoicemailWaiting']) print("Voicemail waiting: %s" % (properties['VoicemailWaiting']))
print "Voicemail message count: %d" %\ print("Voicemail message count: %d" %\
(properties['VoicemailMessageCount']) (properties['VoicemailMessageCount']))
print "Voicemail mailbox number: %s" %\ print("Voicemail mailbox number: %s" %\
(properties['VoicemailMailboxNumber']) (properties['VoicemailMailboxNumber']))
mainloop = gobject.MainLoop() mainloop = gobject.MainLoop()
mainloop.run() mainloop.run()

View File

@ -6,7 +6,7 @@ import dbus
import dbus.mainloop.glib import dbus.mainloop.glib
def property_changed(name, value): def property_changed(name, value):
print "Modem property %s changed to %s" % (name, value) print("Modem property %s changed to %s" % (name, value))
if __name__ == "__main__": if __name__ == "__main__":
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
@ -25,41 +25,41 @@ if __name__ == "__main__":
properties = modem.GetProperties() properties = modem.GetProperties()
if properties.has_key('Name'): if properties.has_key('Name'):
print "Name: %s" % (properties['Name']) print("Name: %s" % (properties['Name']))
if properties.has_key('Manufacturer'): if properties.has_key('Manufacturer'):
print "Manufacturer: %s" % (properties['Manufacturer']) print("Manufacturer: %s" % (properties['Manufacturer']))
if properties.has_key('Model'): if properties.has_key('Model'):
print "Model: %s" % (properties['Model']) print("Model: %s" % (properties['Model']))
if properties.has_key('Revision'): if properties.has_key('Revision'):
print "Revision: %s" % (properties['Revision']) print("Revision: %s" % (properties['Revision']))
if properties.has_key('Serial'): if properties.has_key('Serial'):
print "Serial: %s" % (properties['Serial']) print("Serial: %s" % (properties['Serial']))
if properties.has_key('Powered'): if properties.has_key('Powered'):
print "Powered: %s" % (properties['Powered']) print("Powered: %s" % (properties['Powered']))
if properties.has_key('Online'): if properties.has_key('Online'):
print "Online: %s" % (properties['Online']) print("Online: %s" % (properties['Online']))
if properties.has_key('Lockdown'): if properties.has_key('Lockdown'):
print "Lockdown: %s" % (properties['Lockdown']) print("Lockdown: %s" % (properties['Lockdown']))
if properties.has_key('Emergency'): if properties.has_key('Emergency'):
print "Emergency: %s" % (properties['Emergency']) print("Emergency: %s" % (properties['Emergency']))
if properties.has_key('Features'): if properties.has_key('Features'):
print "Features:" print("Features:")
for feature in properties["Features"]: for feature in properties["Features"]:
print " [ %s ]" % (feature) print(" [ %s ]" % (feature))
if properties.has_key('Interfaces'): if properties.has_key('Interfaces'):
print "Interfaces:" print("Interfaces:")
for interface in properties["Interfaces"]: for interface in properties["Interfaces"]:
print " [ %s ]" % (interface) print(" [ %s ]" % (interface))
mainloop = gobject.MainLoop() mainloop = gobject.MainLoop()
mainloop.run() mainloop.run()

View File

@ -6,18 +6,18 @@ import dbus
import dbus.mainloop.glib import dbus.mainloop.glib
def network_property_changed(name, value): def network_property_changed(name, value):
print "Network Registration property '%s' changed to '%s'" %\ print("Network Registration property '%s' changed to '%s'" %\
(name, value) (name, value))
if name == 'Name' and canexit: if name == 'Name' and canexit:
mainloop.quit() mainloop.quit()
if __name__ == "__main__": if __name__ == "__main__":
if len(sys.argv) < 2: if len(sys.argv) < 2:
print "Usage: %s [modem] <path> - Register to PLMN on <path>" %\ print("Usage: %s [modem] <path> - Register to PLMN on <path>" %\
(sys.argv[0]) (sys.argv[0]))
print "Usage: %s [modem] default - Register to default PLMN" %\ print("Usage: %s [modem] default - Register to default PLMN" %\
(sys.argv[0]) (sys.argv[0]))
sys.exit(1) sys.exit(1)
canexit = False canexit = False
@ -44,15 +44,15 @@ if __name__ == "__main__":
props = netreg.GetProperties() props = netreg.GetProperties()
print "Status is: '%s', Operator Name is: '%s'" %\ print("Status is: '%s', Operator Name is: '%s'" %\
(props['Status'], props['Name']) (props['Status'], props['Name']))
if props.has_key('LocationAreaCode') and props.has_key('CellId'): if props.has_key('LocationAreaCode') and props.has_key('CellId'):
print "Location: '%d', Cell: '%d'" %\ print("Location: '%d', Cell: '%d'" %\
(props['LocationAreaCode'], props['CellId']) (props['LocationAreaCode'], props['CellId']))
if props.has_key('Technology'): if props.has_key('Technology'):
print "Technology: '%s'" % (props['Technology']) print("Technology: '%s'" % (props['Technology']))
try: try:
if plmn == 'default': if plmn == 'default':
@ -62,7 +62,7 @@ if __name__ == "__main__":
op = dbus.Interface(obj, 'org.ofono.NetworkOperator') op = dbus.Interface(obj, 'org.ofono.NetworkOperator')
op.Register() op.Register()
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to register: ", e print("Unable to register: %s" % e)
sys.exit(1) sys.exit(1)
canexit = True canexit = True

View File

@ -20,4 +20,4 @@ if __name__ == "__main__":
phonebook = dbus.Interface(bus.get_object('org.ofono', path), phonebook = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.Phonebook') 'org.ofono.Phonebook')
print phonebook.Import(timeout=100) print(phonebook.Import(timeout=100))

View File

@ -11,16 +11,16 @@ class PushNotificationAgent(dbus.service.Object):
@dbus.service.method("org.ofono.PushNotificationAgent", @dbus.service.method("org.ofono.PushNotificationAgent",
in_signature="", out_signature="") in_signature="", out_signature="")
def Release(self): def Release(self):
print "Release" print("Release")
mainloop.quit() mainloop.quit()
@dbus.service.method("org.ofono.PushNotificationAgent", @dbus.service.method("org.ofono.PushNotificationAgent",
in_signature="aya{sv}", out_signature="") in_signature="aya{sv}", out_signature="")
def ReceiveNotification(self, data, props): def ReceiveNotification(self, data, props):
for key in props.keys(): for key in props.keys():
print "Key: %s, Value: %s" % (key, props[key]) print("Key: %s, Value: %s" % (key, props[key]))
print "Received notification of size: %d" % len(data) print("Received notification of size: %d" % len(data))
if __name__ == '__main__': if __name__ == '__main__':
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
@ -41,7 +41,7 @@ if __name__ == '__main__':
path = "/test/agent" path = "/test/agent"
agent = PushNotificationAgent(bus, path) agent = PushNotificationAgent(bus, path)
pn.RegisterAgent(path) pn.RegisterAgent(path)
print "Agent registered" print("Agent registered")
mainloop = gobject.MainLoop() mainloop = gobject.MainLoop()

View File

@ -11,34 +11,34 @@ class SmartMessagingAgent(dbus.service.Object):
@dbus.service.method("org.ofono.SmartMessagingAgent", @dbus.service.method("org.ofono.SmartMessagingAgent",
in_signature="", out_signature="") in_signature="", out_signature="")
def Release(self): def Release(self):
print "Release" print("Release")
mainloop.quit() mainloop.quit()
@dbus.service.method("org.ofono.SmartMessagingAgent", @dbus.service.method("org.ofono.SmartMessagingAgent",
in_signature="aya{sv}", out_signature="") in_signature="aya{sv}", out_signature="")
def ReceiveBusinessCard(self, data, props): def ReceiveBusinessCard(self, data, props):
for key in props.keys(): for key in props.keys():
print "Key: %s, Value: %s" % (key, props[key]) print("Key: %s, Value: %s" % (key, props[key]))
string = "" string = ""
for byte in data: for byte in data:
string += str(byte) string += str(byte)
print "Received Business Card:" print("Received Business Card:")
print string print(string)
@dbus.service.method("org.ofono.SmartMessagingAgent", @dbus.service.method("org.ofono.SmartMessagingAgent",
in_signature="aya{sv}", out_signature="") in_signature="aya{sv}", out_signature="")
def ReceiveAppointment(self, data, props): def ReceiveAppointment(self, data, props):
for key in props.keys(): for key in props.keys():
print "Key: %s, Value: %s" % (key, props[key]) print("Key: %s, Value: %s" % (key, props[key]))
string = "" string = ""
for byte in data: for byte in data:
string += str(byte) string += str(byte)
print "Received Appointment:" print("Received Appointment:")
print string print(string)
if __name__ == '__main__': if __name__ == '__main__':
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
@ -59,7 +59,7 @@ if __name__ == '__main__':
path = "/test/agent" path = "/test/agent"
agent = SmartMessagingAgent(bus, path) agent = SmartMessagingAgent(bus, path)
pn.RegisterAgent(path) pn.RegisterAgent(path)
print "Agent registered" print("Agent registered")
mainloop = gobject.MainLoop() mainloop = gobject.MainLoop()

View File

@ -20,29 +20,29 @@ def clear_screen(numlines=100):
os.system('CLS') os.system('CLS')
else: else:
print '\n' * numlines print('\n' * numlines)
def print_menu(): def print_menu():
print "Select test case" print("Select test case")
print "-----------------------------------------------------------" print("-----------------------------------------------------------")
print "[0] Send SMS" print("[0] Send SMS")
print "[1] Enable delivery reports" print("[1] Enable delivery reports")
print "[2] Disable delivery reports" print("[2] Disable delivery reports")
print "[3] Set Service Center Address" print("[3] Set Service Center Address")
print "[4] Set PS-only Bearer" print("[4] Set PS-only Bearer")
print "[5] Set CS-only Bearer" print("[5] Set CS-only Bearer")
print "[6] Set PS-preferred Bearer" print("[6] Set PS-preferred Bearer")
print "[7] Set CS-preferred Bearer" print("[7] Set CS-preferred Bearer")
print "[x] Exit" print("[x] Exit")
print "-----------------------------------------------------------" print("-----------------------------------------------------------")
def print_send_sms_menu(): def print_send_sms_menu():
print "Select SMS type" print("Select SMS type")
print "-----------------------------------------------------------" print("-----------------------------------------------------------")
print "[1] Default SMS" print("[1] Default SMS")
print "[2] Long SMS > 160 characters" print("[2] Long SMS > 160 characters")
print "[3] SMS with national characters" print("[3] SMS with national characters")
print "-----------------------------------------------------------" print("-----------------------------------------------------------")
def message_delivery_report(sms, value): def message_delivery_report(sms, value):
try: try:
@ -50,79 +50,79 @@ def message_delivery_report(sms, value):
except dbus.DBusException, e: except dbus.DBusException, e:
if value == 1: if value == 1:
print "Unable to activate Delivery Reports - FAIL" print("Unable to activate Delivery Reports - FAIL")
if value == 0: if value == 0:
print "Unable to deactivate Delivery Reports - FAIL" print("Unable to deactivate Delivery Reports - FAIL")
def message_service_center_address(sms, value): def message_service_center_address(sms, value):
try: try:
sms.SetProperty("ServiceCenterAddress",dbus.String(value)) sms.SetProperty("ServiceCenterAddress",dbus.String(value))
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to set correct Service Center Address - FAIL" print("Unable to set correct Service Center Address - FAIL")
def message_bearer(sms, value): def message_bearer(sms, value):
try: try:
sms.SetProperty("Bearer", dbus.String(value)) sms.SetProperty("Bearer", dbus.String(value))
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to set Bearer[%s] - FAIL" % (value) print("Unable to set Bearer[%s] - FAIL" % (value))
def message_send(sms, number, value): def message_send(sms, number, value):
sms.SendMessage(dbus.String(number), value) sms.SendMessage(dbus.String(number), value)
def property_changed(property, value): def property_changed(property, value):
print "[1]:Message Manager property %s changed to %s" %\ print("[1]:Message Manager property %s changed to %s" %\
(property, value) (property, value))
print "[1]:press ENTER" print("[1]:press ENTER")
def immediate_message(property, value): def immediate_message(property, value):
print "[2]:Message Manager immediate message" print("[2]:Message Manager immediate message")
print "[2]:Text::%s" % (property) print("[2]:Text::%s" % (property))
for key in value.keys(): for key in value.keys():
val = str(value[key]) val = str(value[key])
print "[2]:%s = %s" % (key, val) print("[2]:%s = %s" % (key, val))
print "[2]:press ENTER" print("[2]:press ENTER")
def incoming_message(property, value): def incoming_message(property, value):
print "[3]:Message Manager incoming message" print("[3]:Message Manager incoming message")
print "[3]:Text::%s" % (property) print("[3]:Text::%s" % (property))
for key in value.keys(): for key in value.keys():
val = str(value[key]) val = str(value[key])
print "[3]:%s = %s" % (key, val) print("[3]:%s = %s" % (key, val))
print "[3]:press ENTER" print("[3]:press ENTER")
def message_added(property, value): def message_added(property, value):
print "[4]:Message Manager[Added]" print("[4]:Message Manager[Added]")
print "[4]:%s"% (property) print("[4]:%s"% (property))
for key in value.keys(): for key in value.keys():
val = str(value[key]) val = str(value[key])
print "[4]:%s = %s" % (key, val) print("[4]:%s = %s" % (key, val))
print "[4]:press ENTER" print("[4]:press ENTER")
def message_removed(property): def message_removed(property):
print "[5]:Message Manager [removed]" print("[5]:Message Manager [removed]")
print "[5]: %s" % (property) print("[5]: %s" % (property))
print "[5]:press ENTER" print("[5]:press ENTER")
def print_sms_properties(sms): def print_sms_properties(sms):
global SCA global SCA
properties = sms.GetProperties() properties = sms.GetProperties()
print "---------------------PROPERTIES----------------------------" print("---------------------PROPERTIES----------------------------")
for p in properties: for p in properties:
if len(properties[p].__str__()) > 0: if len(properties[p].__str__()) > 0:
print "%s Message Manager rule is: %s" %\ print("%s Message Manager rule is: %s" %\
(p, properties[p]) (p, properties[p]))
print "------------------------------------------" \ print("------------------------------------------" \
"-----------------" "-----------------")
if p == "ServiceCenterAddress": if p == "ServiceCenterAddress":
SCA = properties[p] SCA = properties[p]
else: else:
print "%s Message Manager rule disabled" % (p) print("%s Message Manager rule disabled" % (p))
def stdin_handler(fd, condition, sms, value, number): def stdin_handler(fd, condition, sms, value, number):
global lock global lock
@ -210,7 +210,7 @@ def stdin_handler(fd, condition, sms, value, number):
if __name__ == "__main__": if __name__ == "__main__":
if (len(sys.argv) < 3): if (len(sys.argv) < 3):
print "Usage: %s [modem] <phone_number> <test_message>" % (sys.argv[0]) print("Usage: %s [modem] <phone_number> <test_message>" % (sys.argv[0]))
sys.exit(1) sys.exit(1)
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)

View File

@ -23,20 +23,20 @@ ss = dbus.Interface(bus.get_object('org.ofono', modem),
try: try:
ss_type, properties = ss.Initiate(ss_code, timeout=100) ss_type, properties = ss.Initiate(ss_code, timeout=100)
except dbus.DBusException, e: except dbus.DBusException, e:
print "Unable to perform operation: ", e print("Unable to perform operation: %s" % e)
sys.exit(1); sys.exit(1);
if (ss_type == "CallBarring"): if (ss_type == "CallBarring"):
print "%s : Operation [ %s ] Service Type [ %s ]" % (ss_type, properties[0], properties[1]) print("%s : Operation [ %s ] Service Type [ %s ]" % (ss_type, properties[0], properties[1]))
for key in properties[2]: for key in properties[2]:
print "%s : %s" % (key, properties[2][key]) print("%s : %s" % (key, properties[2][key]))
elif (ss_type == "CallForwarding"): elif (ss_type == "CallForwarding"):
print "%s : Operation [ %s ] Service Type [ %s ]" % (ss_type, properties[0], properties[1]) print("%s : Operation [ %s ] Service Type [ %s ]" % (ss_type, properties[0], properties[1]))
for key in properties[2]: for key in properties[2]:
print "%s : %s" % (key, properties[2][key]) print("%s : %s" % (key, properties[2][key]))
elif (ss_type == "CallWaiting"): elif (ss_type == "CallWaiting"):
print "%s : Operation [ %s ]" % (ss_type, properties[0]) print("%s : Operation [ %s ]" % (ss_type, properties[0]))
for key in properties[1]: for key in properties[1]:
print "%s : %s" % (key, properties[1][key]) print("%s : %s" % (key, properties[1][key]))
else: else:
print "%s : Operation [ %s ] Status [ %s ]" % (ss_type, properties[0], properties[1]) print("%s : Operation [ %s ] Status [ %s ]" % (ss_type, properties[0], properties[1]))

View File

@ -6,13 +6,13 @@ import dbus
import dbus.mainloop.glib import dbus.mainloop.glib
def property_changed(property, value): def property_changed(property, value):
print "CallBarring property %s changed to %s" % (property, value) print("CallBarring property %s changed to %s" % (property, value))
def print_properties(cb): def print_properties(cb):
properties = cb.GetProperties() properties = cb.GetProperties()
for p in properties: for p in properties:
print "property %s, value: %s" % (p, properties[p]) print("property %s, value: %s" % (p, properties[p]))
if __name__ == "__main__": if __name__ == "__main__":
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
@ -34,61 +34,61 @@ if __name__ == "__main__":
print_properties(cb) print_properties(cb)
print "Trying invalid SS request for CB" print("Trying invalid SS request for CB")
try: try:
print ss.Initiate("*33#456666") print(ss.Initiate("*33#456666"))
except dbus.DBusException, e: except dbus.DBusException, e:
print "Failed with %s - Good" % e print("Failed with %s - Good" % e)
print "Trying invalid SS request for CB" print("Trying invalid SS request for CB")
try: try:
print ss.Initiate("*33*ABC#") print(ss.Initiate("*33*ABC#"))
except dbus.DBusException, e: except dbus.DBusException, e:
print "Failed with %s - Good" % e print("Failed with %s - Good" % e)
print "Trying invalid SS request for CB" print("Trying invalid SS request for CB")
try: try:
print ss.Initiate("*33**ABC#") print(ss.Initiate("*33**ABC#"))
except dbus.DBusException, e: except dbus.DBusException, e:
print "Failed with %s - Good" % e print("Failed with %s - Good" % e)
print "Trying invalid SS request for CB" print("Trying invalid SS request for CB")
try: try:
print ss.Initiate("*33***12#") print(ss.Initiate("*33***12#"))
except dbus.DBusException, e: except dbus.DBusException, e:
print "Failed with %s - Good" % e print("Failed with %s - Good" % e)
print "Query Outgoing All" print("Query Outgoing All")
print ss.Initiate("*#33#") print(ss.Initiate("*#33#"))
print "Query Outgoing International" print("Query Outgoing International")
print ss.Initiate("*#331#") print(ss.Initiate("*#331#"))
print "Query Outgoing except home country" print("Query Outgoing except home country")
print ss.Initiate("*#332#") print(ss.Initiate("*#332#"))
print "Query Incoming All" print("Query Incoming All")
print ss.Initiate("*#35#") print(ss.Initiate("*#35#"))
print "Query Incoming while Roaming" print("Query Incoming while Roaming")
print ss.Initiate("*#351#") print(ss.Initiate("*#351#"))
print "Query All Outgoing" print("Query All Outgoing")
print ss.Initiate("*#333#") print(ss.Initiate("*#333#"))
print "Query All Incoming" print("Query All Incoming")
print ss.Initiate("*#353#") print(ss.Initiate("*#353#"))
print "Query All" print("Query All")
print ss.Initiate("*#330#") print(ss.Initiate("*#330#"))
print "Enable Barring for Outgoing International calls for Voice" print("Enable Barring for Outgoing International calls for Voice")
print ss.Initiate("*33*3579*11#") print(ss.Initiate("*33*3579*11#"))
print_properties(cb) print_properties(cb)
print "Disable All Barrings" print("Disable All Barrings")
print ss.Initiate("#330*3579#") print(ss.Initiate("#330*3579#"))
mainloop = gobject.MainLoop() mainloop = gobject.MainLoop()
mainloop.run() mainloop.run()

View File

@ -6,7 +6,7 @@ import dbus
import dbus.mainloop.glib import dbus.mainloop.glib
def property_changed(property, value): def property_changed(property, value):
print "CallForwarding property %s changed to %s" % (property, value) print("CallForwarding property %s changed to %s" % (property, value))
def print_properties(cf): def print_properties(cf):
properties = cf.GetProperties() properties = cf.GetProperties()
@ -17,7 +17,7 @@ def print_properties(cf):
else: else:
value = "disabled" value = "disabled"
print "%s call forwarding rule: %s" % (p, value) print("%s call forwarding rule: %s" % (p, value))
if __name__ == "__main__": if __name__ == "__main__":
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
@ -42,33 +42,33 @@ if __name__ == "__main__":
print_properties(cf) print_properties(cf)
# Busy To +155542, for Voice # Busy To +155542, for Voice
print "Setting Busy Voice rule to +155542" print("Setting Busy Voice rule to +155542")
print ss.Initiate("*67*+155542*11#") print(ss.Initiate("*67*+155542*11#"))
print_properties(cf) print_properties(cf)
# Not Reachable to +155543, Voice # Not Reachable to +155543, Voice
print "Setting Voice Not Reachable rule to +155543" print("Setting Voice Not Reachable rule to +155543")
print ss.Initiate("**62*+155543*11#") print(ss.Initiate("**62*+155543*11#"))
# Not Reachable to +155544, Voice service # Not Reachable to +155544, Voice service
print "Setting Voice No Reply rule to +155544, timeout=30" print("Setting Voice No Reply rule to +155544, timeout=30")
print ss.Initiate("**61*+155544*11*30#") print(ss.Initiate("**61*+155544*11*30#"))
# Unconditional to +155547, Voice # Unconditional to +155547, Voice
print "Setting Unconditional for Voice to +155545" print("Setting Unconditional for Voice to +155545")
print ss.Initiate("*21*+155545*10#") print(ss.Initiate("*21*+155545*10#"))
print_properties(cf) print_properties(cf)
print "Query all voice forwardings" print("Query all voice forwardings")
print ss.Initiate("*#002**11#") print(ss.Initiate("*#002**11#"))
print "Query no reply voice forwardings" print("Query no reply voice forwardings")
print ss.Initiate("*#61**11#") print(ss.Initiate("*#61**11#"))
# Deactivate everything # Deactivate everything
print "Deactivating everything" print("Deactivating everything")
print ss.Initiate("##002#") print(ss.Initiate("##002#"))
print_properties(cf) print_properties(cf)
mainloop = gobject.MainLoop() mainloop = gobject.MainLoop()

View File

@ -6,13 +6,13 @@ import dbus
import dbus.mainloop.glib import dbus.mainloop.glib
def property_changed(property, value): def property_changed(property, value):
print "CallSettings property %s changed to %s" % (property, value) print("CallSettings property %s changed to %s" % (property, value))
def print_properties(cs): def print_properties(cs):
properties = cs.GetProperties() properties = cs.GetProperties()
for p in properties: for p in properties:
print "property %s, value: %s" % (p, properties[p]) print("property %s, value: %s" % (p, properties[p]))
if __name__ == "__main__": if __name__ == "__main__":
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
@ -34,80 +34,80 @@ if __name__ == "__main__":
print_properties(cs) print_properties(cs)
print "Trying invalid SS request for CLIR" print("Trying invalid SS request for CLIR")
try: try:
print ss.Initiate("*31#456666") print(ss.Initiate("*31#456666"))
except dbus.DBusException, e: except dbus.DBusException, e:
print "Failed with %s - Good" % e print("Failed with %s - Good" % e)
print "Trying invalid SS request for CLIR" print("Trying invalid SS request for CLIR")
try: try:
print ss.Initiate("*31*455*4#") print(ss.Initiate("*31*455*4#"))
except dbus.DBusException, e: except dbus.DBusException, e:
print "Failed with %s - Good" % e print("Failed with %s - Good" % e)
print "Trying invalid SS request for CLIR" print("Trying invalid SS request for CLIR")
try: try:
print ss.Initiate("*31**44435#") print(ss.Initiate("*31**44435#"))
except dbus.DBusException, e: except dbus.DBusException, e:
print "Failed with %s - Good" % e print("Failed with %s - Good" % e)
print "Query CLIP" print("Query CLIP")
print ss.Initiate("*#30#") print(ss.Initiate("*#30#"))
print "Query CNAP" print("Query CNAP")
print ss.Initiate("*#300#") print(ss.Initiate("*#300#"))
print "Query COLP" print("Query COLP")
print ss.Initiate("*#76#") print(ss.Initiate("*#76#"))
print "Query CLIR" print("Query CLIR")
print ss.Initiate("*#31#") print(ss.Initiate("*#31#"))
print "Activate CLIR" print("Activate CLIR")
print ss.Initiate("*31#") print(ss.Initiate("*31#"))
print_properties(cs) print_properties(cs)
print "Deactivate CLIR" print("Deactivate CLIR")
print ss.Initiate("#31#") print(ss.Initiate("#31#"))
print_properties(cs) print_properties(cs)
print "Trying invalid SS request for CW" print("Trying invalid SS request for CW")
try: try:
print ss.Initiate("*43#456666") print(ss.Initiate("*43#456666"))
except dbus.DBusException, e: except dbus.DBusException, e:
print "Failed with %s - Good" % e print("Failed with %s - Good" % e)
print "Trying invalid SS request for CW" print("Trying invalid SS request for CW")
try: try:
print ss.Initiate("*43*455*4#") print(ss.Initiate("*43*455*4#"))
except dbus.DBusException, e: except dbus.DBusException, e:
print "Failed with %s - Good" % e print("Failed with %s - Good" % e)
print "Trying invalid SS request for CW" print("Trying invalid SS request for CW")
try: try:
print ss.Initiate("*43**44435#") print(ss.Initiate("*43**44435#"))
except dbus.DBusException, e: except dbus.DBusException, e:
print "Failed with %s - Good" % e print("Failed with %s - Good" % e)
print "Query CW" print("Query CW")
print ss.Initiate("*#43#") print(ss.Initiate("*#43#"))
print "Query CW, only Voice" print("Query CW, only Voice")
print ss.Initiate("*#43*11#") print(ss.Initiate("*#43*11#"))
print "Query CW, only Fax" print("Query CW, only Fax")
print ss.Initiate("*#43*13#") print(ss.Initiate("*#43*13#"))
print "Disable CW for everything" print("Disable CW for everything")
print ss.Initiate("#43#"); print(ss.Initiate("#43#"));
print_properties(cs) print_properties(cs)
print "Enable CW for Voice" print("Enable CW for Voice")
print ss.Initiate("*43*11#") print(ss.Initiate("*43*11#"))
print_properties(cs) print_properties(cs)

View File

@ -34,7 +34,7 @@ class StkAgent(dbus.service.Object):
return False return False
def call_added(self, path, properties): def call_added(self, path, properties):
print "call added %s" % (path) print("call added %s" % (path))
if (self.timeout_id > 0): if (self.timeout_id > 0):
gobject.source_remove(self.timeout_id) gobject.source_remove(self.timeout_id)
self.timeout_callback() self.timeout_callback()
@ -42,21 +42,21 @@ class StkAgent(dbus.service.Object):
@dbus.service.method("org.ofono.SimToolkitAgent", @dbus.service.method("org.ofono.SimToolkitAgent",
in_signature="", out_signature="") in_signature="", out_signature="")
def Release(self): def Release(self):
print "Release" print("Release")
if self.exit_on_release: if self.exit_on_release:
mainloop.quit() mainloop.quit()
@dbus.service.method("org.ofono.SimToolkitAgent", @dbus.service.method("org.ofono.SimToolkitAgent",
in_signature="sya(sy)n", out_signature="y") in_signature="sya(sy)n", out_signature="y")
def RequestSelection(self, title, icon, items, default): def RequestSelection(self, title, icon, items, default):
print "Title: (%s)" % (title) print("Title: (%s)" % (title))
print "Icon: (%d)" % (icon) print("Icon: (%d)" % (icon))
index = 0 index = 0
for item in items: for item in items:
print "%d. %s (icon: %d)" % (index, item[0], item[1]) print("%d. %s (icon: %d)" % (index, item[0], item[1]))
index += 1 index += 1
print "\nDefault: %d" % (default) print("\nDefault: %d" % (default))
select = raw_input("Enter Selection (t, b):") select = raw_input("Enter Selection (t, b):")
if select == 'b': if select == 'b':
@ -71,9 +71,9 @@ class StkAgent(dbus.service.Object):
async_callbacks=("reply_func", async_callbacks=("reply_func",
"error_func")) "error_func"))
def DisplayText(self, title, icon, urgent, reply_func, error_func): def DisplayText(self, title, icon, urgent, reply_func, error_func):
print "DisplayText (%s)" % (title) print("DisplayText (%s)" % (title))
print "Icon: (%d)" % (icon) print("Icon: (%d)" % (icon))
print "Urgent: (%d)" % (urgent) print("Urgent: (%d)" % (urgent))
key = raw_input("Press return to clear ('t' terminates, " key = raw_input("Press return to clear ('t' terminates, "
"'b' goes back, 'n' busy, " "'b' goes back, 'n' busy, "
"'w' return and wait):") "'w' return and wait):")
@ -91,7 +91,7 @@ class StkAgent(dbus.service.Object):
raise Busy("User wishes to simulate busy screen") raise Busy("User wishes to simulate busy screen")
if (seconds > 0): if (seconds > 0):
print "Waiting for %d seconds" % (seconds) print("Waiting for %d seconds" % (seconds))
self.timeout_reply_handler = reply_func self.timeout_reply_handler = reply_func
self.timeout_id = gobject.timeout_add_seconds(seconds, self.timeout_id = gobject.timeout_add_seconds(seconds,
@ -101,12 +101,12 @@ class StkAgent(dbus.service.Object):
in_signature="sysyyb", out_signature="s") in_signature="sysyyb", out_signature="s")
def RequestInput(self, title, icon, default, min_chars, max_chars, def RequestInput(self, title, icon, default, min_chars, max_chars,
hide_typing): hide_typing):
print "Title: (%s)" % (title) print("Title: (%s)" % (title))
print "Icon: (%d)" % (icon) print("Icon: (%d)" % (icon))
print "Default: (%s)" % (default) print("Default: (%s)" % (default))
print "Hide typing: (%s)" % (hide_typing) print("Hide typing: (%s)" % (hide_typing))
print "Enter characters, min: %d, max: %d:" % (min_chars, print("Enter characters, min: %d, max: %d:" % (min_chars,
max_chars) max_chars))
userin = raw_input("") userin = raw_input("")
return userin return userin
@ -115,12 +115,12 @@ class StkAgent(dbus.service.Object):
in_signature="sysyyb", out_signature="s") in_signature="sysyyb", out_signature="s")
def RequestDigits(self, title, icon, default, min_chars, max_chars, def RequestDigits(self, title, icon, default, min_chars, max_chars,
hide_typing): hide_typing):
print "Title: (%s)" % (title) print("Title: (%s)" % (title))
print "Icon: (%d)" % (icon) print("Icon: (%d)" % (icon))
print "Default: (%s)" % (default) print("Default: (%s)" % (default))
print "Hide typing: (%s)" % (hide_typing) print("Hide typing: (%s)" % (hide_typing))
print "Enter digits, min: %d, max: %d:" % (min_chars, print("Enter digits, min: %d, max: %d:" % (min_chars,
max_chars) max_chars))
userin = raw_input("'t' terminates, 'b' goes back:") userin = raw_input("'t' terminates, 'b' goes back:")
if userin == 'b': if userin == 'b':
@ -133,8 +133,8 @@ class StkAgent(dbus.service.Object):
@dbus.service.method("org.ofono.SimToolkitAgent", @dbus.service.method("org.ofono.SimToolkitAgent",
in_signature="sy", out_signature="s") in_signature="sy", out_signature="s")
def RequestKey(self, title, icon): def RequestKey(self, title, icon):
print "Title: (%s)" % (title) print("Title: (%s)" % (title))
print "Icon: (%d)" % (icon) print("Icon: (%d)" % (icon))
key = raw_input("Enter Key (t, b):") key = raw_input("Enter Key (t, b):")
if key == 'b': if key == 'b':
@ -147,8 +147,8 @@ class StkAgent(dbus.service.Object):
@dbus.service.method("org.ofono.SimToolkitAgent", @dbus.service.method("org.ofono.SimToolkitAgent",
in_signature="sy", out_signature="s") in_signature="sy", out_signature="s")
def RequestDigit(self, title, icon): def RequestDigit(self, title, icon):
print "Title: (%s)" % (title) print("Title: (%s)" % (title))
print "Icon: (%d)" % (icon) print("Icon: (%d)" % (icon))
key = raw_input("Enter Digit (t, b):") key = raw_input("Enter Digit (t, b):")
if key == 'b': if key == 'b':
@ -161,8 +161,8 @@ class StkAgent(dbus.service.Object):
@dbus.service.method("org.ofono.SimToolkitAgent", @dbus.service.method("org.ofono.SimToolkitAgent",
in_signature="sy", out_signature="s") in_signature="sy", out_signature="s")
def RequestQuickDigit(self, title, icon): def RequestQuickDigit(self, title, icon):
print "Title: (%s)" % (title) print("Title: (%s)" % (title))
print "Icon: (%d)" % (icon) print("Icon: (%d)" % (icon))
key = raw_input("Quick digit (0-9, *, #, t, b):") key = raw_input("Quick digit (0-9, *, #, t, b):")
if key == 'b': if key == 'b':
@ -175,8 +175,8 @@ class StkAgent(dbus.service.Object):
@dbus.service.method("org.ofono.SimToolkitAgent", @dbus.service.method("org.ofono.SimToolkitAgent",
in_signature="sy", out_signature="b") in_signature="sy", out_signature="b")
def RequestConfirmation(self, title, icon): def RequestConfirmation(self, title, icon):
print "Title: (%s)" % (title) print("Title: (%s)" % (title))
print "Icon: (%d)" % (icon) print("Icon: (%d)" % (icon))
key = raw_input("Enter Confirmation (t, b, y, n):") key = raw_input("Enter Confirmation (t, b, y, n):")
if key == 'b': if key == 'b':
@ -191,8 +191,8 @@ class StkAgent(dbus.service.Object):
@dbus.service.method("org.ofono.SimToolkitAgent", @dbus.service.method("org.ofono.SimToolkitAgent",
in_signature="sy", out_signature="b") in_signature="sy", out_signature="b")
def ConfirmCallSetup(self, info, icon): def ConfirmCallSetup(self, info, icon):
print "Information: (%s)" % (info) print("Information: (%s)" % (info))
print "Icon: (%d)" % (icon) print("Icon: (%d)" % (icon))
key = raw_input("Enter Confirmation (t, y, n):") key = raw_input("Enter Confirmation (t, y, n):")
if key == 't': if key == 't':
@ -205,9 +205,9 @@ class StkAgent(dbus.service.Object):
@dbus.service.method("org.ofono.SimToolkitAgent", @dbus.service.method("org.ofono.SimToolkitAgent",
in_signature="sys", out_signature="b") in_signature="sys", out_signature="b")
def ConfirmLaunchBrowser(self, info, icon, url): def ConfirmLaunchBrowser(self, info, icon, url):
print "Information: (%s)" % (info) print("Information: (%s)" % (info))
print "Icon: (%d)" % (icon) print("Icon: (%d)" % (icon))
print "URL (%s)" % (url) print("URL (%s)" % (url))
key = raw_input("Enter Confirmation (y, n):") key = raw_input("Enter Confirmation (y, n):")
if key == 'y': if key == 'y':
@ -218,14 +218,14 @@ class StkAgent(dbus.service.Object):
@dbus.service.method("org.ofono.SimToolkitAgent", @dbus.service.method("org.ofono.SimToolkitAgent",
in_signature="", out_signature="") in_signature="", out_signature="")
def Cancel(self): def Cancel(self):
print "Cancel" print("Cancel")
@dbus.service.method("org.ofono.SimToolkitAgent", @dbus.service.method("org.ofono.SimToolkitAgent",
in_signature="ssy", out_signature="") in_signature="ssy", out_signature="")
def PlayTone(self, tone, text, icon): def PlayTone(self, tone, text, icon):
print "PlayTone: %s" % (tone) print("PlayTone: %s" % (tone))
print "Text: %s" % (text) print("Text: %s" % (text))
print "Icon: %d" % (icon) print("Icon: %d" % (icon))
signal.signal(signal.SIGALRM, handler) signal.signal(signal.SIGALRM, handler)
signal.alarm(5) signal.alarm(5)
@ -239,16 +239,16 @@ class StkAgent(dbus.service.Object):
raise EndSession("User wishes to terminate" raise EndSession("User wishes to terminate"
" session") " session")
except Exception, exc: except Exception, exc:
print exc print(exc)
@dbus.service.method("org.ofono.SimToolkitAgent", @dbus.service.method("org.ofono.SimToolkitAgent",
in_signature="ssy", out_signature="", in_signature="ssy", out_signature="",
async_callbacks=("reply_func", async_callbacks=("reply_func",
"error_func")) "error_func"))
def LoopTone(self, tone, text, icon, reply_func, error_func): def LoopTone(self, tone, text, icon, reply_func, error_func):
print "LoopTone: %s" % (tone) print("LoopTone: %s" % (tone))
print "Text: %s" % (text) print("Text: %s" % (text))
print "Icon: %d" % (icon) print("Icon: %d" % (icon))
key = raw_input("Press return to end before timeout " key = raw_input("Press return to end before timeout "
"('t' terminates, 'w' return and wait):") "('t' terminates, 'w' return and wait):")
@ -261,7 +261,7 @@ class StkAgent(dbus.service.Object):
raise EndSession("User wishes to terminate session") raise EndSession("User wishes to terminate session")
if (seconds > 0): if (seconds > 0):
print "Waiting for %d seconds" % (seconds) print("Waiting for %d seconds" % (seconds))
self.timeout_reply_handler = reply_func self.timeout_reply_handler = reply_func
self.timeout_id = gobject.timeout_add_seconds(seconds, self.timeout_id = gobject.timeout_add_seconds(seconds,
@ -270,14 +270,14 @@ class StkAgent(dbus.service.Object):
@dbus.service.method("org.ofono.SimToolkitAgent", @dbus.service.method("org.ofono.SimToolkitAgent",
in_signature="sy", out_signature="") in_signature="sy", out_signature="")
def DisplayActionInformation(self, text, icon): def DisplayActionInformation(self, text, icon):
print "Text: %s" % (text) print("Text: %s" % (text))
print "Icon: %d" % (icon) print("Icon: %d" % (icon))
@dbus.service.method("org.ofono.SimToolkitAgent", @dbus.service.method("org.ofono.SimToolkitAgent",
in_signature="sy", out_signature="") in_signature="sy", out_signature="")
def DisplayAction(self, text, icon): def DisplayAction(self, text, icon):
print "Text: (%s)" % (text) print("Text: (%s)" % (text))
print "Icon: (%d)" % (icon) print("Icon: (%d)" % (icon))
key = raw_input("Press 't' to terminate the session ") key = raw_input("Press 't' to terminate the session ")
if key == 't': if key == 't':
@ -286,8 +286,8 @@ class StkAgent(dbus.service.Object):
@dbus.service.method("org.ofono.SimToolkitAgent", @dbus.service.method("org.ofono.SimToolkitAgent",
in_signature="sy", out_signature="b") in_signature="sy", out_signature="b")
def ConfirmOpenChannel(self, info, icon): def ConfirmOpenChannel(self, info, icon):
print "Open channel confirmation: (%s)" % (info) print("Open channel confirmation: (%s)" % (info))
print "Icon: (%d)" % (icon) print("Icon: (%d)" % (icon))
key = raw_input("Enter Confirmation (t, y, n):") key = raw_input("Enter Confirmation (t, y, n):")
if key == 't': if key == 't':
@ -346,7 +346,7 @@ def pretty(d):
return str(d) return str(d)
def property_changed(name, value): def property_changed(name, value):
print "SimToolKit property: %s changed to '%s'" % (name, pretty(value)) print("SimToolKit property: %s changed to '%s'" % (name, pretty(value)))
if __name__ == '__main__': if __name__ == '__main__':
if len(sys.argv) == 2: if len(sys.argv) == 2:
@ -376,15 +376,15 @@ if __name__ == '__main__':
if mode == 'menu': if mode == 'menu':
if "MainMenuTitle" in properties: if "MainMenuTitle" in properties:
print "Main Menu:" print("Main Menu:")
print "%s" % (properties["MainMenuTitle"]) print("%s" % (properties["MainMenuTitle"]))
print "\n" print("\n")
if "MainMenu" in properties: if "MainMenu" in properties:
print "Items:" print("Items:")
index = 0 index = 0
for item in properties["MainMenu"]: for item in properties["MainMenu"]:
print "%d. %s" % (index, item[0]) print("%d. %s" % (index, item[0]))
index += 1 index += 1
path = "/test/agent" path = "/test/agent"
@ -408,9 +408,9 @@ if __name__ == '__main__':
stk.RegisterAgent(path) stk.RegisterAgent(path)
print "Default Agent registered - Waiting for STK command..." print("Default Agent registered - Waiting for STK command...")
else: else:
print "%s [menu|agent]" % (sys.argv[0]) print("%s [menu|agent]" % (sys.argv[0]))
exit(0) exit(0)
mainloop = gobject.MainLoop() mainloop = gobject.MainLoop()

View File

@ -17,10 +17,10 @@ elif len(sys.argv) == 3:
pin_type = sys.argv[1] pin_type = sys.argv[1]
pin = sys.argv[2] pin = sys.argv[2]
else: else:
print "%s [PATH] pin_type pin" % (sys.argv[0]) print("%s [PATH] pin_type pin" % (sys.argv[0]))
sys.exit(0) sys.exit(0)
print "Unlock %s %s for modem %s..." % (pin_type, pin, path) print("Unlock %s %s for modem %s..." % (pin_type, pin, path))
simmanager = dbus.Interface(bus.get_object('org.ofono', path), simmanager = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.SimManager') 'org.ofono.SimManager')