[PATCH] osmocom-bb[master]: fake_trx/burst_send.py: also handle RSSI and ToA values

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Feb 22 15:33:42 UTC 2018


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

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

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


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/31/6831/1

diff --git a/src/target/fake_trx/burst_send.py b/src/target/fake_trx/burst_send.py
index 4dbe984..7367925 100755
--- a/src/target/fake_trx/burst_send.py
+++ b/src/target/fake_trx/burst_send.py
@@ -43,9 +43,15 @@
 	conn_mode = "TRX"
 
 	burst_src = None
-	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()
@@ -108,7 +114,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
 
 			# Parse a string
 			for bit in burst_str:
@@ -153,7 +165,9 @@
 			 "  -i --burst-file     Read bursts from file (default stdin)\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))
 
@@ -163,7 +177,7 @@
 	def parse_argv(self):
 		try:
 			opts, args = getopt.getopt(sys.argv[1:],
-				"m:r:p:i:f:t:l:h",
+				"m:r:p:i:f:t:h",
 				[
 					"help",
 					"conn-mode=",
@@ -172,7 +186,9 @@
 					"burst-file=",
 					"frame-number=",
 					"timeslot=",
-					"power-level=",
+					"rssi=",
+					"toa=",
+					"pwr=",
 				])
 		except getopt.GetoptError as err:
 			self.print_help("[!] " + str(err))
@@ -196,8 +212,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 shutdown(self):
 		self.data_if.shutdown()

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idb9a5ae4a8980a320f6e620c66add7c7393d3ecb
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>


More information about the gerrit-log mailing list