diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-02-11 22:49:23 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-02-11 22:49:23 +0100 |
commit | 25030f6063e796e5cb048ffc1ec7e1914192146b (patch) | |
tree | 0c346ad6d8a635aca22fd290e741281147a561cc | |
parent | Typo (diff) | |
download | gr-scan-master.tar.xz gr-scan-master.zip |
-rw-r--r-- | arguments.hpp | 10 | ||||
-rw-r--r-- | main.cpp | 3 | ||||
-rw-r--r-- | topblock.hpp | 5 |
3 files changed, 15 insertions, 3 deletions
diff --git a/arguments.hpp b/arguments.hpp index 8075236..9b25112 100644 --- a/arguments.hpp +++ b/arguments.hpp @@ -106,6 +106,11 @@ public: return outcsv; } + std::string get_device_args() + { + return device_args; + } + private: static error_t s_parse_opt(int key, char *arg, struct argp_state *state) { @@ -153,6 +158,9 @@ private: case 'o': outcsv = std::string(arg); break; + case 'd': + device_args = std::string(arg); + break; case ARGP_KEY_ARG: if (state->arg_num > 0) argp_usage(state); @@ -180,6 +188,7 @@ private: double step; double ptime; std::string outcsv; + std::string device_args; }; argp_option Arguments::options[] = { @@ -195,6 +204,7 @@ argp_option Arguments::options[] = { {"step", 'z', "FREQ", 0, "Increment step in MHz (default: sample-rate / 4)"}, {"time", 'p', "TIME", 0, "Time in seconds to scan on each frequency (default: 1)"}, {"output-csv", 'o', "OUTCSV", 0, "Output results to CSV file (default: [none])"}, + {"device-args", 'd', "DEVICEARGS", 0, "Device arguments for OsmoSDR (default: [none])"}, {0} }; @@ -38,7 +38,8 @@ int main(int argc, char **argv) arguments.get_spread(), arguments.get_threshold(), arguments.get_time(), - arguments.get_outcsv()); + arguments.get_outcsv(), + arguments.get_device_args()); 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 33e9484..d341a71 100644 --- a/topblock.hpp +++ b/topblock.hpp @@ -36,11 +36,12 @@ 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) : + double threshold, double ptime, const std::string &outcsv, + const std::string &device_args) : 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_args)), /* OsmoSDR Source */ 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)), |