Review at  https://gerrit.osmocom.org/6846

Add FAKE_RSSI and FAKE_TIMING commands on BB side

This is useful for testing the measurement processing code in OsmoBTS

Change-Id: Ia23becec4104d47e7b22350db67b8834d6f1ad1b
---
M src/target/fake_trx/burst_fwd.py
M src/target/fake_trx/ctrl_if_bb.py
2 files changed, 21 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/46/6846/1

diff --git a/src/target/fake_trx/burst_fwd.py b/src/target/fake_trx/burst_fwd.py
index 5989ce9..8b04be1 100644
--- a/src/target/fake_trx/burst_fwd.py
+++ b/src/target/fake_trx/burst_fwd.py
@@ -25,6 +25,8 @@
 class BurstForwarder:
        # Timeslot filter (drop everything by default)
        ts_pass = None
+       rssi = 0x35
+       timing = 0
 
        # Freq. filter
        bts_freq = None
@@ -44,11 +46,11 @@
                payload = bytearray(data)
                length = len(payload)
 
-               # HACK: set fake RSSI value (-53)
-               payload[5] = 0x35
+               # set fake RSSI value (-53)
+               payload[5] = self.rssi
 
-               # HACK: add fake TOA value (6th and 7th bytes)
-               payload[6:2] = [0x00, 0x00]
+               # add fake TOA value (6th and 7th bytes)
+               payload[6:2] = [self.timing >> 8, self.timing & 0xff]
 
                # Convert ubits to {255..0}
                for i in range(8, length):
diff --git a/src/target/fake_trx/ctrl_if_bb.py 
b/src/target/fake_trx/ctrl_if_bb.py
index 440094a..f8ad5b4 100644
--- a/src/target/fake_trx/ctrl_if_bb.py
+++ b/src/target/fake_trx/ctrl_if_bb.py
@@ -118,6 +118,21 @@
                                self.burst_fwd.ts_pass = ts
 
                        return 0
+               elif self.verify_cmd(request, "FAKE_RSSI", 1):
+                       print("[i] Recv FAKE_RSSI cmd")
+                       self.burst_fwd.rssi = int(request[1])
+                       # HACK: We don't return a response, as the command is 
typicaly sent
+                       # by another program (test controller) and we don't 
want to confuse
+                       # trxcon with bogus responses
+                       return -1
+
+               elif self.verify_cmd(request, "FAKE_TIMING", 1):
+                       print("[i] Recv FAKE_TIMING cmd")
+                       self.burst_fwd.timing = int(request[1])
+                       # HACK: We don't return a response, as the command is 
typicaly sent
+                       # by another program (test controller) and we don't 
want to confuse
+                       # trxcon with bogus responses
+                       return -1
 
                # Wrong / unknown command
                else:

-- 
To view, visit https://gerrit.osmocom.org/6846
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia23becec4104d47e7b22350db67b8834d6f1ad1b
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: fixeria/trx
Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>

Reply via email to