From 7aec65b52656875e25df35b11cb6eb75eb2cc69f Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 2 Sep 2009 03:58:27 -0700 Subject: [PATCH] Add test script for listing all operator details --- Makefile.am | 3 ++- test/list-operators | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100755 test/list-operators diff --git a/Makefile.am b/Makefile.am index 723acfc4..d0ad7f9c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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-ss-control-cb test/test-ss-control-cf \ 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) diff --git a/test/list-operators b/test/list-operators new file mode 100755 index 00000000..3e9e4082 --- /dev/null +++ b/test/list-operators @@ -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