From 77d695f2efaa5b7b14dc02870a42746056b55295 Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Tue, 16 Apr 2013 19:23:53 -0700 Subject: [PATCH] First stab at interrogation uplink processing. Getting bits, inefficiently. --- apps/modes_rx | 2 +- include/gr_air_modes/CMakeLists.txt | 1 + lib/CMakeLists.txt | 1 + python/__init__.py | 2 +- python/rx_path.py | 43 +++++++++++++++++++++++++++++ swig/air_modes.i | 2 ++ 6 files changed, 49 insertions(+), 2 deletions(-) diff --git a/apps/modes_rx b/apps/modes_rx index 24de121..994fc8b 100755 --- a/apps/modes_rx +++ b/apps/modes_rx @@ -93,7 +93,7 @@ def main(): if options.kml is not None: kmlgen.close() - + if __name__ == '__main__': main() diff --git a/include/gr_air_modes/CMakeLists.txt b/include/gr_air_modes/CMakeLists.txt index 09254ca..6e70907 100644 --- a/include/gr_air_modes/CMakeLists.txt +++ b/include/gr_air_modes/CMakeLists.txt @@ -25,5 +25,6 @@ install(FILES slicer.h types.h api.h + uplink.h DESTINATION include/gr_air_modes ) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index e3bd53a..c2b5b5e 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -26,6 +26,7 @@ add_library(air_modes SHARED preamble_impl.cc slicer_impl.cc modes_crc.cc + uplink_impl.cc ) target_link_libraries(air_modes ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES}) set_target_properties(air_modes PROPERTIES DEFINE_SYMBOL "AIR_MODES_EXPORTS") diff --git a/python/__init__.py b/python/__init__.py index 29e0475..d46e95c 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -51,7 +51,7 @@ from air_modes_swig import * # import any pure python here # -from rx_path import rx_path +from rx_path import rx_path, uplink_rx_path from zmq_socket import zmq_pubsub_iface from parse import * from msprint import output_print diff --git a/python/rx_path.py b/python/rx_path.py index 36350c2..b62f67c 100644 --- a/python/rx_path.py +++ b/python/rx_path.py @@ -86,3 +86,46 @@ class rx_path(gr.hier_block2): def get_threshold(self, threshold): return self._sync.get_threshold() +class uplink_rx_path(gr.hier_block2): + def __init__(self, rate, threshold, queue, use_pmf=False, use_dcblock=False): + gr.hier_block2.__init__(self, "modes_uplink_rx_path", + gr.io_signature(1, 1, gr.sizeof_gr_complex), + gr.io_signature(0,0,0)) + + self._rate = int(rate) + self._threshold = threshold + self._queue = queue + self._spc = int(rate/4e6) + + #demodulate DPSK via delay + self._delay = gr.delay(gr.sizeof_gr_complex, self._spc) + self._mult = gr.multiply_cc() + self._conj = gr.conjugate_cc() + self._c2r = gr.complex_to_real() + #self._bb = self._demod + + self.filesink = gr.file_sink(gr.sizeof_float, "wat.dat") + + # Pulse matched filter for 0.25us pulses +# if use_pmf: +# self._pmf = gr.moving_average_ff(self._spc, 1.0/self._spc, self._rate) +# self.connect(self._demod, self._pmf) +# self._bb = self._pmf + + # Establish baseline amplitude (noise, interference) + self._avg = gr.moving_average_ff(48*self._spc, 1.0/(48*self._spc), self._rate) # 3 preambles + + # Synchronize to uplink preamble + self._sync = air_modes_swig.modes_uplink(self._rate, self._threshold) + + # Slice Mode-S bits and send to message queue +# self._slicer = air_modes_swig.modes_slicer(self._rate, self._queue) + + # Wire up the flowgraph + self.connect(self, (self._mult, 0)) + self.connect(self, self._delay, self._conj, (self._mult, 1)) + self.connect(self._mult, self._c2r) + self.connect(self._c2r, (self._sync, 0)) + self.connect(self._c2r, self._avg, (self._sync, 1)) +# self.connect(self._sync, self._slicer) + self.connect(self._sync, self.filesink) diff --git a/swig/air_modes.i b/swig/air_modes.i index 6f5a42b..4ae26f3 100644 --- a/swig/air_modes.i +++ b/swig/air_modes.i @@ -11,7 +11,9 @@ %include "gr_air_modes/preamble.h" %include "gr_air_modes/slicer.h" +%include "gr_air_modes/uplink.h" GR_SWIG_BLOCK_MAGIC2(air_modes,preamble); GR_SWIG_BLOCK_MAGIC2(air_modes,slicer); +GR_SWIG_BLOCK_MAGIC2(air_modes,uplink);