ofono/test/list-operators

40 lines
834 B
Plaintext
Raw Permalink Normal View History

#!/usr/bin/python3
import dbus
2010-08-18 22:47:14 +00:00
import sys
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object('org.ofono', '/'),
'org.ofono.Manager')
2010-09-09 19:37:37 +00:00
modems = manager.GetModems()
2010-09-09 19:37:37 +00:00
for path, properties in modems:
print("[ %s ]" % (path))
if "org.ofono.NetworkRegistration" not in properties["Interfaces"]:
continue
netreg = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.NetworkRegistration')
2010-08-18 22:47:14 +00:00
if len(sys.argv) == 2 and sys.argv[1] == 'scan':
operators = netreg.Scan()
else:
operators = netreg.GetOperators()
2010-08-18 22:47:14 +00:00
for path, properties in operators:
print(" [ %s ]" % (path))
for key in properties.keys():
if key in ["Technologies"]:
val = ""
for i in properties[key]:
val += i + " "
else:
val = str(properties[key])
print(" %s = %s" % (key, val))
2010-08-18 22:47:14 +00:00
print('')