diff options
Diffstat (limited to 'gr-qtgui/lib/sink_f_impl.cc')
-rw-r--r-- | gr-qtgui/lib/sink_f_impl.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gr-qtgui/lib/sink_f_impl.cc b/gr-qtgui/lib/sink_f_impl.cc index 0a0e119181..28ba314df8 100644 --- a/gr-qtgui/lib/sink_f_impl.cc +++ b/gr-qtgui/lib/sink_f_impl.cc @@ -73,6 +73,10 @@ namespace gr { d_argv = new char; d_argv[0] = '\0'; + // setup output message port to post frequency when display is + // double-clicked + message_port_register_out(pmt::mp("freq")); + d_main_gui = NULL; // Perform fftshift operation; @@ -307,6 +311,30 @@ namespace gr { } } + void + sink_f_impl::check_clicked() + { + if(d_main_gui->checkClicked()) { + d_center_freq = d_main_gui->getClickedFreq(); + double norm_freq = d_center_freq / d_bandwidth; + message_port_pub(pmt::mp("freq"), + pmt::cons(pmt::mp("freq"), + pmt::from_double(norm_freq))); + } + } + + void + sink_f_impl::handle_set_freq(pmt::pmt_t msg) + { + if(pmt::is_pair(msg)) { + pmt::pmt_t x = pmt::cdr(msg); + if(pmt::is_real(x)) { + double freq = pmt::to_double(x); + set_frequency_range(freq*d_bandwidth, d_bandwidth); + } + } + } + int sink_f_impl::general_work(int noutput_items, gr_vector_int &ninput_items, @@ -319,6 +347,7 @@ namespace gr { // Update the FFT size from the application fftresize(); windowreset(); + check_clicked(); for(int i=0; i < noutput_items; i+=d_fftsize) { unsigned int datasize = noutput_items - i; |