From: Smitty <me@smitop.com>
To: ofono@ofono.org
Subject: [PATCH] Better display serving cell info
Date: Sat, 08 May 2021 19:12:26 -0400 [thread overview]
Message-ID: <20210508231225.18672-1-me@smitop.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 6282 bytes --]
Fixes some missing space in the output:
[ Mobile Country Code = 722 ]
Instead of:
[ Mobile Country Code = 722]
This also unifies the display logic between {get,test}-serving-cell-info
---
test/get-serving-cell-info | 48 ++++++++++++++++++++-----------
test/test-serving-cell-info | 56 +++++++++++++++++++++++++++++++------
2 files changed, 80 insertions(+), 24 deletions(-)
diff --git a/test/get-serving-cell-info b/test/get-serving-cell-info
index 7a5d8981..b9609bdf 100755
--- a/test/get-serving-cell-info
+++ b/test/get-serving-cell-info
@@ -38,51 +38,67 @@ cqi = 'ChannelQualityIndicator'
print("Current serving cell information:")
if tech in servingcell:
- print(" [ Radio Access Technology = %s]" % (servingcell[tech]))
+ print(" [ Radio Access Technology = %s ]" \
+ % (servingcell[tech]))
if mcc in servingcell:
- print(" [ Mobile Country Code = %s]" % (servingcell[mcc]))
+ print(" [ Mobile Country Code = %s ]" \
+ % (servingcell[mcc]))
if mnc in servingcell:
- print(" [ Mobile Network Code = %s]" % (servingcell[mnc]))
+ print(" [ Mobile Network Code = %s ]" \
+ % (servingcell[mnc]))
if lac in servingcell:
- print(" [ Location Area Code = %d]" % (servingcell[lac]))
+ print(" [ Location Area Code = %d ]" \
+ % (servingcell[lac]))
if cid in servingcell:
- print(" [ Cell Identity = %d]" % (servingcell[cid]))
+ print(" [ Cell Identity = %d ]" \
+ % (servingcell[cid]))
if psc in servingcell:
- print(" [ Primary Scrambling Code = %d]" % (servingcell[psc]))
+ print(" [ Primary Scrambling Code = %d ]" \
+ % (servingcell[psc]))
if rssi in servingcell:
- print(" [ Signal Strength = %d]" % (servingcell[rssi]))
+ print(" [ Signal Strength = %d ]" \
+ % (servingcell[rssi]))
if rxlev in servingcell:
- print(" [ Received Signal Strength = %d]" % (servingcell[rxlev]))
+ print(" [ Received Signal Strength = %d ]" \
+ % (servingcell[rxlev]))
if ber in servingcell:
- print(" [ Bit Error Rate = %d]" % (servingcell[ber]))
+ print(" [ Bit Error Rate = %d ]" \
+ % (servingcell[ber]))
if rscp in servingcell:
- print(" [ Received Signal Code Power = %d]" % (servingcell[rscp]))
+ print(" [ Received Signal Code Power = %d ]" \
+ % (servingcell[rscp]))
if ecn0 in servingcell:
- print(" [ Received Energy Ratio = %d]" % (servingcell[ecn0]))
+ print(" [ Received Energy Ratio = %d ]" \
+ % (servingcell[ecn0]))
if rsrq in servingcell:
- print(" [ Reference Signal Received Quality = %d]" % (servingcell[rsrq]))
+ print(" [ Reference Signal Received Quality = %d ]" \
+ % (servingcell[rsrq]))
if rsrp in servingcell:
- print(" [ Reference Signal Received Power = %d]" % (servingcell[rsrp]))
+ print(" [ Reference Signal Received Power = %d ]" \
+ % (servingcell[rsrp]))
if earfcn in servingcell:
- print(" [ E-UTRA Absolue Radio Frequency Channel = %d ]" % (servingcell[earfcn]))
+ print(" [ E-UTRA Absolue Radio Frequency Channel = %d ]" \
+ % (servingcell[earfcn]))
if eband in servingcell:
- print(" [ E-UTRA operating Band = %d ]" % (servingcell[eband]))
+ print(" [ E-UTRA operating Band = %d ]" \
+ % (servingcell[eband]))
if cqi in servingcell:
- print(" [ Channel Quality Indicator = %d ]" % (servingcell[cqi]))
+ print(" [ Channel Quality Indicator = %d ]" \
+ % (servingcell[cqi]))
print('')
diff --git a/test/test-serving-cell-info b/test/test-serving-cell-info
index 498ce88b..df4a9b52 100755
--- a/test/test-serving-cell-info
+++ b/test/test-serving-cell-info
@@ -30,39 +30,79 @@ class NetworkMonitorAgent(dbus.service.Object):
psc = 'PrimaryScramblingCode'
rssi = 'Strength'
ber = 'BitErrorRate'
+ rxlev = 'ReceivedSignalStrength'
+ rscp = 'ReceivedSignalCodePower'
+ ecn0 = 'ReceivedEnergyRatio'
+ rsrq = 'ReferenceSignalReceivedQuality'
+ rsrp = 'ReferenceSignalReceivedPower'
+ earfcn = 'EARFCN'
+ eband = 'EBand'
+ cqi = 'ChannelQualityIndicator'
if tech in servingcell:
- print(" [ Radio Access Technology = %s]" \
+ print(" [ Radio Access Technology = %s ]" \
% (servingcell[tech]))
if mcc in servingcell:
- print(" [ Mobile Country Code = %s]" \
+ print(" [ Mobile Country Code = %s ]" \
% (servingcell[mcc]))
if mnc in servingcell:
- print(" [ Mobile Network Code = %s]" \
+ print(" [ Mobile Network Code = %s ]" \
% (servingcell[mnc]))
if lac in servingcell:
- print(" [ Location Area Code = %d]" \
+ print(" [ Location Area Code = %d ]" \
% (servingcell[lac]))
if cid in servingcell:
- print(" [ Cell Identity = %d]" \
+ print(" [ Cell Identity = %d ]" \
% (servingcell[cid]))
if psc in servingcell:
- print(" [ Primary Scrambling Code = %d]" \
+ print(" [ Primary Scrambling Code = %d ]" \
% (servingcell[psc]))
if rssi in servingcell:
- print(" [ Signal Strength = %d]" \
+ print(" [ Signal Strength = %d ]" \
% (servingcell[rssi]))
+ if rxlev in servingcell:
+ print(" [ Received Signal Strength = %d ]" \
+ % (servingcell[rxlev]))
+
if ber in servingcell:
- print(" [ Bit Error Rate = %d]" \
+ print(" [ Bit Error Rate = %d ]" \
% (servingcell[ber]))
+ if rscp in servingcell:
+ print(" [ Received Signal Code Power = %d ]" \
+ % (servingcell[rscp]))
+
+ if ecn0 in servingcell:
+ print(" [ Received Energy Ratio = %d ]" \
+ % (servingcell[ecn0]))
+
+ if rsrq in servingcell:
+ print(" [ Reference Signal Received Quality = %d ]" \
+ % (servingcell[rsrq]))
+
+ if rsrp in servingcell:
+ print(" [ Reference Signal Received Power = %d ]" \
+ % (servingcell[rsrp]))
+
+ if earfcn in servingcell:
+ print(" [ E-UTRA Absolue Radio Frequency Channel = %d ]" \
+ % (servingcell[earfcn]))
+
+ if eband in servingcell:
+ print(" [ E-UTRA operating Band = %d ]" \
+ % (servingcell[eband]))
+
+ if cqi in servingcell:
+ print(" [ Channel Quality Indicator = %d ]" \
+ % (servingcell[cqi]))
+
print('')
if __name__ == '__main__':
--
2.27.0
reply other threads:[~2021-05-08 23:12 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210508231225.18672-1-me@smitop.com \
--to=me@smitop.com \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).