diff --git a/CMakeLists.txt b/CMakeLists.txt index c5c5373..5fa14e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,6 +116,18 @@ link_directories( set(GR_GR-AIR-MODES_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE INTERNAL "" FORCE) set(GR_GR-AIR-MODES_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/swig CACHE INTERNAL "" FORCE) +######################################################################## +# Create uninstall target +######################################################################## +configure_file( + ${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake +@ONLY) + +add_custom_target(uninstall + ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake +) + ######################################################################## # Add subdirectories ######################################################################## diff --git a/apps/modes_gui b/apps/modes_gui index 8182aa3..86b4632 100755 --- a/apps/modes_gui +++ b/apps/modes_gui @@ -409,23 +409,15 @@ class adsb_rx_block (gr.top_block): else: raise NotImplementedError - self.demod = gr.complex_to_mag() - self.avg = gr.moving_average_ff(100, 1.0/100, 400) - - self.preamble = air_modes.modes_preamble(int(rate), float(options["threshold"])) - self.slicer = air_modes.modes_slicer(int(rate), queue) + self.rx_path = air_modes.rx_path(rate, options["threshold"], queue) if use_resampler: self.lpfiltcoeffs = gr.firdes.low_pass(1, 5*3.2e6, 1.6e6, 300e3) self.resample = blks2.rational_resampler_ccf(interpolation=5, decimation=4, taps=self.lpfiltcoeffs) - self.connect(self.u, self.resample, self.demod) + self.connect(self.u, self.resample, self.rx_path) else: - self.connect(self.u, self.demod) + self.connect(self.u, self.rx_path) - self.connect(self.demod, self.avg) - self.connect(self.demod, (self.preamble, 0)) - self.connect(self.avg, (self.preamble, 1)) - self.connect(self.preamble, self.slicer) if __name__ == '__main__': app = QtGui.QApplication(sys.argv) diff --git a/apps/modes_rx b/apps/modes_rx index 9eba395..ff582f3 100755 --- a/apps/modes_rx +++ b/apps/modes_rx @@ -110,24 +110,14 @@ class adsb_rx_block (gr.top_block): if options.output_all : pass_all = 1 - self.demod = gr.complex_to_mag() - self.avg = gr.moving_average_ff(100, 1.0/100, 400) - - self.preamble = air_modes.modes_preamble(rate, options.threshold) - #self.framer = air_modes.modes_framer(rate) - self.slicer = air_modes.modes_slicer(rate, queue) + self.rx_path = air_modes.rx_path(rate, options.threshold, queue) if use_resampler: self.lpfiltcoeffs = gr.firdes.low_pass(1, 5*3.2e6, 1.6e6, 300e3) self.resample = blks2.rational_resampler_ccf(interpolation=5, decimation=4, taps=self.lpfiltcoeffs) - self.connect(self.u, self.resample, self.demod) + self.connect(self.u, self.resample, self.rx_path) else: - self.connect(self.u, self.demod) - - self.connect(self.demod, self.avg) - self.connect(self.demod, (self.preamble, 0)) - self.connect(self.avg, (self.preamble, 1)) - self.connect((self.preamble, 0), (self.slicer, 0)) + self.connect(self.u, self.rx_path) def tune(self, freq): result = self.u.set_center_freq(freq, 0) diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in new file mode 100644 index 0000000..9ae1ae4 --- /dev/null +++ b/cmake/cmake_uninstall.cmake.in @@ -0,0 +1,32 @@ +# http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F + +IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") +ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + +FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +STRING(REGEX REPLACE "\n" ";" files "${files}") +FOREACH(file ${files}) + MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") + IF(EXISTS "$ENV{DESTDIR}${file}") + EXEC_PROGRAM( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + IF(NOT "${rm_retval}" STREQUAL 0) + MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + ENDIF(NOT "${rm_retval}" STREQUAL 0) + ELSEIF(IS_SYMLINK "$ENV{DESTDIR}${file}") + EXEC_PROGRAM( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + IF(NOT "${rm_retval}" STREQUAL 0) + MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + ENDIF(NOT "${rm_retval}" STREQUAL 0) + ELSE(EXISTS "$ENV{DESTDIR}${file}") + MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") + ENDIF(EXISTS "$ENV{DESTDIR}${file}") +ENDFOREACH(file) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 98444b7..d620f56 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -41,6 +41,7 @@ GR_PYTHON_INSTALL( parse.py msprint.py raw_server.py + rx_path.py sbs1.py sql.py Quaternion.py diff --git a/python/__init__.py b/python/__init__.py index 045e4c7..9fc740f 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -51,6 +51,7 @@ from air_modes_swig import * # import any pure python here # +from rx_path import rx_path from parse import parse,modes_reply from msprint import output_print from sql import output_sql diff --git a/python/rx_path.py b/python/rx_path.py new file mode 100644 index 0000000..09d9a2f --- /dev/null +++ b/python/rx_path.py @@ -0,0 +1,50 @@ +# +# Copyright 2012 Corgan Labs +# +# This file is part of gr-air-modes +# +# gr-air-modes is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# gr-air-modes is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with gr-air-modes; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +from gnuradio import gr +import air_modes_swig + +class rx_path(gr.hier_block2): + + def __init__(self, rate, threshold, queue): + gr.hier_block2.__init__(self, "modes_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 + + # Convert incoming I/Q baseband to amplitude + self._demod = gr.complex_to_mag() + + # Establish baseline amplitude (noise, interference) + self._avg = gr.moving_average_ff(100, 1.0/100, 400) # FIXME + + # Synchronize to Mode-S preamble + self._sync = air_modes_swig.modes_preamble(self._rate, self._threshold) + + # Slice Mode-S bits and send to message queue + self._slicer = air_modes_swig.modes_slicer(self._rate, self._queue) + + self.connect(self, self._demod, (self._sync, 0)) + self.connect(self._demod, self._avg, (self._sync, 1)) + self.connect(self._sync, self._slicer)