diff options
author | Vadim Yanitskiy <axilirator@gmail.com> | 2019-11-17 21:38:16 +0700 |
---|---|---|
committer | laforge <laforge@osmocom.org> | 2019-11-20 15:05:57 +0000 |
commit | 7108c28c38a136df049e8edef12bd7e71b76a40e (patch) | |
tree | 4fc7161ed2eeae807abc4c252381c1965560b2a1 | |
parent | b1ae186c55109dd324d8186bcb493b2fac657619 (diff) |
trx_toolkit/data_msg.py: fix: NOPE.ind also contains C/I filed
Change-Id: I281fb7387a83fec7e097ebf8650c95713d3f70e9
-rw-r--r-- | src/target/trx_toolkit/data_msg.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/target/trx_toolkit/data_msg.py b/src/target/trx_toolkit/data_msg.py index ec59b856..c96dddb6 100644 --- a/src/target/trx_toolkit/data_msg.py +++ b/src/target/trx_toolkit/data_msg.py @@ -630,7 +630,8 @@ class DATAMSG_TRX2L1(DATAMSG): if self.toa256 < self.TOA256_MIN or self.toa256 > self.TOA256_MAX: raise ValueError("ToA256 %d is out of range" % self.toa256) - if self.ver >= 0x01: + # Version specific parameters (omited for NOPE.ind) + if self.ver >= 0x01 and not self.nope_ind: if type(self.mod_type) is not Modulation: raise ValueError("Unknown Rx modulation type") @@ -650,6 +651,8 @@ class DATAMSG_TRX2L1(DATAMSG): if self.tsc not in self.TSC_RANGE: raise ValueError("TSC %d is out of range" % self.tsc) + # Version specific parameters (also present in NOPE.ind) + if self.ver >= 0x01: if self.ci is None: raise ValueError("C/I is not set") @@ -779,10 +782,7 @@ class DATAMSG_TRX2L1(DATAMSG): buf.append(mts) # C/I: Carrier-to-Interference ratio (in centiBels) - if not self.nope_ind: - buf += struct.pack(">h", self.ci) - else: - buf += bytearray(2) + buf += struct.pack(">h", self.ci) return buf @@ -799,10 +799,7 @@ class DATAMSG_TRX2L1(DATAMSG): self.parse_mts(hdr[8]) # C/I: Carrier-to-Interference ratio (in centiBels) - if not self.nope_ind: - self.ci = struct.unpack(">h", hdr[9:11])[0] - else: - self.ci = None + self.ci = struct.unpack(">h", hdr[9:11])[0] # Generates message specific burst def gen_burst(self): |