From a2d9e635da00907fae7582e75e1d2555bfb23380 Mon Sep 17 00:00:00 2001 From: blurbdust Date: Thu, 8 Jun 2017 16:43:29 -0500 Subject: [PATCH 01/10] Added device index. Haven't tested yet. --- arguments.hpp | 13 ++++++++++++- main.cpp | 3 ++- topblock.hpp | 4 ++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/arguments.hpp b/arguments.hpp index 1d2b03d..a094f5d 100644 --- a/arguments.hpp +++ b/arguments.hpp @@ -33,7 +33,8 @@ class Arguments sample_rate(2000000.0), fft_width(1000.0), step(-1.0), - ptime(-1.0) + ptime(-1.0), + device(0) { argp_parse (&argp_i, argc, argv, 0, 0, this); } @@ -103,6 +104,11 @@ class Arguments return ptime; } + char *get_device() + { + return device; + } + private: static error_t s_parse_opt(int key, char *arg, struct argp_state *state) { @@ -147,6 +153,9 @@ class Arguments case 'p': ptime = atof(arg); break; + case 'd': + device = atof(arg); + break; case ARGP_KEY_ARG: if (state->arg_num > 0){ argp_usage (state); @@ -177,6 +186,7 @@ class Arguments double fft_width; double step; double ptime; + char *device; }; argp_option Arguments::options[] = { @@ -191,6 +201,7 @@ argp_option Arguments::options[] = { {"fft-width", 'w', "COUNT", 0, "Width of FFT in samples"}, {"step", 'z', "FREQ", 0, "Increment step in MHz"}, {"time", 'p', "TIME", 0, "Time in seconds to scan on each frequency"}, + {"device", 'd', "DEVICE", 0, "Use specific device if more than one (optional)"}, {0} }; argp Arguments::argp_i = {options, s_parse_opt, 0, 0}; diff --git a/main.cpp b/main.cpp index fb88dc1..4990834 100644 --- a/main.cpp +++ b/main.cpp @@ -37,7 +37,8 @@ int main(int argc, char **argv) arguments.get_avg_size(), arguments.get_spread(), arguments.get_threshold(), - arguments.get_time()); + arguments.get_time(), + arguments.get_device()); top_block.run(); return 0; //actually, we never get here because of the rude way in which we end the scan } diff --git a/topblock.hpp b/topblock.hpp index cfb605e..fec458c 100644 --- a/topblock.hpp +++ b/topblock.hpp @@ -33,11 +33,11 @@ class TopBlock : public gr::top_block { public: TopBlock(double centre_freq_1, double centre_freq_2, double sample_rate, double fft_width, double bandwidth1, double bandwidth2, - double step, unsigned int avg_size, double spread, double threshold, double ptime) : gr::top_block("Top Block"), + double step, unsigned int avg_size, double spread, double threshold, double ptime, char *device) : gr::top_block("Top Block"), vector_length(sample_rate/fft_width), window(GetWindow(vector_length)), - source(osmosdr::source::make()), /* OsmoSDR Source */ + source(osmosdr::source::make(device)), /* OsmoSDR Source if device is null then it should auto pick the lowest index device*/ stv(gr::blocks::stream_to_vector::make(sizeof(float)*2, vector_length)), /* Stream to vector */ /* Based on the logpwrfft (a block implemented in python) */ fft(gr::fft::fft_vcc::make(vector_length, true, window, false, 1)), From 704943fd51ca9680922e3524f25469640a6cdcb3 Mon Sep 17 00:00:00 2001 From: blurbdust Date: Thu, 8 Jun 2017 16:45:32 -0500 Subject: [PATCH 02/10] Added example for device index on help screen --- arguments.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arguments.hpp b/arguments.hpp index a094f5d..43d2d18 100644 --- a/arguments.hpp +++ b/arguments.hpp @@ -201,7 +201,7 @@ argp_option Arguments::options[] = { {"fft-width", 'w', "COUNT", 0, "Width of FFT in samples"}, {"step", 'z', "FREQ", 0, "Increment step in MHz"}, {"time", 'p', "TIME", 0, "Time in seconds to scan on each frequency"}, - {"device", 'd', "DEVICE", 0, "Use specific device if more than one (optional)"}, + {"device", 'd', "DEVICE", 0, "Use specific device if more than one. Ex. rtl=1 or hackrf=0 (Optional)"}, {0} }; argp Arguments::argp_i = {options, s_parse_opt, 0, 0}; From 11bbad134392725409b13cf0677dceadd101f55b Mon Sep 17 00:00:00 2001 From: blurbdust Date: Fri, 9 Jun 2017 11:02:33 -0500 Subject: [PATCH 03/10] Tested, compiles, and works. --- arguments.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arguments.hpp b/arguments.hpp index 43d2d18..34d959a 100644 --- a/arguments.hpp +++ b/arguments.hpp @@ -154,7 +154,7 @@ class Arguments ptime = atof(arg); break; case 'd': - device = atof(arg); + device = arg; break; case ARGP_KEY_ARG: if (state->arg_num > 0){ @@ -222,4 +222,4 @@ const char *argp_program_version = "GNU General Public License for more details.\n" "\n" "You should have received a copy of the GNU General Public License\n" -"along with this program. If not, see ."; \ No newline at end of file +"along with this program. If not, see ."; From 239762deb6067a8721caa03184282df28aa5a974 Mon Sep 17 00:00:00 2001 From: blurbdust Date: Fri, 9 Jun 2017 11:23:41 -0500 Subject: [PATCH 04/10] Made device mandatory --- arguments.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arguments.hpp b/arguments.hpp index 34d959a..54f4fab 100644 --- a/arguments.hpp +++ b/arguments.hpp @@ -201,7 +201,7 @@ argp_option Arguments::options[] = { {"fft-width", 'w', "COUNT", 0, "Width of FFT in samples"}, {"step", 'z', "FREQ", 0, "Increment step in MHz"}, {"time", 'p', "TIME", 0, "Time in seconds to scan on each frequency"}, - {"device", 'd', "DEVICE", 0, "Use specific device if more than one. Ex. rtl=1 or hackrf=0 (Optional)"}, + {"device", 'd', "DEVICE", 0, "Specify device to use. Ex. rtl=0 or hackrf=1 (Mandatory)"}, {0} }; argp Arguments::argp_i = {options, s_parse_opt, 0, 0}; From 9ec0182036ffdb1f27268d3ae535a9c28b7cc439 Mon Sep 17 00:00:00 2001 From: blurbdust Date: Fri, 9 Jun 2017 11:24:28 -0500 Subject: [PATCH 05/10] Updated README --- README | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README b/README index 069bd3e..2ef8d82 100644 --- a/README +++ b/README @@ -2,3 +2,6 @@ Fast radio spectrum scanner based on SDR and GnuRadio. Tune to frequencies in specified range and tri fing peak in frequency power spectrum. Print frequency and bandwidth of found peaks. + +Example Useage: +./gr-scan -x 17 -y 20 -d rtl=0 From 5dd659b39e6ea71b1e006efc4edf205b8222a0be Mon Sep 17 00:00:00 2001 From: blurbdust Date: Fri, 14 Jul 2017 14:02:39 -0500 Subject: [PATCH 06/10] Update README --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index 2ef8d82..df84001 100644 --- a/README +++ b/README @@ -5,3 +5,4 @@ Print frequency and bandwidth of found peaks. Example Useage: ./gr-scan -x 17 -y 20 -d rtl=0 +./gr-scan -x 100 -y 103 -d file=./out.wav,rate=2000000 From 3bd12f00469c1085e463f5c8c97d716cd81ad45e Mon Sep 17 00:00:00 2001 From: blurbdust Date: Fri, 14 Jul 2017 15:08:59 -0500 Subject: [PATCH 07/10] Added initial support for csv output --- arguments.hpp | 11 +++++++++++ main.cpp | 2 ++ scanner_sink.hpp | 48 ++++++++++++++++++++++++++++++++++++++++++++---- topblock.hpp | 6 ++++-- 4 files changed, 61 insertions(+), 6 deletions(-) diff --git a/arguments.hpp b/arguments.hpp index 54f4fab..46c368a 100644 --- a/arguments.hpp +++ b/arguments.hpp @@ -104,6 +104,12 @@ class Arguments return ptime; } + std::string get_outcsv() + { + return outcsv; + } + + char *get_device() { return device; @@ -153,6 +159,9 @@ class Arguments case 'p': ptime = atof(arg); break; + case 'o': + outcsv = std::string(arg); + break; case 'd': device = arg; break; @@ -186,6 +195,7 @@ class Arguments double fft_width; double step; double ptime; + std::string outcsv; char *device; }; @@ -201,6 +211,7 @@ argp_option Arguments::options[] = { {"fft-width", 'w', "COUNT", 0, "Width of FFT in samples"}, {"step", 'z', "FREQ", 0, "Increment step in MHz"}, {"time", 'p', "TIME", 0, "Time in seconds to scan on each frequency"}, + {"output-csv", 'o', "OUTCSV", 0, "Output results to CSV file (default: [none])"}, {"device", 'd', "DEVICE", 0, "Specify device to use. Ex. rtl=0 or hackrf=1 (Mandatory)"}, {0} }; diff --git a/main.cpp b/main.cpp index 4990834..57a0309 100644 --- a/main.cpp +++ b/main.cpp @@ -16,6 +16,7 @@ along with this program. If not, see . */ +// Modified to include https://git.zx2c4.com/gr-scan/tree/main.cpp #include @@ -38,6 +39,7 @@ int main(int argc, char **argv) arguments.get_spread(), arguments.get_threshold(), arguments.get_time(), + arguments.get_outcsv(), arguments.get_device()); top_block.run(); return 0; //actually, we never get here because of the rude way in which we end the scan diff --git a/scanner_sink.hpp b/scanner_sink.hpp index 6f910ea..f70c670 100644 --- a/scanner_sink.hpp +++ b/scanner_sink.hpp @@ -16,6 +16,8 @@ along with this program. If not, see . */ +// Modified to output CSV from https://git.zx2c4.com/gr-scan/tree/scanner_sink.hpp + #include #include #include @@ -31,7 +33,8 @@ class scanner_sink : public gr::block { public: scanner_sink(osmosdr::source::sptr source, unsigned int vector_length, double centre_freq_1, double centre_freq_2, double bandwidth0, double bandwidth1, double bandwidth2, - double step, unsigned int avg_size, double spread, double threshold, double ptime) : + double step, unsigned int avg_size, double spread, double threshold, double ptime, + const std::string &outcsv) : gr::block ("scanner_sink", gr::io_signature::make (1, 1, sizeof (float) * vector_length), gr::io_signature::make (0, 0, 0)), @@ -50,14 +53,31 @@ class scanner_sink : public gr::block m_threshold(threshold), //threshold in dB for discovery m_spread(spread), //minumum distance between radio signals (overlapping scans might produce slightly different frequencies) m_time(ptime), //the amount of time to listen on the same frequency for - m_start_time(time(0)) //the start time of the scan (useful for logging/reporting/monitoring) + m_start_time(time(0)), //the start time of the scan (useful for logging/reporting/monitoring) + m_outcsv(NULL) { ZeroBuffer(); + //Taken from https://git.zx2c4.com/gr-scan/tree/scanner_sink.hpp + if (!outcsv.empty()) { + bool write_csv_header = access(outcsv.c_str(), F_OK) == -1; + m_outcsv = fopen(outcsv.c_str(), "a+"); + if (!m_outcsv) { + fprintf(stderr, "[-] Error opening output CSV file %s\n", outcsv.c_str()); + exit(1); + } + if (write_csv_header) { + fprintf(m_outcsv, "time,frequency_mhz,width_khz,peak,diff\n"); + fflush(m_outcsv); + } + } } virtual ~scanner_sink() { delete []m_buffer; //delete the buffer + //Taken from https://git.zx2c4.com/gr-scan/tree/scanner_sink.hpp + if (m_outcsv) + fclose(m_outcsv); } private: @@ -159,6 +179,8 @@ class scanner_sink : public gr::block if (TrySignal(freqs[max], freqs[min])){ printf("[+] %02u:%02u:%02u: Found signal: at %f MHz of width %f kHz, peak power %f dB (difference %f dB)\n", hours, minutes, seconds, (freqs[max] + freqs[min]) / 2000000.0, (freqs[max] - freqs[min])/1000.0, bands1[peak], diffs[peak]); + // Taken from https://git.zx2c4.com/gr-scan/tree/scanner_sink.hpp + WriteCSV((freqs[max] + freqs[min]) / 2000000.0, (freqs[max] - freqs[min])/1000.0, bands1[peak], diffs[peak]); } } } @@ -235,6 +257,23 @@ class scanner_sink : public gr::block } } + // Taken from https://git.zx2c4.com/gr-scan/tree/scanner_sink.hpp + void WriteCSV(float freq, float width, float peak, float diff) + { + time_t timer; + struct tm *tm_info; + char buf[26]; + + if (!m_outcsv) + return; + + time(&timer); + tm_info = localtime(&timer); + strftime(buf, sizeof(buf), "%Y%m%d_%H%M%S", tm_info); + fprintf(m_outcsv, "%s,%f,%f,%f,%f\n", buf, freq, width, peak, diff); + fflush(m_outcsv); + } + //std::set> m_signals; std::set m_signals; osmosdr::source::sptr m_source; @@ -253,12 +292,13 @@ class scanner_sink : public gr::block double m_spread; double m_time; time_t m_start_time; + FILE *m_outcsv; }; /* Shared pointer thing gnuradio is fond of */ typedef boost::shared_ptr scanner_sink_sptr; scanner_sink_sptr make_scanner_sink(osmosdr::source::sptr source, unsigned int vector_length, double centre_freq_1, double centre_freq_2, double bandwidth0, double bandwidth1, double bandwidth2, - double step, unsigned int avg_size, double spread, double threshold, double ptime) + double step, unsigned int avg_size, double spread, double threshold, double ptime, const std::string &outcsv) { - return boost::shared_ptr(new scanner_sink(source, vector_length, centre_freq_1, centre_freq_2, bandwidth0, bandwidth1, bandwidth2, step, avg_size, spread, threshold, ptime)); + return boost::shared_ptr(new scanner_sink(source, vector_length, centre_freq_1, centre_freq_2, bandwidth0, bandwidth1, bandwidth2, step, avg_size, spread, threshold, ptime, outcsv)); } diff --git a/topblock.hpp b/topblock.hpp index fec458c..2ad5891 100644 --- a/topblock.hpp +++ b/topblock.hpp @@ -29,11 +29,13 @@ #include #include "scanner_sink.hpp" +//Modified to include https://git.zx2c4.com/gr-scan/tree/topblock.hpp + class TopBlock : public gr::top_block { public: TopBlock(double centre_freq_1, double centre_freq_2, double sample_rate, double fft_width, double bandwidth1, double bandwidth2, - double step, unsigned int avg_size, double spread, double threshold, double ptime, char *device) : gr::top_block("Top Block"), + double step, unsigned int avg_size, double spread, double threshold, double ptime, const std::string &outcsv, char *device) : gr::top_block("Top Block"), vector_length(sample_rate/fft_width), window(GetWindow(vector_length)), @@ -45,7 +47,7 @@ class TopBlock : public gr::top_block iir(gr::filter::single_pole_iir_filter_ff::make(1.0, vector_length)), lg(gr::blocks::nlog10_ff::make(10, vector_length, -20 * std::log10(float(vector_length)) -10 * std::log10(float(GetWindowPower()/vector_length)))), /* Sink - this does most of the interesting work */ - sink(make_scanner_sink(source, vector_length, centre_freq_1, centre_freq_2, sample_rate, bandwidth1, bandwidth2, step, avg_size, spread, threshold, ptime)) + sink(make_scanner_sink(source, vector_length, centre_freq_1, centre_freq_2, sample_rate, bandwidth1, bandwidth2, step, avg_size, spread, threshold, ptime, outcsv)) { /* Set up the OsmoSDR Source */ source->set_sample_rate(sample_rate); From f0abd66d020f299d5087b2c23fa483646fef36a6 Mon Sep 17 00:00:00 2001 From: blurbdust Date: Fri, 14 Jul 2017 15:13:16 -0500 Subject: [PATCH 08/10] Forgot to include string.h --- arguments.hpp | 1 + scanner_sink.hpp | 1 + topblock.hpp | 1 + 3 files changed, 3 insertions(+) diff --git a/arguments.hpp b/arguments.hpp index 46c368a..7a386c0 100644 --- a/arguments.hpp +++ b/arguments.hpp @@ -18,6 +18,7 @@ #include #include +#include class Arguments { diff --git a/scanner_sink.hpp b/scanner_sink.hpp index f70c670..504dea6 100644 --- a/scanner_sink.hpp +++ b/scanner_sink.hpp @@ -21,6 +21,7 @@ #include #include #include +#include #include diff --git a/topblock.hpp b/topblock.hpp index 2ad5891..e530adc 100644 --- a/topblock.hpp +++ b/topblock.hpp @@ -19,6 +19,7 @@ #include #include +#include #include #include From 6b359804e9281fc76722ab1f684b7c4553ece44e Mon Sep 17 00:00:00 2001 From: blurbdust Date: Tue, 2 Jun 2020 18:58:52 -0500 Subject: [PATCH 09/10] adding log4cpp since it's now a dependecy of gnuradio 3.8 --- Makefile | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index fc22180..421dc1c 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ # # gr-scan - A GNU Radio signal scanner +# Copyright (C) 2015 Jason A. Donenfeld . All Rights Reserved. # Copyright (C) 2012 Nicholas Tomlinson # # This program is free software: you can redistribute it and/or modify @@ -16,17 +17,23 @@ # along with this program. If not, see . # -VERSION=2013102901 -CXXFLAGS=-DVERSION="\"gr-scan $(VERSION)\"" -Wall -lgnuradio-filter -lgnuradio-blocks -lgnuradio-pmt -lgnuradio-fft -lgnuradio-runtime -lgnuradio-osmosdr -lboost_system -O2 -s -Wno-unused-function +VERSION = 20160104 +CXXFLAGS ?= -O3 -march=native -fomit-frame-pointer +CXXFLAGS +=-DVERSION="\"gr-scan $(VERSION)\"" -Wall +LDLIBS = -lgnuradio-filter -lgnuradio-blocks -lgnuradio-pmt -lgnuradio-fft -lgnuradio-runtime -lgnuradio-osmosdr -lboost_system -llog4cpp -gr-scan: *.cpp *.hpp Makefile - g++ $(CXXFLAGS) -o gr-scan main.cpp +PREFIX ?= /usr +DESTDIR ?= +BINDIR ?= $(PREFIX)/bin +LIBDIR ?= $(PREFIX)/lib +MANDIR ?= $(PREFIX)/share/man +all: gr-scan + +gr-scan: *.cpp *.hpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) *.cpp -o gr-scan $(LDLIBS) $(LDFLAGS) clean: - rm -f gr-scan gr-scan.tar.gz + rm -f gr-scan -dist: - mkdir gr-scan-$(VERSION) - cp *.cpp *.hpp Makefile COPYING gr-scan-$(VERSION) - tar -cf - gr-scan-$(VERSION) | gzip -9 -c - > gr-scan-$(VERSION).tar.gz - rm -r gr-scan-$(VERSION) +install: gr-scan + @install -v -d "$(DESTDIR)$(BINDIR)" && install -s -m 0755 -v gr-scan "$(DESTDIR)$(BINDIR)/gr-scan" From d900dd6e9e60e7e1514d10725738628ba0686cec Mon Sep 17 00:00:00 2001 From: blurbdust Date: Thu, 11 Aug 2022 14:34:25 -0500 Subject: [PATCH 10/10] updating to GNURadio 3.9 and fixing old bugs --- Makefile | 2 +- arguments.hpp | 8 ++++---- scanner_sink.hpp | 6 +++--- topblock.hpp | 21 ++++++++++++++------- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 421dc1c..82fecf8 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ VERSION = 20160104 CXXFLAGS ?= -O3 -march=native -fomit-frame-pointer CXXFLAGS +=-DVERSION="\"gr-scan $(VERSION)\"" -Wall -LDLIBS = -lgnuradio-filter -lgnuradio-blocks -lgnuradio-pmt -lgnuradio-fft -lgnuradio-runtime -lgnuradio-osmosdr -lboost_system -llog4cpp +LDLIBS = -lgnuradio-filter -lgnuradio-blocks -lgnuradio-pmt -lgnuradio-fft -lgnuradio-runtime -lgnuradio-osmosdr -lboost_system -lfmt PREFIX ?= /usr DESTDIR ?= diff --git a/arguments.hpp b/arguments.hpp index 7a386c0..2aec970 100644 --- a/arguments.hpp +++ b/arguments.hpp @@ -35,7 +35,7 @@ class Arguments fft_width(1000.0), step(-1.0), ptime(-1.0), - device(0) + device() { argp_parse (&argp_i, argc, argv, 0, 0, this); } @@ -113,7 +113,7 @@ class Arguments char *get_device() { - return device; + return &*device.begin(); } private: @@ -164,7 +164,7 @@ class Arguments outcsv = std::string(arg); break; case 'd': - device = arg; + device = std::string(arg); break; case ARGP_KEY_ARG: if (state->arg_num > 0){ @@ -197,7 +197,7 @@ class Arguments double step; double ptime; std::string outcsv; - char *device; + std::string device; }; argp_option Arguments::options[] = { diff --git a/scanner_sink.hpp b/scanner_sink.hpp index 504dea6..f0d5987 100644 --- a/scanner_sink.hpp +++ b/scanner_sink.hpp @@ -205,7 +205,7 @@ class scanner_sink : public gr::block } /* check to see if the signal is close to any other (the same signal often appears with a slightly different centre frequency) */ - BOOST_FOREACH (double signal, m_signals){ + for (double signal : m_signals){ if ((mid - signal < m_spread) && (signal - mid < m_spread)){ //tpo close return false; //if so, this is not a genuine hit } @@ -297,9 +297,9 @@ class scanner_sink : public gr::block }; /* Shared pointer thing gnuradio is fond of */ -typedef boost::shared_ptr scanner_sink_sptr; +typedef std::shared_ptr scanner_sink_sptr; scanner_sink_sptr make_scanner_sink(osmosdr::source::sptr source, unsigned int vector_length, double centre_freq_1, double centre_freq_2, double bandwidth0, double bandwidth1, double bandwidth2, double step, unsigned int avg_size, double spread, double threshold, double ptime, const std::string &outcsv) { - return boost::shared_ptr(new scanner_sink(source, vector_length, centre_freq_1, centre_freq_2, bandwidth0, bandwidth1, bandwidth2, step, avg_size, spread, threshold, ptime, outcsv)); + return std::shared_ptr(new scanner_sink(source, vector_length, centre_freq_1, centre_freq_2, bandwidth0, bandwidth1, bandwidth2, step, avg_size, spread, threshold, ptime, outcsv)); } diff --git a/topblock.hpp b/topblock.hpp index e530adc..7b93ac9 100644 --- a/topblock.hpp +++ b/topblock.hpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include @@ -37,13 +37,15 @@ class TopBlock : public gr::top_block public: TopBlock(double centre_freq_1, double centre_freq_2, double sample_rate, double fft_width, double bandwidth1, double bandwidth2, double step, unsigned int avg_size, double spread, double threshold, double ptime, const std::string &outcsv, char *device) : gr::top_block("Top Block"), - vector_length(sample_rate/fft_width), + vector_length( (sample_rate / fft_width) ), window(GetWindow(vector_length)), source(osmosdr::source::make(device)), /* OsmoSDR Source if device is null then it should auto pick the lowest index device*/ - stv(gr::blocks::stream_to_vector::make(sizeof(float)*2, vector_length)), /* Stream to vector */ - /* Based on the logpwrfft (a block implemented in python) */ - fft(gr::fft::fft_vcc::make(vector_length, true, window, false, 1)), + stv(gr::blocks::stream_to_vector::make(sizeof(float)*2, vector_length / 2)), /* Stream to vector */ + + // fft_size = vector_length + fft(gr::fft::fft_v::make(vector_length, window, false, 1)), + ctf(gr::blocks::complex_to_mag_squared::make(vector_length)), iir(gr::filter::single_pole_iir_filter_ff::make(1.0, vector_length)), lg(gr::blocks::nlog10_ff::make(10, vector_length, -20 * std::log10(float(vector_length)) -10 * std::log10(float(GetWindowPower()/vector_length)))), @@ -65,6 +67,8 @@ class TopBlock : public gr::top_block connect(ctf, 0, iir, 0); connect(iir, 0, lg, 0); connect(lg, 0, sink, 0); + // no known conversion for argument 3 from ‘scanner_sink_sptr’ {aka ‘boost::shared_ptr’} to ‘gr::basic_block_sptr’ {aka ‘std::shared_ptr’} + } private: @@ -88,7 +92,7 @@ class TopBlock : public gr::top_block double GetWindowPower() { double total = 0.0; - BOOST_FOREACH (double d, window){ + for (double d : window){ total += d*d; } return total; @@ -99,7 +103,10 @@ class TopBlock : public gr::top_block osmosdr::source::sptr source; gr::blocks::stream_to_vector::sptr stv; - gr::fft::fft_vcc::sptr fft; + + //template + gr::fft::fft_v::sptr fft; + gr::blocks::complex_to_mag_squared::sptr ctf; gr::filter::single_pole_iir_filter_ff::sptr iir; gr::blocks::nlog10_ff::sptr lg;