summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2018-02-20 18:19:48 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2018-02-20 18:19:48 +0700
commit711e2f256e125398cca69b841493d3063389cef1 (patch)
tree7e3bb1004af03eeebee97b90be37a4fae6b49c57
parent3dfd6cbae5b81f287bd95940330458ef1fd8d653 (diff)
fake_trx/burst_gen.py: add burst capture support
Now all generated bursts can be also written to a capture file, using a new option called '--output-file'. If a file already exists, bursts would be appended to the end. Otherwise a new capture file is created. Change-Id: I074ff7dbc4d6beecdecce20de9dade5939e707f2
-rwxr-xr-xsrc/target/fake_trx/burst_gen.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/target/fake_trx/burst_gen.py b/src/target/fake_trx/burst_gen.py
index 9141b674..9f366874 100755
--- a/src/target/fake_trx/burst_gen.py
+++ b/src/target/fake_trx/burst_gen.py
@@ -27,6 +27,7 @@ import getopt
import sys
from rand_burst_gen import RandBurstGen
+from data_dump import DATADumpFile
from data_if import DATAInterface
from gsm_shared import *
from data_msg import *
@@ -43,6 +44,7 @@ class Application:
remote_addr = "127.0.0.1"
base_port = 5700
conn_mode = "TRX"
+ output_file = None
burst_type = None
burst_count = 1
@@ -64,6 +66,10 @@ class Application:
# Set up signal handlers
signal.signal(signal.SIGINT, self.sig_handler)
+ # Open requested capture file
+ if self.output_file is not None:
+ self.ddf = DATADumpFile(self.output_file)
+
def run(self):
# Init DATA interface with TRX or L1
if self.conn_mode == "TRX":
@@ -133,6 +139,10 @@ class Application:
# Send message
self.data_if.send_msg(msg)
+ # Append a new message to the capture
+ if self.output_file is not None:
+ self.ddf.append_msg(msg)
+
self.shutdown()
def print_copyright(self):
@@ -144,6 +154,7 @@ class Application:
" -h --help this text\n\n"
s += " TRX interface specific\n" \
+ " -o --output-file Write bursts to a capture file\n" \
" -m --conn-mode Send bursts to: TRX (default) / L1\n" \
" -r --remote-addr Set remote address (default %s)\n" \
" -p --base-port Set base port number (default %d)\n\n"
@@ -165,9 +176,10 @@ class Application:
def parse_argv(self):
try:
opts, args = getopt.getopt(sys.argv[1:],
- "m:r:p:b:c:f:t:h",
+ "o:m:r:p:b:c:f:t:h",
[
"help",
+ "output-file="
"conn-mode=",
"remote-addr=",
"base-port=",
@@ -188,6 +200,8 @@ class Application:
self.print_help()
sys.exit(2)
+ elif o in ("-o", "--output-file"):
+ self.output_file = v
elif o in ("-m", "--conn-mode"):
self.conn_mode = v
elif o in ("-r", "--remote-addr"):