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/.
Vadim Yanitskiy gerrit-no-reply at lists.osmocom.orgVadim Yanitskiy has uploaded this change for review. ( https://gerrit.osmocom.org/12261 Change subject: trx_toolkit/data_if.py: add message parsing methods ...................................................................... trx_toolkit/data_if.py: add message parsing methods This change extends DATAInterface class with new methods: - recv_raw_data() - read raw data from socket; - recv_l12trx_msg() - read raw data and parse as L12TRX; - recv_trx2l1_msg() - read raw data and parse as TRX2L1; which would simplify the further usage of this class. Change-Id: I761c4e63864622d3882b8f9c80ea43b58f092cb1 --- M src/target/trx_toolkit/data_if.py 1 file changed, 33 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/61/12261/1 diff --git a/src/target/trx_toolkit/data_if.py b/src/target/trx_toolkit/data_if.py index f4431a4..45114ed 100644 --- a/src/target/trx_toolkit/data_if.py +++ b/src/target/trx_toolkit/data_if.py @@ -26,6 +26,39 @@ from data_msg import * class DATAInterface(UDPLink): + def recv_raw_data(self): + data, _ = self.sock.recvfrom(512) + return data + + def recv_l12trx_msg(self): + # Read raw data from socket + data = self.recv_raw_data() + + # Attempt to parse as a L12TRX message + try: + msg = DATAMSG_L12TRX() + msg.parse_msg(bytearray(data)) + except: + log.error("Failed to parse a L12TRX message " + "from R:%s:%u" % (self.remote_addr, self.remote_port)) + return None + + return msg + + def recv_trx2l1_msg(self): + # Read raw data from socket + data = self.recv_raw_data() + + # Attempt to parse as a L12TRX message + try: + msg = DATAMSG_TRX2L1() + msg.parse_msg(bytearray(data)) + except: + log.error("Failed to parse a TRX2L1 message " + "from R:%s:%u" % (self.remote_addr, self.remote_port)) + return None + + return msg def send_msg(self, msg): # Validate a message -- To view, visit https://gerrit.osmocom.org/12261 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I761c4e63864622d3882b8f9c80ea43b58f092cb1 Gerrit-Change-Number: 12261 Gerrit-PatchSet: 1 Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181211/232897f3/attachment.htm>