summaryrefslogtreecommitdiffstats
path: root/src/target
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2019-07-24 05:04:36 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2019-07-24 05:44:19 +0700
commit7cde195e30b2259d176b7c913ddda4685592d6a8 (patch)
tree4a505f781c0f88568a49e00670064173573c76ef /src/target
parent88e16205023c1ee2e590639d633f2361cf916f8a (diff)
trx_toolkit/burst_gen.py: basic TRXD header version 1 support
Diffstat (limited to 'src/target')
-rwxr-xr-xsrc/target/trx_toolkit/burst_gen.py31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/target/trx_toolkit/burst_gen.py b/src/target/trx_toolkit/burst_gen.py
index 5f39e6a..a777246 100755
--- a/src/target/trx_toolkit/burst_gen.py
+++ b/src/target/trx_toolkit/burst_gen.py
@@ -5,7 +5,7 @@
# Auxiliary tool to generate and send random bursts via TRX DATA
# interface, which may be useful for fuzzing and testing
#
-# (C) 2017-2018 by Vadim Yanitskiy <axilirator@gmail.com>
+# (C) 2017-2019 by Vadim Yanitskiy <axilirator@gmail.com>
#
# All Rights Reserved
#
@@ -23,7 +23,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-APP_CR_HOLDERS = [("2017-2018", "Vadim Yanitskiy <axilirator@gmail.com>")]
+APP_CR_HOLDERS = [("2017-2019", "Vadim Yanitskiy <axilirator@gmail.com>")]
import logging as log
import signal
@@ -68,9 +68,9 @@ class Application(ApplicationBase):
# Init an empty DATA message
if self.argv.conn_mode == "TRX":
- msg = DATAMSG_L12TRX()
+ msg = DATAMSG_L12TRX(ver = self.argv.hdr_ver)
elif self.argv.conn_mode == "L1":
- msg = DATAMSG_TRX2L1()
+ msg = DATAMSG_TRX2L1(ver = self.argv.hdr_ver)
# Generate a random frame number or use provided one
fn_init = msg.rand_fn() if self.argv.tdma_fn is None \
@@ -102,6 +102,17 @@ class Application(ApplicationBase):
if self.argv.rssi is not None:
msg.rssi = self.argv.rssi
+ if msg.ver >= 0x01:
+ # TODO: Only GMSK and TSC set 0 for now
+ msg.mod_type = Modulation.ModGMSK
+ self.tsc_set = 0
+
+ if self.argv.tsc is not None:
+ msg.tsc = self.argv.tsc
+
+ if self.argv.ci is not None:
+ msg.ci = self.argv.ci
+
# Generate a random burst
if self.argv.burst_type == "NB":
burst = burst_gen.gen_nb()
@@ -163,6 +174,10 @@ class Application(ApplicationBase):
bg_group.add_argument("-c", "--burst-count", metavar = "N",
dest = "burst_count", type = int, default = 1,
help = "How many bursts to send (default %(default)s)")
+ bg_group.add_argument("-v", "--hdr-version", metavar = "VER",
+ dest = "hdr_ver", type = int,
+ default = 0, choices = DATAMSG.known_versions,
+ help = "TRXD header version (default %(default)s)")
bg_group.add_argument("-f", "--frame-number", metavar = "FN",
dest = "tdma_fn", type = int,
help = "Set TDMA frame number (default random)")
@@ -186,6 +201,14 @@ class Application(ApplicationBase):
dest = "toa256", type = int,
help = "Set Timing of Arrival in 1/256 symbol periods")
+ bg_group.add_argument("--tsc", metavar = "TSC",
+ dest = "tsc", type = int, choices = range(0, 8),
+ help = "Set Training Sequence Code (default random)")
+ bg_group.add_argument("--ci", metavar = "CI",
+ dest = "ci", type = int,
+ help = "C/I: Carrier-to-Interference ratio "
+ "in centiBels (default random)")
+
return parser.parse_args()
def sig_handler(self, signum, frame):