Skip to contentSkip to conversation

test: Add get serving cell information script

PATCH In review Nishanth V 2 participants 2 messages Mar 31, 2016 Kbuild

lore
Share & tools
lore

Nishanth V

author
#0 lore raw

PATCH 6/6 test: Add get serving cell information script

---
 Makefile.am                |  3 ++-
 test/get-serving-cell-info | 56 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+), 1 deletion(-)
 create mode 100644 test/get-serving-cell-info
Makefile.am +2 -1
index ce4c107..5cd9766 100644
@@ -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
test/get-serving-cell-info new file +56 -0

56 lines not on this page · raw message

Signature · 1 line
1.9.1
#1 lore raw

Hi Nishanth,

Quoted 6 lines · Nishanth V
---
  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...

Quoted 21 lines
Makefile.am +2 -1
index ce4c107..5cd9766 100644
@@ -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
test/get-serving-cell-info new file +1 -0
new file mode 100644
index 0000000..05dc9fe
@@ -0,0 +1,56 @@
+#!/usr/bin/python3

test/get-serving-cell-info line 11

Quoted 10 lines
test/get-serving-cell-info new file +10 -0
+
+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

Quoted 36 lines
test/get-serving-cell-info new file +35 -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]))
+

test/get-serving-cell-info line 56

Quoted 10 lines
test/get-serving-cell-info new file +10 -0
+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