diff --git a/grc_blocks/include/hydra/hydra_gr_server.h b/grc_blocks/include/hydra/hydra_gr_server.h index d8d2771..6769da5 100644 --- a/grc_blocks/include/hydra/hydra_gr_server.h +++ b/grc_blocks/include/hydra/hydra_gr_server.h @@ -9,25 +9,25 @@ namespace gr { namespace hydra { - class HYDRA_API hydra_gr_server : virtual public gr::hier_block2 - { - public: - typedef boost::shared_ptr sptr; +class HYDRA_API hydra_gr_server : virtual public gr::hier_block2 +{ + public: + typedef boost::shared_ptr sptr; - static sptr make(std::string server_addr); + static sptr make(std::string server_addr); - virtual void set_tx_config(double d_center_frequency, - double d_samp_rate, - size_t d_tx_fft_size, - std::string mode) = 0; + virtual void set_tx_config(double d_center_frequency, + double d_samp_rate, + size_t d_tx_fft_size, + std::string mode) = 0; - virtual void set_rx_config(double d_center_frequency, - double d_samp_rate, - size_t d_tx_fft_size, - std::string mode) = 0; + virtual void set_rx_config(double d_center_frequency, + double d_samp_rate, + size_t d_tx_fft_size, + std::string mode) = 0; - virtual void start_server() = 0; - }; + virtual void start_server() = 0; +}; } // namespace hydra } // namespace gr diff --git a/grc_blocks/lib/hydra_gr_client_source_impl.h b/grc_blocks/lib/hydra_gr_client_source_impl.h index 65934b7..326d050 100644 --- a/grc_blocks/lib/hydra_gr_client_source_impl.h +++ b/grc_blocks/lib/hydra_gr_client_source_impl.h @@ -4,7 +4,6 @@ #include "hydra/hydra_gr_client_source.h" #include "hydra/hydra_client.h" - #include #include diff --git a/grc_blocks/lib/hydra_gr_server_impl.h b/grc_blocks/lib/hydra_gr_server_impl.h index 817ff29..17eed8d 100644 --- a/grc_blocks/lib/hydra_gr_server_impl.h +++ b/grc_blocks/lib/hydra_gr_server_impl.h @@ -6,7 +6,6 @@ #include #include #include -#include using namespace hydra; diff --git a/include/hydra/hydra_fft.h b/include/hydra/hydra_fft.h index f3bf2ba..dc256b3 100644 --- a/include/hydra/hydra_fft.h +++ b/include/hydra/hydra_fft.h @@ -1,17 +1,17 @@ /* -*- c++ -*- */ -/* +/* * Copyright 2016 Trinity Connect Centre. - * + * * HyDRA is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * HyDRA is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this software; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, @@ -31,15 +31,8 @@ namespace hydra { -class fft_complex +class fft_complex { - private: - size_t g_fft_size; - bool g_forward; - gr_complex *g_inbuf; - gr_complex *g_outbuf; - fftwf_plan g_plan; - public: /** CTOR * @param fft_size @@ -49,7 +42,10 @@ class fft_complex /** */ - int set_data(const gr_complex *data, size_t len); + void set_data(const gr_complex *data, size_t len); + + void reset_inbuf(); + void reset_outbuf(); /** */ @@ -63,6 +59,13 @@ class fft_complex /** */ void execute(); + + private: + size_t g_fft_size; + bool g_forward; + gr_complex *g_inbuf; + gr_complex *g_outbuf; + fftwf_plan g_plan; }; /* TYPEDEFS for this class */ diff --git a/lib/hydra_fft.cc b/lib/hydra_fft.cc index 133266d..f1956e4 100644 --- a/lib/hydra_fft.cc +++ b/lib/hydra_fft.cc @@ -1,17 +1,17 @@ /* -*- c++ -*- */ -/* +/* * Copyright 2016 Trinity Connect Centre. - * + * * HyDRA is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * HyDRA is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this software; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, @@ -36,13 +36,25 @@ fft_complex::fft_complex(size_t fft_size, bool forward): FFTW_MEASURE); } -int +void fft_complex::set_data(const gr_complex *data, size_t len) { // Copy samples to fft buffer std::copy(data, data + len, g_inbuf); } +void +fft_complex::reset_inbuf() +{ + std::fill(g_inbuf, g_inbuf + g_fft_size, 0); +} + +void +fft_complex::reset_outbuf() +{ + std::fill(g_outbuf, g_outbuf + g_fft_size, 0); +} + gr_complex* fft_complex::get_inbuf() { diff --git a/lib/hydra_hypervisor.cc b/lib/hydra_hypervisor.cc index 83c14b4..69a08e2 100644 --- a/lib/hydra_hypervisor.cc +++ b/lib/hydra_hypervisor.cc @@ -1,17 +1,17 @@ /* -*- c++ -*- */ -/* +/* * Copyright 2016 Trinity Connect Centre. - * + * * HyDRA is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * HyDRA is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this software; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, @@ -28,7 +28,6 @@ namespace hydra { - Hypervisor::Hypervisor() { } @@ -224,6 +223,8 @@ Hypervisor::get_tx_window(window &optr, size_t len) if (g_vradios.size() == 0) return 0; { + g_ifft_complex->reset_inbuf(); + std::lock_guard _l(vradios_mtx); for (vradio_vec::iterator it = g_vradios.begin();