Merge branch 'gr3.7' into mapview

Conflicts:
	python/radio.py
This commit is contained in:
Nick Foster 2013-07-17 21:42:48 -07:00
commit 37aa74fbe0
14 changed files with 82 additions and 162 deletions

View File

@ -69,23 +69,10 @@ set(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks)
######################################################################## ########################################################################
# Find gnuradio build dependencies # Find gnuradio build dependencies
######################################################################## ########################################################################
find_package(Gruel) find_package(GnuradioRuntime)
find_package(GnuradioCore)
if(NOT GRUEL_FOUND) if(NOT GNURADIO_RUNTIME_FOUND)
message(FATAL_ERROR "Gruel required to compile gr-air-modes") message(FATAL_ERROR "GnuRadio Runtime required to compile gr-air-modes")
endif()
if(NOT GNURADIO_CORE_FOUND)
message(FATAL_ERROR "GnuRadio Core required to compile gr-air-modes")
endif()
########################################################################
# Find 0MQ networking library
########################################################################
find_package(ZeroMQ)
if(NOT ZEROMQ_FOUND)
message(FATAL_ERROR "Could not find required library libzmq (ZeroMQ).")
endif() endif()
######################################################################## ########################################################################
@ -94,14 +81,12 @@ endif()
include_directories( include_directories(
${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/include
${Boost_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}
${GRUEL_INCLUDE_DIRS} ${GNURADIO_RUNTIME_INCLUDE_DIRS}
${GNURADIO_CORE_INCLUDE_DIRS}
) )
link_directories( link_directories(
${Boost_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS}
${GRUEL_LIBRARY_DIRS} ${GNURADIO_RUNTIME_LIBRARY_DIRS}
${GNURADIO_CORE_LIBRARY_DIRS}
) )
# Set component parameters # Set component parameters

View File

@ -1,26 +0,0 @@
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(PC_GNURADIO_CORE gnuradio-core)
FIND_PATH(
GNURADIO_CORE_INCLUDE_DIRS
NAMES gr_random.h
HINTS $ENV{GNURADIO_CORE_DIR}/include/gnuradio
${PC_GNURADIO_CORE_INCLUDEDIR}
PATHS /usr/local/include/gnuradio
/usr/include/gnuradio
)
FIND_LIBRARY(
GNURADIO_CORE_LIBRARIES
NAMES gnuradio-core
HINTS $ENV{GNURADIO_CORE_DIR}/lib
${PC_GNURADIO_CORE_LIBDIR}
PATHS /usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_CORE DEFAULT_MSG GNURADIO_CORE_LIBRARIES GNURADIO_CORE_INCLUDE_DIRS)
MARK_AS_ADVANCED(GNURADIO_CORE_LIBRARIES GNURADIO_CORE_INCLUDE_DIRS)

View File

@ -0,0 +1,6 @@
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(GNURADIO_RUNTIME gnuradio-runtime)
INCLUDE(FindPackageHandleStandardArgs)
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)

View File

@ -1,26 +0,0 @@
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(PC_GRUEL gnuradio-core)
FIND_PATH(
GRUEL_INCLUDE_DIRS
NAMES gruel/attributes.h
HINTS $ENV{GRUEL_DIR}/include
${PC_GRUEL_INCLUDEDIR}
PATHS /usr/local/include
/usr/include
)
FIND_LIBRARY(
GRUEL_LIBRARIES
NAMES gruel
HINTS $ENV{GRUEL_DIR}/lib
${PC_GRUEL_LIBDIR}
PATHS /usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GRUEL DEFAULT_MSG GRUEL_LIBRARIES GRUEL_INCLUDE_DIRS)
MARK_AS_ADVANCED(GRUEL_LIBRARIES GRUEL_INCLUDE_DIRS)

View File

@ -22,7 +22,7 @@
#ifndef INCLUDED_AIR_MODES_API_H #ifndef INCLUDED_AIR_MODES_API_H
#define INCLUDED_AIR_MODES_API_H #define INCLUDED_AIR_MODES_API_H
#include <gruel/attributes.h> #include <gnuradio/attributes.h>
#ifdef AIR_MODES_EXPORTS #ifdef AIR_MODES_EXPORTS
# define AIR_MODES_API __GR_ATTR_EXPORT # define AIR_MODES_API __GR_ATTR_EXPORT

View File

@ -23,7 +23,7 @@
#ifndef INCLUDED_AIR_MODES_PREAMBLE_H #ifndef INCLUDED_AIR_MODES_PREAMBLE_H
#define INCLUDED_AIR_MODES_PREAMBLE_H #define INCLUDED_AIR_MODES_PREAMBLE_H
#include <gr_block.h> #include <gnuradio/block.h>
#include <air_modes_api.h> #include <air_modes_api.h>
class air_modes_preamble; class air_modes_preamble;
@ -35,7 +35,7 @@ AIR_MODES_API air_modes_preamble_sptr air_make_modes_preamble(int channel_rate,
* \brief mode select preamble detection * \brief mode select preamble detection
* \ingroup block * \ingroup block
*/ */
class AIR_MODES_API air_modes_preamble : public gr_block class AIR_MODES_API air_modes_preamble : public gr::block
{ {
private: private:
friend air_modes_preamble_sptr air_make_modes_preamble(int channel_rate, float threshold_db); friend air_modes_preamble_sptr air_make_modes_preamble(int channel_rate, float threshold_db);
@ -49,7 +49,7 @@ private:
float d_threshold_db; float d_threshold_db;
float d_threshold; float d_threshold;
pmt::pmt_t d_me, d_key; pmt::pmt_t d_me, d_key;
gr_tag_t d_timestamp; gr::tag_t d_timestamp;
double d_secs_per_sample; double d_secs_per_sample;
public: public:

View File

@ -23,38 +23,36 @@
#ifndef INCLUDED_AIR_MODES_slicer_H #ifndef INCLUDED_AIR_MODES_slicer_H
#define INCLUDED_AIR_MODES_slicer_H #define INCLUDED_AIR_MODES_slicer_H
#include <gr_sync_block.h> #include <gnuradio/sync_block.h>
#include <gr_msg_queue.h> #include <gnuradio/msg_queue.h>
#include <air_modes_api.h> #include <air_modes_api.h>
class air_modes_slicer; class air_modes_slicer;
typedef boost::shared_ptr<air_modes_slicer> air_modes_slicer_sptr; typedef boost::shared_ptr<air_modes_slicer> air_modes_slicer_sptr;
AIR_MODES_API air_modes_slicer_sptr air_make_modes_slicer(int channel_rate, gr_msg_queue_sptr queue); AIR_MODES_API air_modes_slicer_sptr air_make_modes_slicer(int channel_rate, gr::msg_queue::sptr queue);
/*! /*!
* \brief mode select slicer detection * \brief mode select slicer detection
* \ingroup block * \ingroup block
*/ */
class AIR_MODES_API air_modes_slicer : public gr_sync_block class AIR_MODES_API air_modes_slicer : public gr::sync_block
{ {
private: private:
friend air_modes_slicer_sptr air_make_modes_slicer(int channel_rate, gr_msg_queue_sptr queue); friend air_modes_slicer_sptr air_make_modes_slicer(int channel_rate, gr::msg_queue::sptr queue);
air_modes_slicer(int channel_rate, gr_msg_queue_sptr queue); air_modes_slicer(int channel_rate, gr::msg_queue::sptr queue);
int d_check_width; int d_check_width;
int d_chip_rate; int d_chip_rate;
int d_samples_per_chip; int d_samples_per_chip;
int d_samples_per_symbol; int d_samples_per_symbol;
gr_msg_queue_sptr d_queue; gr::msg_queue::sptr d_queue;
std::ostringstream d_payload; std::ostringstream d_payload;
public: public:
int work (int noutput_items, int work (int noutput_items,
gr_vector_const_void_star &input_items, gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items); gr_vector_void_star &output_items);
void set_rate(int channel_rate);
}; };
#endif /* INCLUDED_AIR_MODES_slicer_H */ #endif /* INCLUDED_AIR_MODES_slicer_H */

View File

@ -27,7 +27,7 @@ add_library(air_modes SHARED
air_modes_slicer.cc air_modes_slicer.cc
modes_crc.cc modes_crc.cc
) )
target_link_libraries(air_modes ${Boost_LIBRARIES} ${GRUEL_LIBRARIES} ${GNURADIO_CORE_LIBRARIES}) target_link_libraries(air_modes ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES})
set_target_properties(air_modes PROPERTIES DEFINE_SYMBOL "AIR_MODES_EXPORTS") set_target_properties(air_modes PROPERTIES DEFINE_SYMBOL "AIR_MODES_EXPORTS")
set_target_properties(air_modes PROPERTIES SOVERSION "${gr-gr-air-modes_VERSION_MAJOR}") set_target_properties(air_modes PROPERTIES SOVERSION "${gr-gr-air-modes_VERSION_MAJOR}")
set_target_properties(air_modes PROPERTIES VERSION "${gr-gr-air-modes_VERSION_MAJOR}.${gr-gr-air-modes_VERSION_MINOR}") set_target_properties(air_modes PROPERTIES VERSION "${gr-gr-air-modes_VERSION_MAJOR}.${gr-gr-air-modes_VERSION_MINOR}")

View File

@ -27,10 +27,10 @@
#include <ciso646> #include <ciso646>
#include <air_modes_preamble.h> #include <air_modes_preamble.h>
#include <gr_io_signature.h> #include <gnuradio/io_signature.h>
#include <string.h> #include <string.h>
#include <iostream> #include <iostream>
#include <gr_tags.h> #include <gnuradio/tags.h>
air_modes_preamble_sptr air_make_modes_preamble(int channel_rate, float threshold_db) air_modes_preamble_sptr air_make_modes_preamble(int channel_rate, float threshold_db)
{ {
@ -38,39 +38,24 @@ air_modes_preamble_sptr air_make_modes_preamble(int channel_rate, float threshol
} }
air_modes_preamble::air_modes_preamble(int channel_rate, float threshold_db) : air_modes_preamble::air_modes_preamble(int channel_rate, float threshold_db) :
gr_block ("modes_preamble", gr::block ("modes_preamble",
gr_make_io_signature2 (2, 2, sizeof(float), sizeof(float)), //stream 0 is received data, stream 1 is moving average for reference gr::io_signature::make2 (2, 2, sizeof(float), sizeof(float)), //stream 0 is received data, stream 1 is moving average for reference
gr_make_io_signature (1, 1, sizeof(float))) //the output packets gr::io_signature::make (1, 1, sizeof(float))) //the output packets
{
set_rate(channel_rate);
set_threshold(threshold_db);
std::stringstream str;
str << name() << unique_id();
d_me = pmt::pmt_string_to_symbol(str.str());
d_key = pmt::pmt_string_to_symbol("preamble_found");
set_history(d_samples_per_symbol);
}
void air_modes_preamble::set_rate(int channel_rate)
{ {
d_chip_rate = 2000000; //2Mchips per second d_chip_rate = 2000000; //2Mchips per second
d_samples_per_chip = channel_rate / d_chip_rate; //must be integer number of samples per chip to work d_samples_per_chip = channel_rate / d_chip_rate; //must be integer number of samples per chip to work
d_samples_per_symbol = d_samples_per_chip * 2; d_samples_per_symbol = d_samples_per_chip * 2;
d_secs_per_sample = 1.0 / channel_rate; d_check_width = 120 * d_samples_per_symbol; //only search to this far from the end of the stream buffer
d_check_width = 240 * d_samples_per_symbol; //only search to this far from the end of the stream buffer
set_output_multiple(1+d_check_width);
}
void air_modes_preamble::set_threshold(float threshold_db)
{
d_threshold_db = threshold_db; d_threshold_db = threshold_db;
d_threshold = powf(10., threshold_db/20.); //the level that the sample must be above the moving average in order to qualify as a pulse d_threshold = powf(10., threshold_db/20.); //the level that the sample must be above the moving average in order to qualify as a pulse
} d_secs_per_sample = 1.0 / channel_rate;
set_output_multiple(1+d_check_width*2);
float air_modes_preamble::get_threshold(void)
{ std::stringstream str;
return d_threshold_db; str << name() << unique_id();
d_me = pmt::string_to_symbol(str.str());
d_key = pmt::string_to_symbol("preamble_found");
set_history(d_samples_per_symbol);
} }
static void integrate_and_dump(float *out, const float *in, int chips, int samps_per_chip) { static void integrate_and_dump(float *out, const float *in, int chips, int samps_per_chip) {
@ -96,14 +81,14 @@ static double correlate_preamble(const float *in, int samples_per_chip) {
} }
//todo: make it return a pair of some kind, otherwise you can lose precision //todo: make it return a pair of some kind, otherwise you can lose precision
static double tag_to_timestamp(gr_tag_t tstamp, uint64_t abs_sample_cnt, double secs_per_sample) { static double tag_to_timestamp(gr::tag_t tstamp, uint64_t abs_sample_cnt, double secs_per_sample) {
uint64_t ts_sample, last_whole_stamp; uint64_t ts_sample, last_whole_stamp;
double last_frac_stamp; double last_frac_stamp;
if(tstamp.key == NULL || pmt::pmt_symbol_to_string(tstamp.key) != "rx_time") return 0; if(tstamp.key == NULL || pmt::symbol_to_string(tstamp.key) != "rx_time") return 0;
last_whole_stamp = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(tstamp.value, 0)); last_whole_stamp = pmt::to_uint64(pmt::tuple_ref(tstamp.value, 0));
last_frac_stamp = pmt::pmt_to_double(pmt::pmt_tuple_ref(tstamp.value, 1)); last_frac_stamp = pmt::to_double(pmt::tuple_ref(tstamp.value, 1));
ts_sample = tstamp.offset; ts_sample = tstamp.offset;
double tstime = double(abs_sample_cnt * secs_per_sample) + last_whole_stamp + last_frac_stamp; double tstime = double(abs_sample_cnt * secs_per_sample) + last_whole_stamp + last_frac_stamp;
@ -137,8 +122,8 @@ int air_modes_preamble::general_work(int noutput_items,
}; };
uint64_t abs_sample_cnt = nitems_read(0); uint64_t abs_sample_cnt = nitems_read(0);
std::vector<gr_tag_t> tstamp_tags; std::vector<gr::tag_t> tstamp_tags;
get_tags_in_range(tstamp_tags, 0, abs_sample_cnt, abs_sample_cnt + ninputs, pmt::pmt_string_to_symbol("rx_time")); get_tags_in_range(tstamp_tags, 0, abs_sample_cnt, abs_sample_cnt + ninputs, pmt::string_to_symbol("rx_time"));
//tags.back() is the most recent timestamp, then. //tags.back() is the most recent timestamp, then.
if(tstamp_tags.size() > 0) { if(tstamp_tags.size() > 0) {
d_timestamp = tstamp_tags.back(); d_timestamp = tstamp_tags.back();
@ -210,10 +195,10 @@ int air_modes_preamble::general_work(int noutput_items,
add_item_tag(0, //stream ID add_item_tag(0, //stream ID
nitems_written(0), //sample nitems_written(0), //sample
d_key, //frame_info d_key, //frame_info
pmt::pmt_make_tuple(pmt::pmt_from_double(tstamp), pmt::pmt_from_double(inavg[i])), pmt::from_double(tstamp),
d_me //block src id d_me //block src id
); );
//std::cout << "PREAMBLE" << std::endl; //std::cout << "PREAMBLE" << std::endl;
//produce only one output per work call -- TODO this should probably change //produce only one output per work call -- TODO this should probably change

View File

@ -27,13 +27,13 @@
#include <ciso646> #include <ciso646>
#include <air_modes_slicer.h> #include <air_modes_slicer.h>
#include <gr_io_signature.h> #include <gnuradio/io_signature.h>
#include <air_modes_types.h> #include <air_modes_types.h>
#include <sstream> #include <sstream>
#include <iomanip> #include <iomanip>
#include <modes_crc.h> #include <modes_crc.h>
#include <iostream> #include <iostream>
#include <gr_tags.h> #include <gnuradio/tags.h>
extern "C" extern "C"
{ {
@ -41,26 +41,23 @@ extern "C"
#include <string.h> #include <string.h>
} }
air_modes_slicer_sptr air_make_modes_slicer(int channel_rate, gr_msg_queue_sptr queue) air_modes_slicer_sptr air_make_modes_slicer(int channel_rate, gr::msg_queue::sptr queue)
{ {
return air_modes_slicer_sptr (new air_modes_slicer(channel_rate, queue)); return air_modes_slicer_sptr (new air_modes_slicer(channel_rate, queue));
} }
air_modes_slicer::air_modes_slicer(int channel_rate, gr_msg_queue_sptr queue) : air_modes_slicer::air_modes_slicer(int channel_rate, gr::msg_queue::sptr queue) :
gr_sync_block ("modes_slicer", gr::sync_block ("modes_slicer",
gr_make_io_signature (1, 1, sizeof(float)), //stream 0 is received data, stream 1 is binary preamble detector output gr::io_signature::make (1, 1, sizeof(float)), //stream 0 is received data, stream 1 is binary preamble detector output
gr_make_io_signature (0, 0, 0) ) gr::io_signature::make (0, 0, 0) )
{
set_rate(channel_rate);
d_queue = queue;
}
void air_modes_slicer::set_rate(int channel_rate)
{ {
//initialize private data here
d_chip_rate = 2000000; //2Mchips per second d_chip_rate = 2000000; //2Mchips per second
d_samples_per_chip = 2;//FIXME this is constant now channel_rate / d_chip_rate; d_samples_per_chip = 2;//FIXME this is constant now channel_rate / d_chip_rate;
d_samples_per_symbol = d_samples_per_chip * 2; d_samples_per_symbol = d_samples_per_chip * 2;
d_check_width = 120 * d_samples_per_symbol; //how far you will have to look ahead d_check_width = 120 * d_samples_per_symbol; //how far you will have to look ahead
d_queue = queue;
set_output_multiple(d_check_width*2); //how do you specify buffer size for sinks? set_output_multiple(d_check_width*2); //how do you specify buffer size for sinks?
} }
@ -110,10 +107,10 @@ int air_modes_slicer::work(int noutput_items,
if(0) std::cout << "Slicer called with " << size << " samples" << std::endl; if(0) std::cout << "Slicer called with " << size << " samples" << std::endl;
std::vector<gr_tag_t> tags; std::vector<gr::tag_t> tags;
uint64_t abs_sample_cnt = nitems_read(0); uint64_t abs_sample_cnt = nitems_read(0);
get_tags_in_range(tags, 0, abs_sample_cnt, abs_sample_cnt + size, pmt::pmt_string_to_symbol("preamble_found")); get_tags_in_range(tags, 0, abs_sample_cnt, abs_sample_cnt + size, pmt::string_to_symbol("preamble_found"));
std::vector<gr_tag_t>::iterator tag_iter; std::vector<gr::tag_t>::iterator tag_iter;
for(tag_iter = tags.begin(); tag_iter != tags.end(); tag_iter++) { for(tag_iter = tags.begin(); tag_iter != tags.end(); tag_iter++) {
uint64_t i = tag_iter->offset - abs_sample_cnt; uint64_t i = tag_iter->offset - abs_sample_cnt;
@ -159,14 +156,17 @@ int air_modes_slicer::work(int noutput_items,
if(rx_packet.numlowconf < 24) rx_packet.lowconfbits[rx_packet.numlowconf++] = j; if(rx_packet.numlowconf < 24) rx_packet.lowconfbits[rx_packet.numlowconf++] = j;
} }
} }
rx_packet.timestamp = pmt_to_double(pmt_tuple_ref(tag_iter->value, 0));
double ref = pmt_to_double(pmt_tuple_ref(tag_iter->value, 1));
//traverse the whole packet and if you find all 0's, just toss it. don't know why these packets turn up, but they pass ECC. /******************** BEGIN TIMESTAMP BS ******************/
rx_packet.timestamp = pmt::to_double(tag_iter->value);
/******************* END TIMESTAMP BS *********************/
//increment for the next round
//here you might want to traverse the whole packet and if you find all 0's, just toss it. don't know why these packets turn up, but they pass ECC.
bool zeroes = 1; bool zeroes = 1;
for(int m = 0; m < 14; m++) { for(int m = 0; m < 14; m++) {
if(rx_packet.data[m]) { zeroes = 0; break; } if(rx_packet.data[m]) zeroes = 0;
} }
if(zeroes) {continue;} //toss it if(zeroes) {continue;} //toss it
@ -187,9 +187,9 @@ int air_modes_slicer::work(int noutput_items,
d_payload << std::hex << std::setw(2) << std::setfill('0') << unsigned(rx_packet.data[m]); d_payload << std::hex << std::setw(2) << std::setfill('0') << unsigned(rx_packet.data[m]);
} }
d_payload << " " << std::setw(6) << rx_packet.crc << " " << std::dec << rx_packet.reference_level / ref d_payload << " " << std::setw(6) << rx_packet.crc << " " << std::dec << rx_packet.reference_level
<< " " << std::setprecision(10) << std::setw(10) << rx_packet.timestamp; << " " << std::setprecision(10) << std::setw(10) << rx_packet.timestamp;
gr_message_sptr msg = gr_make_message_from_string(std::string(d_payload.str())); gr::message::sptr msg = gr::message::make_from_string(std::string(d_payload.str()));
d_queue->handle(msg); d_queue->handle(msg);
} }
if(0) std::cout << "Slicer consumed " << size << ", returned " << size << std::endl; if(0) std::cout << "Slicer consumed " << size << ", returned " << size << std::endl;

View File

@ -23,7 +23,8 @@
# You pass it options, it gives you data. # You pass it options, it gives you data.
# It uses the pubsub interface to allow clients to subscribe to its data feeds. # It uses the pubsub interface to allow clients to subscribe to its data feeds.
from gnuradio import gr, gru, eng_notation, blks2 from gnuradio import gr, gru, eng_notation, filter
from gnuradio.filter import optfir
from gnuradio.eng_option import eng_option from gnuradio.eng_option import eng_option
from gnuradio.gr.pubsub import pubsub from gnuradio.gr.pubsub import pubsub
from optparse import OptionParser, OptionGroup from optparse import OptionParser, OptionGroup
@ -186,7 +187,7 @@ class modes_radio (gr.top_block, pubsub):
#Note: this should only come into play if using an RTLSDR. #Note: this should only come into play if using an RTLSDR.
# lpfiltcoeffs = gr.firdes.low_pass(1, 5*3.2e6, 1.6e6, 300e3) # lpfiltcoeffs = gr.firdes.low_pass(1, 5*3.2e6, 1.6e6, 300e3)
# self._resample = blks2.rational_resampler_ccf(interpolation=5, decimation=4, taps=lpfiltcoeffs) # self._resample = filter.rational_resampler_ccf(interpolation=5, decimation=4, taps=lpfiltcoeffs)
else: else:
#semantically detect whether it's ip.ip.ip.ip:port or filename #semantically detect whether it's ip.ip.ip.ip:port or filename

View File

@ -19,7 +19,7 @@
# Boston, MA 02110-1301, USA. # Boston, MA 02110-1301, USA.
# #
from gnuradio import gr from gnuradio import gr, blocks
import air_modes_swig import air_modes_swig
class rx_path(gr.hier_block2): class rx_path(gr.hier_block2):
@ -35,17 +35,17 @@ class rx_path(gr.hier_block2):
self._spc = int(rate/2e6) self._spc = int(rate/2e6)
# Convert incoming I/Q baseband to amplitude # Convert incoming I/Q baseband to amplitude
self._demod = gr.complex_to_mag() self._demod = blocks.complex_to_mag()
self._bb = self._demod self._bb = self._demod
# Pulse matched filter for 0.5us pulses # Pulse matched filter for 0.5us pulses
if use_pmf: if use_pmf:
self._pmf = gr.moving_average_ff(self._spc, 1.0/self._spc)#, self._rate) self._pmf = blocks.moving_average_ff(self._spc, 1.0/self._spc)#, self._rate)
self.connect(self._demod, self._pmf) self.connect(self._demod, self._pmf)
self._bb = self._pmf self._bb = self._pmf
# Establish baseline amplitude (noise, interference) # Establish baseline amplitude (noise, interference)
self._avg = gr.moving_average_ff(48*self._spc, 1.0/(48*self._spc))#, self._rate) # 3 preambles self._avg = blocks.moving_average_ff(48*self._spc, 1.0/(48*self._spc))#, self._rate) # 3 preambles
# Synchronize to Mode-S preamble # Synchronize to Mode-S preamble
self._sync = air_modes_swig.modes_preamble(self._rate, self._threshold) self._sync = air_modes_swig.modes_preamble(self._rate, self._threshold)

View File

@ -31,11 +31,8 @@ include(GrPython)
######################################################################## ########################################################################
# Setup swig generation # Setup swig generation
######################################################################## ########################################################################
foreach(incdir ${GNURADIO_CORE_INCLUDE_DIRS}) foreach(incdir ${GNURADIO_RUNTIME_INCLUDE_DIRS})
list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/swig) list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/gnuradio/swig)
endforeach(incdir)
foreach(incdir ${GRUEL_INCLUDE_DIRS})
list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/gruel/swig)
endforeach(incdir) endforeach(incdir)
set(GR_SWIG_LIBRARIES air_modes) set(GR_SWIG_LIBRARIES air_modes)

View File

@ -5,7 +5,7 @@
%{ %{
#include "air_modes_preamble.h" #include "air_modes_preamble.h"
#include "air_modes_slicer.h" #include "air_modes_slicer.h"
#include <gr_msg_queue.h> #include <gnuradio/msg_queue.h>
%} %}
// ---------------------------------------------------------------- // ----------------------------------------------------------------
@ -21,7 +21,7 @@ GR_SWIG_BLOCK_MAGIC(air,modes_preamble);
air_modes_preamble_sptr air_make_modes_preamble (int channel_rate, float threshold_db); air_modes_preamble_sptr air_make_modes_preamble (int channel_rate, float threshold_db);
class air_modes_preamble : public gr_sync_block class air_modes_preamble : public gr::sync_block
{ {
set_rate(int channel_rate); set_rate(int channel_rate);
set_threshold(float threshold_db); set_threshold(float threshold_db);
@ -32,13 +32,13 @@ private:
GR_SWIG_BLOCK_MAGIC(air,modes_slicer); GR_SWIG_BLOCK_MAGIC(air,modes_slicer);
air_modes_slicer_sptr air_make_modes_slicer (int channel_rate, gr_msg_queue_sptr queue); air_modes_slicer_sptr air_make_modes_slicer (int channel_rate, gr::msg_queue::sptr queue);
class air_modes_slicer : public gr_block class air_modes_slicer : public gr::block
{ {
set_rate(int channel_rate); set_rate(int channel_rate);
private: private:
air_modes_slicer (int channel_rate, gr_msg_queue_sptr queue); air_modes_slicer (int channel_rate, gr::msg_queue::sptr queue);
}; };
// ---------------------------------------------------------------- // ----------------------------------------------------------------