summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-08-26 17:45:35 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2020-08-26 18:04:57 +0200
commit1687d3dea30ac118724f5c5a0572d0a2a8954965 (patch)
treefff93e656183aeb73ed9bddc0f03c04518a3b7d6
parent7fbbda610828377fe328ad6dcef80ae05ada9ff0 (diff)
fake_trx: Implement RFMUTE TRXC cmdHEADpespin/mutemaster
-rw-r--r--src/target/trx_toolkit/burst_fwd.py4
-rw-r--r--src/target/trx_toolkit/ctrl_if_trx.py7
-rw-r--r--src/target/trx_toolkit/data_msg.py2
-rwxr-xr-xsrc/target/trx_toolkit/fake_trx.py9
4 files changed, 20 insertions, 2 deletions
diff --git a/src/target/trx_toolkit/burst_fwd.py b/src/target/trx_toolkit/burst_fwd.py
index dbaded61..0b69fe2a 100644
--- a/src/target/trx_toolkit/burst_fwd.py
+++ b/src/target/trx_toolkit/burst_fwd.py
@@ -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:
diff --git a/src/target/trx_toolkit/ctrl_if_trx.py b/src/target/trx_toolkit/ctrl_if_trx.py
index 0e5106a8..ea08e7e5 100644
--- a/src/target/trx_toolkit/ctrl_if_trx.py
+++ b/src/target/trx_toolkit/ctrl_if_trx.py
@@ -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,
diff --git a/src/target/trx_toolkit/data_msg.py b/src/target/trx_toolkit/data_msg.py
index 88376ed7..86670fc1 100644
--- a/src/target/trx_toolkit/data_msg.py
+++ b/src/target/trx_toolkit/data_msg.py
@@ -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
diff --git a/src/target/trx_toolkit/fake_trx.py b/src/target/trx_toolkit/fake_trx.py
index ded8dc4d..6f464737 100755
--- a/src/target/trx_toolkit/fake_trx.py
+++ b/src/target/trx_toolkit/fake_trx.py
@@ -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: