Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df35c92fe2 |
@@ -75,15 +75,6 @@ if(NOT GNURADIO_RUNTIME_FOUND)
|
||||
message(FATAL_ERROR "GnuRadio Runtime required to compile gr-air-modes")
|
||||
endif()
|
||||
|
||||
########################################################################
|
||||
# Find PyZMQ bindings
|
||||
########################################################################
|
||||
include(GrPython)
|
||||
GR_PYTHON_CHECK_MODULE("PyZMQ" "zmq" "int(zmq.__version__.split('.')[0]) >= 13" PYZMQ_FOUND)
|
||||
if(NOT PYZMQ_FOUND)
|
||||
message(FATAL_ERROR "Python ZMQ bindings not found.")
|
||||
endif()
|
||||
|
||||
########################################################################
|
||||
# Setup the include and linker paths
|
||||
########################################################################
|
||||
|
||||
@@ -1,36 +1,6 @@
|
||||
INCLUDE(FindPkgConfig)
|
||||
PKG_CHECK_MODULES(PC_GNURADIO_RUNTIME gnuradio-runtime)
|
||||
|
||||
if(PC_GNURADIO_RUNTIME_FOUND)
|
||||
# look for include files
|
||||
FIND_PATH(
|
||||
GNURADIO_RUNTIME_INCLUDE_DIRS
|
||||
NAMES gnuradio/top_block.h
|
||||
HINTS $ENV{GNURADIO_RUNTIME_DIR}/include
|
||||
${PC_GNURADIO_RUNTIME_INCLUDE_DIRS}
|
||||
${CMAKE_INSTALL_PREFIX}/include
|
||||
PATHS /usr/local/include
|
||||
/usr/include
|
||||
)
|
||||
|
||||
# look for libs
|
||||
FIND_LIBRARY(
|
||||
GNURADIO_RUNTIME_LIBRARIES
|
||||
NAMES gnuradio-runtime
|
||||
HINTS $ENV{GNURADIO_RUNTIME_DIR}/lib
|
||||
${PC_GNURADIO_RUNTIME_LIBDIR}
|
||||
${CMAKE_INSTALL_PREFIX}/lib/
|
||||
${CMAKE_INSTALL_PREFIX}/lib64/
|
||||
PATHS /usr/local/lib
|
||||
/usr/local/lib64
|
||||
/usr/lib
|
||||
/usr/lib64
|
||||
)
|
||||
|
||||
set(GNURADIO_RUNTIME_FOUND ${PC_GNURADIO_RUNTIME_FOUND})
|
||||
endif(PC_GNURADIO_RUNTIME_FOUND)
|
||||
PKG_CHECK_MODULES(GNURADIO_RUNTIME gnuradio-runtime)
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
# do not check GNURADIO_RUNTIME_INCLUDE_DIRS, is not set when default include path us used.
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_RUNTIME DEFAULT_MSG GNURADIO_RUNTIME_LIBRARIES)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_RUNTIME DEFAULT_MSG GNURADIO_RUNTIME_LIBRARIES GNURADIO_RUNTIME_INCLUDE_DIRS)
|
||||
MARK_AS_ADVANCED(GNURADIO_RUNTIME_LIBRARIES GNURADIO_RUNTIME_INCLUDE_DIRS)
|
||||
|
||||
56
cmake/Modules/FindZeroMQ.cmake
Normal file
56
cmake/Modules/FindZeroMQ.cmake
Normal file
@@ -0,0 +1,56 @@
|
||||
# - Find zeromq libraries
|
||||
# This module finds zeromq if it is installed and determines where the
|
||||
# include files and libraries are. It also determines what the name of
|
||||
# the library is. This code sets the following variables:
|
||||
#
|
||||
# ZEROMQ_FOUND - have the zeromq libs been found
|
||||
# ZEROMQ_LIBRARIES - path to the zeromq library
|
||||
# ZEROMQ_INCLUDE_DIRS - path to where zmq.h is found
|
||||
# ZEROMQ_DEBUG_LIBRARIES - path to the debug library
|
||||
|
||||
#INCLUDE(CMakeFindFrameworks)
|
||||
# Search for the zeromq framework on Apple.
|
||||
#CMAKE_FIND_FRAMEWORKS(ZeroMQ)
|
||||
|
||||
IF(WIN32)
|
||||
FIND_LIBRARY(ZEROMQ_DEBUG_LIBRARY
|
||||
NAMES libzmq_d zmq_d
|
||||
PATHS
|
||||
${ZEROMQ_LIBRARIES}
|
||||
)
|
||||
ENDIF(WIN32)
|
||||
|
||||
FIND_LIBRARY(ZEROMQ_LIBRARY
|
||||
NAMES libzmq zmq
|
||||
PATHS
|
||||
${ZEROMQ_LIBRARIES}
|
||||
${NSCP_LIBRARYDIR}
|
||||
)
|
||||
|
||||
# IF(ZeroMQ_FRAMEWORKS AND NOT ZEROMQ_INCLUDE_DIR)
|
||||
# FOREACH(dir ${ZeroMQ_FRAMEWORKS})
|
||||
# SET(ZEROMQ_FRAMEWORK_INCLUDES ${ZEROMQ_FRAMEWORK_INCLUDES}
|
||||
# ${dir}/Versions/${_CURRENT_VERSION}/include/zeromq${_CURRENT_VERSION})
|
||||
# ENDFOREACH(dir)
|
||||
# ENDIF(ZeroMQ_FRAMEWORKS AND NOT ZEROMQ_INCLUDE_DIR)
|
||||
|
||||
FIND_PATH(ZEROMQ_INCLUDE_DIR
|
||||
NAMES zmq.hpp
|
||||
PATHS
|
||||
# ${ZEROMQ_FRAMEWORK_INCLUDES}
|
||||
${ZEROMQ_INCLUDE_DIRS}
|
||||
${NSCP_INCLUDEDIR}
|
||||
${ZEROMQ_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
ZEROMQ_DEBUG_LIBRARY
|
||||
ZEROMQ_LIBRARY
|
||||
ZEROMQ_INCLUDE_DIR
|
||||
)
|
||||
SET(ZEROMQ_INCLUDE_DIRS "${ZEROMQ_INCLUDE_DIR}")
|
||||
SET(ZEROMQ_LIBRARIES "${ZEROMQ_LIBRARY}")
|
||||
SET(ZEROMQ_DEBUG_LIBRARIES "${ZEROMQ_DEBUG_LIBRARY}")
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZeroMQ DEFAULT_MSG ZEROMQ_LIBRARIES ZEROMQ_INCLUDE_DIRS)
|
||||
@@ -33,6 +33,7 @@ import zmq
|
||||
import threading
|
||||
import time
|
||||
import re
|
||||
import fractions
|
||||
|
||||
class modes_radio (gr.top_block, pubsub):
|
||||
def __init__(self, options, context):
|
||||
@@ -44,6 +45,8 @@ class modes_radio (gr.top_block, pubsub):
|
||||
|
||||
self._resample = None
|
||||
self._setup_source(options)
|
||||
if self._resample is not None:
|
||||
self._rate = 4.0e6 #fixed rate we resample to in RTL case
|
||||
|
||||
self._rx_path = air_modes.rx_path(self._rate, options.threshold,
|
||||
self._queue, options.pmf, options.dcblock)
|
||||
@@ -172,13 +175,14 @@ class modes_radio (gr.top_block, pubsub):
|
||||
self._u.set_gain(options.gain)
|
||||
print "Gain is %i" % self._u.get_gain()
|
||||
|
||||
#TODO: detect if you're using an RTLSDR or Jawbreaker
|
||||
#and set up accordingly.
|
||||
elif options.source == "osmocom": #RTLSDR dongle or HackRF Jawbreaker
|
||||
import osmosdr
|
||||
self._u = osmosdr.source(options.args)
|
||||
# self._u.set_sample_rate(3.2e6) #fixed for RTL dongles
|
||||
rates = self._u.get_sample_rates()
|
||||
|
||||
self._u.set_sample_rate(options.rate)
|
||||
actual_rate = int(self._u.get_sample_rate())
|
||||
|
||||
if not self._u.set_center_freq(options.freq):
|
||||
print "Failed to set initial frequency"
|
||||
|
||||
@@ -188,9 +192,14 @@ class modes_radio (gr.top_block, pubsub):
|
||||
self._u.set_gain(options.gain)
|
||||
print "Gain is %i" % self._u.get_gain()
|
||||
|
||||
#Note: this should only come into play if using an RTLSDR.
|
||||
# lpfiltcoeffs = gr.firdes.low_pass(1, 5*3.2e6, 1.6e6, 300e3)
|
||||
# self._resample = filter.rational_resampler_ccf(interpolation=5, decimation=4, taps=lpfiltcoeffs)
|
||||
if actual_rate < 4.0e6:
|
||||
gcd = fractions.gcd(4.0e6, actual_rate)
|
||||
interp = 4.0e6 / gcd
|
||||
decim = actual_rate / gcd
|
||||
lpfiltcoeffs = filter.firdes.low_pass(1, interp*actual_rate, 1.6e6, 300e3)
|
||||
self._resample = filter.rational_resampler_ccf(interpolation=interp,
|
||||
decimation=decim,
|
||||
taps=lpfiltcoeffs)
|
||||
|
||||
else:
|
||||
#semantically detect whether it's ip.ip.ip.ip:port or filename
|
||||
@@ -205,7 +214,7 @@ class modes_radio (gr.top_block, pubsub):
|
||||
self._u = blocks.file_source(gr.sizeof_gr_complex, options.source)
|
||||
print "Using file source %s" % options.source
|
||||
|
||||
print "Rate is %i" % (options.rate,)
|
||||
print "Rate is %i" % actual_rate
|
||||
|
||||
def close(self):
|
||||
self._sender.close()
|
||||
|
||||
Reference in New Issue
Block a user