This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
fixeria gerrit-no-reply at lists.osmocom.orgfixeria has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmocom-bb/+/14574 )
Change subject: trx_toolkit/data_msg.py: inline both gen_fn() and parse_fn()
......................................................................
trx_toolkit/data_msg.py: inline both gen_fn() and parse_fn()
Both functions are never used outside of both gen_msg() and parse_msg().
AFAIR, they were more complicated until we started to use struct, but
now they can be easily inlined.
Change-Id: Ie64b271cf502f3df23b32f4b14a1e2b551a0f794
---
M src/target/trx_toolkit/data_msg.py
1 file changed, 3 insertions(+), 14 deletions(-)
Approvals:
laforge: Looks good to me, but someone else must approve
fixeria: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/target/trx_toolkit/data_msg.py b/src/target/trx_toolkit/data_msg.py
index f14c295..6d6b76c 100644
--- a/src/target/trx_toolkit/data_msg.py
+++ b/src/target/trx_toolkit/data_msg.py
@@ -136,16 +136,6 @@
return True
- # Generates frame number to bytes
- def gen_fn(self, fn):
- # Big endian, 4 bytes
- return struct.pack(">L", fn)
-
- # Parses frame number from bytes
- def parse_fn(self, buf):
- # Big endian, 4 bytes
- return struct.unpack(">L", buf)[0]
-
# Generates a TRX DATA message
def gen_msg(self, legacy = False):
# Validate all the fields
@@ -158,9 +148,8 @@
# Put timeslot index
buf.append(self.tn)
- # Put frame number
- fn = self.gen_fn(self.fn)
- buf += fn
+ # Put frame number (4 octets, BE)
+ buf += struct.pack(">L", self.fn)
# Generate message specific header part
hdr = self.gen_hdr()
@@ -186,7 +175,7 @@
raise ValueError("Message is to short")
# Parse both fn and tn
- self.fn = self.parse_fn(msg[1:5])
+ self.fn = struct.unpack(">L", msg[1:5])[0]
self.tn = msg[0]
# Specific message part
--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/14574
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: Ie64b271cf502f3df23b32f4b14a1e2b551a0f794
Gerrit-Change-Number: 14574
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at gnumonks.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190624/37a37f8d/attachment.htm>