mirror of
https://github.com/sailfishos/ofono
synced 2025-12-03 16:11:04 +08:00
Add test script for listing all operator details
This commit is contained in:
@@ -143,7 +143,8 @@ test_files = test/test-manager test/test-modem test/test-voicecall \
|
|||||||
test/test-call-forwarding test/test-call-barring \
|
test/test-call-forwarding test/test-call-barring \
|
||||||
test/test-ss-control-cb test/test-ss-control-cf \
|
test/test-ss-control-cb test/test-ss-control-cf \
|
||||||
test/test-ss-control-cs \
|
test/test-ss-control-cs \
|
||||||
test/monitor-ofono test/list-modems test/enable-modem
|
test/monitor-ofono test/list-modems test/enable-modem \
|
||||||
|
test/list-operators
|
||||||
|
|
||||||
EXTRA_DIST = src/genbuiltin src/ofono.conf $(doc_files) $(test_files)
|
EXTRA_DIST = src/genbuiltin src/ofono.conf $(doc_files) $(test_files)
|
||||||
|
|
||||||
|
|||||||
40
test/list-operators
Executable file
40
test/list-operators
Executable file
@@ -0,0 +1,40 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
import dbus
|
||||||
|
|
||||||
|
bus = dbus.SystemBus()
|
||||||
|
|
||||||
|
manager = dbus.Interface(bus.get_object('org.ofono', '/'),
|
||||||
|
'org.ofono.Manager')
|
||||||
|
|
||||||
|
properties = manager.GetProperties()
|
||||||
|
|
||||||
|
for path in properties["Modems"]:
|
||||||
|
modem = dbus.Interface(bus.get_object('org.ofono', path),
|
||||||
|
'org.ofono.Modem')
|
||||||
|
|
||||||
|
properties = modem.GetProperties()
|
||||||
|
|
||||||
|
print "[ %s ]" % (path)
|
||||||
|
|
||||||
|
if "org.ofono.NetworkRegistration" not in properties["Interfaces"]:
|
||||||
|
continue
|
||||||
|
|
||||||
|
netreg = dbus.Interface(bus.get_object('org.ofono', path),
|
||||||
|
'org.ofono.NetworkRegistration')
|
||||||
|
|
||||||
|
properties = netreg.GetProperties()
|
||||||
|
|
||||||
|
for path in properties["AvailableOperators"]:
|
||||||
|
operator = dbus.Interface(bus.get_object('org.ofono', path),
|
||||||
|
'org.ofono.NetworkOperator')
|
||||||
|
|
||||||
|
properties = operator.GetProperties()
|
||||||
|
|
||||||
|
print " [ %s ]" % (path)
|
||||||
|
|
||||||
|
for key in properties.keys():
|
||||||
|
val = str(properties[key])
|
||||||
|
print " %s = %s" % (key, val)
|
||||||
|
|
||||||
|
print
|
||||||
Reference in New Issue
Block a user