File gr-iridium-3.7-0003-Option-write-raw-capture-file.patch of Package gr-iridium
From de336afa5e428837ac01ba700ba7118977108e44 Mon Sep 17 00:00:00 2001
From: schneider <schneider@blinkenlichts.net>
Date: Tue, 14 Jul 2020 19:26:07 +0200
Subject: [PATCH] feat(extractor): Option to write a raw capture file
---
apps/iridium-extractor | 6 ++++++
python/iridium_extractor_flowgraph.py | 10 +++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/apps/iridium-extractor b/apps/iridium-extractor
index dc4c03c..8c8e752 100755
--- a/apps/iridium-extractor
+++ b/apps/iridium-extractor
@@ -104,6 +104,7 @@ if __name__ == "__main__":
'downlink',
'decimation',
'multi-frame',
+ 'raw-capture=',
'help'
])
@@ -120,6 +121,7 @@ if __name__ == "__main__":
max_bursts = 0
direction = None
decimation = 1
+ raw_capture_filename = None
handle_multiple_frames_per_burst = False
if len(remainder) == 0 or remainder[0] == '-':
@@ -173,6 +175,8 @@ if __name__ == "__main__":
decimation = int(arg)
elif opt == '--multi-frame':
handle_multiple_frames_per_burst = True
+ elif opt == '--raw-capture':
+ raw_capture_filename = arg
elif opt in ('-h', '--help'):
print >> sys.stderr, "Usage: iridium-extractor [options] <filename>"
print >> sys.stderr, "\t-c frequency\tset center frequency"
@@ -181,6 +185,7 @@ if __name__ == "__main__":
print >> sys.stderr, "\t--offline\tturn on offline mode (don't skip samples)"
print >> sys.stderr, "\t-D num \tturn on decimation (multi-channel decoding) "
print >> sys.stderr, "\t--multi-frame \tturn on multiple frame per burst support "
+ print >> sys.stderr, "\t--raw-capture=filename \tsave raw IQ samples (fc32) to file "
print >> sys.stderr, "\t<filename>\traw sample file"
print >> sys.stderr, ""
print >> sys.stderr, "For more documentation check: https://github.com/muccc/gr-iridium/"
@@ -208,6 +213,7 @@ if __name__ == "__main__":
threshold=threshold, signal_width=search_window,
offline=offline, max_queue_len = max_queue_len,
handle_multiple_frames_per_burst=handle_multiple_frames_per_burst,
+ raw_capture_filename=raw_capture_filename,
max_bursts=max_bursts,
verbose=verbose)
diff --git a/python/iridium_extractor_flowgraph.py b/python/iridium_extractor_flowgraph.py
index 5774cc7..5b36eaf 100755
--- a/python/iridium_extractor_flowgraph.py
+++ b/python/iridium_extractor_flowgraph.py
@@ -16,7 +16,7 @@
class FlowGraph(gr.top_block):
- def __init__(self, center_frequency, sample_rate, decimation, filename, sample_format=None, threshold=7.0, signal_width=40e3, offline=False, max_queue_len=500, handle_multiple_frames_per_burst=False, max_bursts=0, verbose=False):
+ def __init__(self, center_frequency, sample_rate, decimation, filename, sample_format=None, threshold=7.0, signal_width=40e3, offline=False, max_queue_len=500, handle_multiple_frames_per_burst=False, raw_capture_filename=None, max_bursts=0, verbose=False):
gr.top_block.__init__(self, "Top Block")
self._center_frequency = center_frequency
self._burst_width = 40e3
@@ -222,6 +222,14 @@ def match_gain(gain, gain_names):
#self._iridium_qpsk_demod = iridium.iridium_qpsk_demod(250000)
+ if raw_capture_filename:
+ raw_sink = blocks.file_sink(itemsize=gr.sizeof_gr_complex, filename=raw_capture_filename)
+ tb.connect(source, raw_sink)
+ # Enable the following if not fast enough
+ #self._burst_to_pdu_converters = []
+ #self._burst_downmixers = []
+ #return
+
tb.connect(source, self._fft_burst_tagger)
if self._use_pfb: