From 5ab622d2b72ac6df9d71d42736a6a65ac76cfab5 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 22 Feb 2018 22:24:19 +0100 Subject: fake_trx/ctrl_if_(bb|bts).py: add FAKE_TOA command FAKE_TOA is an auxilary CTRL command, which may be used to update the ToA (Timing of Arrival) value of forwarded bursts at runtime. This is useful for testing the measurement processing code in OsmoBTS. The command is implemented for both BTS and BB CTRL interfaces in two absolute and relative forms: CMD FAKE_TOA CMD FAKE_TOA <+-BASE_DELTA> The first form overwrites both ToA value and its treshold. The second one is relative, and applies a delta to the current ToA value. The command affects Downlink bursts if sent on BTS CTRL interface, and Uplink bursts if sent on the BB CTRL. Change-Id: Ia23becec4104d47e7b22350db67b8834d6f1ad1b --- src/target/fake_trx/ctrl_if_bb.py | 23 +++++++++++++++++++++++ src/target/fake_trx/ctrl_if_bts.py | 23 +++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/src/target/fake_trx/ctrl_if_bb.py b/src/target/fake_trx/ctrl_if_bb.py index 74fb242e..c4d879c0 100644 --- a/src/target/fake_trx/ctrl_if_bb.py +++ b/src/target/fake_trx/ctrl_if_bb.py @@ -129,6 +129,29 @@ class CTRLInterfaceBB(CTRLInterface): self.burst_fwd.ta = ta return 0 + # Timing of Arrival simulation for Uplink + # Absolute form: CMD FAKE_TOA + elif self.verify_cmd(request, "FAKE_TOA", 2): + print("[i] Recv FAKE_TOA cmd") + + # Parse and apply both base and threshold + self.burst_fwd.toa256_ul_base = int(request[1]) + self.burst_fwd.toa256_ul_threshold = int(request[2]) + + # TODO: avoid sending response + return -1 + + # Timing of Arrival simulation for Uplink + # Relative form: CMD FAKE_TOA <+-BASE_DELTA> + elif self.verify_cmd(request, "FAKE_TOA", 1): + print("[i] Recv FAKE_TOA cmd") + + # Parse and apply delta + self.burst_fwd.toa256_ul_base += int(request[1]) + + # TODO: avoid sending response + return -1 + # Wrong / unknown command else: # We don't care about other commands, diff --git a/src/target/fake_trx/ctrl_if_bts.py b/src/target/fake_trx/ctrl_if_bts.py index 92a4abb2..f27b87d2 100644 --- a/src/target/fake_trx/ctrl_if_bts.py +++ b/src/target/fake_trx/ctrl_if_bts.py @@ -97,6 +97,29 @@ class CTRLInterfaceBTS(CTRLInterface): self.burst_fwd.bts_freq = self.tx_freq return 0 + # Timing of Arrival simulation for Downlink + # Absolute form: CMD FAKE_TOA + elif self.verify_cmd(request, "FAKE_TOA", 2): + print("[i] Recv FAKE_TOA cmd") + + # Parse and apply both base and threshold + self.burst_fwd.toa256_dl_base = int(request[1]) + self.burst_fwd.toa256_dl_threshold = int(request[2]) + + # TODO: avoid sending response + return -1 + + # Timing of Arrival simulation for Downlink + # Relative form: CMD FAKE_TOA <+-BASE_DELTA> + elif self.verify_cmd(request, "FAKE_TOA", 1): + print("[i] Recv FAKE_TOA cmd") + + # Parse and apply delta + self.burst_fwd.toa256_dl_base += int(request[1]) + + # TODO: avoid sending response + return -1 + # Wrong / unknown command else: # We don't care about other commands, -- cgit v1.2.3