Merge branch 'master' into qtapp

Conflicts:
	CMakeLists.txt
	lib/air_modes_preamble.cc
This commit is contained in:
Nick Foster 2012-09-20 18:40:31 -07:00
commit 70dfb4f821
4 changed files with 21 additions and 7 deletions

View File

@ -22,7 +22,9 @@
# Project setup # Project setup
######################################################################## ########################################################################
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 2.6)
project(gr-air-modes CXX) project(gr-gr-air-modes CXX)
set(gr-gr-air-modes_VERSION_MAJOR 0)
set(gr-gr-air-modes_VERSION_MINOR 0)
enable_testing() enable_testing()
#select the release build type by default to get optimization flags #select the release build type by default to get optimization flags

View File

@ -29,6 +29,8 @@ add_library(air_modes SHARED
) )
target_link_libraries(air_modes ${Boost_LIBRARIES} ${GRUEL_LIBRARIES} ${GNURADIO_CORE_LIBRARIES}) target_link_libraries(air_modes ${Boost_LIBRARIES} ${GRUEL_LIBRARIES} ${GNURADIO_CORE_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 VERSION "${gr-gr-air-modes_VERSION_MAJOR}.${gr-gr-air-modes_VERSION_MINOR}")
######################################################################## ########################################################################
# Install built library files # Install built library files

View File

@ -53,7 +53,7 @@ air_modes_preamble::air_modes_preamble(int channel_rate, float threshold_db) :
str << name() << unique_id(); str << name() << unique_id();
d_me = pmt::pmt_string_to_symbol(str.str()); d_me = pmt::pmt_string_to_symbol(str.str());
d_key = pmt::pmt_string_to_symbol("preamble_found"); d_key = pmt::pmt_string_to_symbol("preamble_found");
set_history(d_check_width); 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) {
@ -101,7 +101,13 @@ int air_modes_preamble::general_work(int noutput_items,
{ {
const float *in = (const float *) input_items[0]; const float *in = (const float *) input_items[0];
const float *inavg = (const float *) input_items[1]; const float *inavg = (const float *) input_items[1];
const int ninputs = std::min(ninput_items[0], ninput_items[1]); //just in case
int mininputs = std::min(ninput_items[0], ninput_items[1]); //they should be matched but let's be safe
//round number of input samples down to nearest d_samples_per_chip
//we also subtract off d_samples_per_chip to allow the bit center finder some leeway
const int ninputs = std::max(mininputs - (mininputs % d_samples_per_chip) - d_samples_per_chip, 0);
if (ninputs <= 0) { consume_each(0); return 0; }
float *out = (float *) output_items[0]; float *out = (float *) output_items[0];
if(0) std::cout << "Preamble called with " << ninputs << " samples" << std::endl; if(0) std::cout << "Preamble called with " << ninputs << " samples" << std::endl;
@ -132,15 +138,18 @@ int air_modes_preamble::general_work(int noutput_items,
//get a more accurate bit center by finding the correlation peak across all four preamble bits //get a more accurate bit center by finding the correlation peak across all four preamble bits
bool late, early; bool late, early;
int how_late = 0;
do { do {
double now_corr = correlate_preamble(in+i, d_samples_per_chip); double now_corr = correlate_preamble(in+i, d_samples_per_chip);
double late_corr = correlate_preamble(in+i+1, d_samples_per_chip); double late_corr = correlate_preamble(in+i+1, d_samples_per_chip);
double early_corr = correlate_preamble(in+i-1, d_samples_per_chip); double early_corr = correlate_preamble(in+i-1, d_samples_per_chip);
late = (late_corr > now_corr); late = (late_corr > now_corr);
//early = (early_corr > now_corr); //early = (early_corr > now_corr);
if(late) i++; if(late) { i++; how_late++; }
//if(early && i>0) { std::cout << "EARLY " << i << std::endl; i--; } //if(early && i>0) { std::cout << "EARLY " << i << std::endl; i--; }
} while(late);// xor early); } while(late and how_late < d_samples_per_chip);// xor early);
if(0) std::cout << "We were " << how_late << " samples late" << std::endl;
//now check to see that the non-peak symbols in the preamble //now check to see that the non-peak symbols in the preamble
//are below the peaks by threshold dB //are below the peaks by threshold dB
@ -160,6 +169,7 @@ int air_modes_preamble::general_work(int noutput_items,
//be sure we've got enough room in the input buffer to copy out a whole packet //be sure we've got enough room in the input buffer to copy out a whole packet
if(ninputs-i < 240*d_samples_per_chip) { if(ninputs-i < 240*d_samples_per_chip) {
consume_each(std::max(i-1,0)); consume_each(std::max(i-1,0));
if(0) std::cout << "Preamble consumed " << std::max(i-1,0) << ", returned 0 (no room)" << std::endl;
return 0; return 0;
} }
@ -190,7 +200,7 @@ int air_modes_preamble::general_work(int noutput_items,
//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
if(0) std::cout << "Preamble consumed " << i+240*d_samples_per_chip << ", returned 240" << std::endl; if(0) std::cout << "Preamble consumed " << i+240*d_samples_per_chip << "with i=" << i << ", returned 240" << std::endl;
consume_each(i+240*d_samples_per_chip); consume_each(i+240*d_samples_per_chip);
return 240; return 240;
} }

View File

@ -180,7 +180,7 @@ class output_print(air_modes.parse):
retstr = "Type 17 BDS6,2 (emergency) from %x type %s" % (icao24, emerg_str) retstr = "Type 17 BDS6,2 (emergency) from %x type %s" % (icao24, emerg_str)
else: else:
retstr = "Type 17 subtype %i from %x not implemented" % (subtype, icao24) retstr = "Type 17 with FTC=%i from %x not implemented" % (data["ftc"], icao24)
return retstr return retstr