fake_trx: Implement RFMUTE TRXC cmd

Change-Id: I67d16858cd70cb0527c1da77bd3787d5e53100b4
This commit is contained in:
Pau Espin 2020-08-26 17:45:35 +02:00
parent 7fbbda6108
commit 1687d3dea3
4 changed files with 20 additions and 2 deletions

View File

@ -50,6 +50,10 @@ class BurstForwarder(TRXList):
# so let's precalculate its Tx frequency in advance
tx_freq = src_trx.get_tx_freq(rx_msg.fn)
if src_trx.rf_muted:
del rx_msg.burst # burst bits are omited
rx_msg.burst = None
# Iterate over all known transceivers
for trx in self.trx_list:
if trx == src_trx:

View File

@ -251,6 +251,13 @@ class CTRLInterfaceTRX(CTRLInterface):
log.debug("(%s) Recv NOMTXPOWER cmd" % self.trx)
return (0, [str(self.trx.tx_power_base)])
# Lock/Unlock RF emission+reception
if self.verify_cmd(request, "RFMUTE", 1):
log.debug("(%s) Recv RFMUTE cmd" % self.trx)
# Parse the requested RFMUTE state (1=locked, 0=unlocked)
self.trx.rf_muted = int(request[1]) > 0
return 0
# Wrong / unknown command
else:
# We don't care about other commands,

View File

@ -413,6 +413,8 @@ class DATAMSG_L12TRX(DATAMSG):
# Convert burst bits
if self.burst is not None:
msg.burst = self.ubit2sbit(self.burst)
else:
msg.nope_ind = True
return msg

View File

@ -125,6 +125,8 @@ class FakeTRX(Transceiver):
# When disabled, RSSI is calculated based on Tx power and Rx path loss
self.fake_rssi_enabled = False
self.rf_muted = False
# Actual ToA, RSSI, C/I, TA values
self.tx_power_base = self.NOMINAL_TX_POWER_DEFAULT
self.tx_att_base = self.TX_ATT_DEFAULT
@ -215,8 +217,11 @@ 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 self.rf_muted:
msg.nope_ind = True
elif not msg.nope_ind:
# 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: