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

fake_trx/burst_gen.py: also handle RSSI and ToA values

Change-Id: I7c9441c1154c925dcb5c743e39445495233c123e
---
M src/target/fake_trx/burst_gen.py
1 file changed, 29 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/30/6830/1

diff --git a/src/target/fake_trx/burst_gen.py b/src/target/fake_trx/burst_gen.py
index ced2de3..9141b67 100755
--- a/src/target/fake_trx/burst_gen.py
+++ b/src/target/fake_trx/burst_gen.py
@@ -46,9 +46,15 @@
 
        burst_type = None
        burst_count = 1
-       pwr = None
+
+       # Common header fields
        fn = None
        tn = None
+
+       # Message specific header fields
+       rssi = None
+       toa = None
+       pwr = None
 
        def __init__(self):
                self.print_copyright()
@@ -95,7 +101,13 @@
                        if self.pwr is not None:
                                msg.pwr = self.pwr
 
-                       # TODO: also set TRX2L1 specific fields
+                       # Set time of arrival
+                       if self.toa is not None:
+                               msg.toa = self.toa
+
+                       # Set RSSI
+                       if self.rssi is not None:
+                               msg.rssi = self.rssi
 
                        # Generate a random burst
                        if self.burst_type == "NB":
@@ -141,7 +153,9 @@
                         "  -c --burst-count    How much bursts to send 
(default 1)\n"   \
                         "  -f --frame-number   Set frame number (default 
random)\n"     \
                         "  -t --timeslot       Set timeslot index (default 
random)\n"   \
-                        "  -l --power-level    Set transmit level (default 
random)\n"   \
+                        "     --pwr            Set power level (default 
random)\n"      \
+                        "     --rssi           Set RSSI (default random)\n"    
         \
+                        "     --toa            Set TOA (default random)\n\n"
 
                print(s % (self.remote_addr, self.base_port))
 
@@ -151,7 +165,7 @@
        def parse_argv(self):
                try:
                        opts, args = getopt.getopt(sys.argv[1:],
-                               "m:r:p:b:c:f:t:l:h",
+                               "m:r:p:b:c:f:t:h",
                                [
                                        "help",
                                        "conn-mode=",
@@ -161,7 +175,9 @@
                                        "burst-count=",
                                        "frame-number=",
                                        "timeslot=",
-                                       "power-level=",
+                                       "rssi=",
+                                       "toa=",
+                                       "pwr=",
                                ])
                except getopt.GetoptError as err:
                        self.print_help("[!] " + str(err))
@@ -187,8 +203,14 @@
                                self.fn = int(v)
                        elif o in ("-t", "--timeslot"):
                                self.tn = int(v)
-                       elif o in ("-l", "--power-level"):
-                               self.pwr = abs(int(v))
+
+                       # Message specific header fields
+                       elif o == "--pwr":
+                               self.pwr = int(v)
+                       elif o == "--rssi":
+                               self.rssi = int(v)
+                       elif o == "--toa":
+                               self.toa = float(v)
 
        def check_argv(self):
                # Check connection mode

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7c9441c1154c925dcb5c743e39445495233c123e
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>

Reply via email to