trx_toolkit/fake_trx.py: send NOPE.ind in case of path loss simulation

Since TRXD header version 1, we should send NOPE indications to the
L1 side in absence of TRX2L1 bursts, and IDLE indications during
IDLE TDMA frames (basically noise measurements).

This change is the first step towards the goal: if a given burst
is to be dropped due to the path loss simulation (see FAKE_DROP),
mark the carrier TRX2L1 message as NOPE.ind and send anyway.

Change-Id: Iabd0af665e3108d23a908638f943a5b689986e2c
Related: OS#3428, OS#2975
This commit is contained in:
Vadim Yanitskiy 2019-11-17 16:36:35 +07:00 committed by laforge
parent 7108c28c38
commit ae8e5ad648
1 changed files with 25 additions and 7 deletions

View File

@ -110,6 +110,11 @@ class FakeTRX(Transceiver):
RSSI_BASE_DEFAULT = -60
CI_BASE_DEFAULT = 90
# Default values for NOPE / IDLE indications
TOA256_NOISE_DEFAULT = 0
RSSI_NOISE_DEFAULT = -110
CI_NOISE_DEFAULT = -30
def __init__(self, *trx_args, **trx_kwargs):
Transceiver.__init__(self, *trx_args, **trx_kwargs)
@ -177,9 +182,6 @@ class FakeTRX(Transceiver):
return False
def _handle_data_msg_v1(self, src_msg, msg):
# TODO: NOPE indications are not (yet) supported
msg.nope_ind = False
# C/I (Carrier-to-Interference ratio)
msg.ci = self.ci
@ -200,6 +202,26 @@ class FakeTRX(Transceiver):
# simulates RF path parameters (such as RSSI),
# and sends towards the L1
def handle_data_msg(self, src_trx, src_msg, msg):
# Path loss simulation
msg.nope_ind = self.sim_burst_drop(msg)
if msg.nope_ind:
# Before TRXDv1, we simply drop the message
if msg.ver < 0x01:
del msg
return
# Since TRXDv1, we should send a NOPE.ind
del msg.burst # burst bits are omited
msg.burst = None
# TODO: shoud we make these values configurable?
msg.toa256 = self.TOA256_NOISE_DEFAULT
msg.rssi = self.RSSI_NOISE_DEFAULT
msg.ci = self.CI_NOISE_DEFAULT
self.data_if.send_msg(msg)
return
# Complete message header
msg.toa256 = self.toa256
msg.rssi = self.rssi
@ -212,10 +234,6 @@ class FakeTRX(Transceiver):
if src_trx.ta != 0:
msg.toa256 -= src_trx.ta * 256
# Path loss simulation
if self.sim_burst_drop(msg):
return
# TODO: make legacy mode configurable (via argv?)
self.data_if.send_msg(msg, legacy = True)