* [PATCH 6/6] test: Add get serving cell information script
@ 2016-03-31 4:25 Nishanth V
2016-03-31 15:07 ` Denis Kenzior
0 siblings, 1 reply; 2+ messages in thread
From: Nishanth V @ 2016-03-31 4:25 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2255 bytes --]
---
Makefile.am | 3 ++-
test/get-serving-cell-info | 56 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 58 insertions(+), 1 deletion(-)
create mode 100644 test/get-serving-cell-info
diff --git a/Makefile.am b/Makefile.am
index ce4c107..5cd9766 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 0000000..05dc9fe
--- /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('')
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH 6/6] test: Add get serving cell information script
2016-03-31 4:25 [PATCH 6/6] test: Add get serving cell information script Nishanth V
@ 2016-03-31 15:07 ` Denis Kenzior
0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2016-03-31 15:07 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2838 bytes --]
Hi Nishanth,
On 03/30/2016 11:25 PM, Nishanth V wrote:
> ---
> Makefile.am | 3 ++-
> test/get-serving-cell-info | 56 ++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 58 insertions(+), 1 deletion(-)
> create mode 100644 test/get-serving-cell-info
>
I went ahead and applied this one, but...
> diff --git a/Makefile.am b/Makefile.am
> index ce4c107..5cd9766 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 0000000..05dc9fe
> --- /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]
> +
Can you please add some way to select the modem to use? Many developers
run multiple modems (e.g. phonesim, stktest + real hardware ones), so
scripts assuming that the first modem is the target is inconvenient.
See test/set-sms-bearer that Anirudh did for an example. Or test/send-sms
> +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('')
>
Regards,
-Denis
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-03-31 15:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-31 4:25 [PATCH 6/6] test: Add get serving cell information script Nishanth V
2016-03-31 15:07 ` Denis Kenzior
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.