diff options
author | Nishanth V <nishanth.v@intel.com> | 2016-03-31 09:55:03 +0530 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2016-03-31 10:00:59 -0500 |
commit | 1bfdd575192a009f13dcb60e43ff9f869c809f33 (patch) | |
tree | e5bfbbfb44e24cdc843894ad021794ee8938d3e6 | |
parent | 8c88c307ca4ed31bbdadd52edd4e3ef3ece596eb (diff) | |
download | ofono-1bfdd575192a009f13dcb60e43ff9f869c809f33.tar.gz |
test: Add get serving cell information script
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | test/get-serving-cell-info | 56 |
2 files changed, 58 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am index ce4c1073..5cd97665 100644 --- a/Makefile.am +++ b/Makefile.am @@ -744,7 +744,8 @@ test_scripts = test/backtrace \ test/register-auto \ test/register-operator \ test/set-sms-smsc \ - test/set-sms-bearer + test/set-sms-bearer \ + test/get-serving-cell-info if TEST testdir = $(pkglibdir)/test diff --git a/test/get-serving-cell-info b/test/get-serving-cell-info new file mode 100644 index 00000000..05dc9fe6 --- /dev/null +++ b/test/get-serving-cell-info @@ -0,0 +1,56 @@ +#!/usr/bin/python3 + +import dbus + +bus = dbus.SystemBus() + +manager = dbus.Interface(bus.get_object('org.ofono', '/'), 'org.ofono.Manager') + +modems = manager.GetModems() +path = modems[0][0] + +monitor = dbus.Interface(bus.get_object('org.ofono', path), + 'org.ofono.NetworkMonitor') + +try: + servingcell = monitor.GetServingCellInformation() +except dbus.DBusException as e: + print("Unable to get serving cell information") + exit() + +tech = 'Technology' +mcc = 'MobileCountryCode' +mnc = 'MobileNetworkCode' +lac = 'LocationAreaCode' +cid = 'CellId' +psc = 'PrimaryScramblingCode' +rssi = 'Strength' +ber = 'BitErrorRate' + +print("Current serving cell information:") + +if tech in servingcell: + print(" [ Radio Access Technology = %s]" % (servingcell[tech])) + +if mcc in servingcell: + print(" [ Mobile Country Code = %s]" % (servingcell[mcc])) + +if mnc in servingcell: + print(" [ Mobile Network Code = %s]" % (servingcell[mnc])) + +if lac in servingcell: + print(" [ Location Area Code = %d]" % (servingcell[lac])) + +if cid in servingcell: + print(" [ Cell Identity = %d]" % (servingcell[cid])) + +if psc in servingcell: + print(" [ Primary Scrambling Code = %d]" % (servingcell[psc])) + +if rssi in servingcell: + print(" [ Signal Strength = %d]" % (servingcell[rssi])) + +if ber in servingcell: + print(" [ Bit Error Rate = %d]" % (servingcell[ber])) + +print('') |