diff options
Diffstat (limited to 'gr-qtgui/lib/sink_f_impl.cc')
-rw-r--r-- | gr-qtgui/lib/sink_f_impl.cc | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/gr-qtgui/lib/sink_f_impl.cc b/gr-qtgui/lib/sink_f_impl.cc index 0a0e119181..67896b71df 100644 --- a/gr-qtgui/lib/sink_f_impl.cc +++ b/gr-qtgui/lib/sink_f_impl.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2008-2012 Free Software Foundation, Inc. + * Copyright 2008-2012,2014 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -73,6 +73,13 @@ 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")); + message_port_register_in(pmt::mp("freq")); + set_msg_handler(pmt::mp("freq"), + boost::bind(&sink_f_impl::handle_set_freq, this, _1)); + d_main_gui = NULL; // Perform fftshift operation; @@ -210,6 +217,12 @@ namespace gr { d_main_gui->setFrequencyAxis(min, max); } + void + sink_f_impl::enable_rf_freq(bool en) + { + d_main_gui->enableRFFreq(en); + } + /* void sink_f_impl::set_time_domain_axis(double min, double max) @@ -307,6 +320,29 @@ namespace gr { } } + void + sink_f_impl::check_clicked() + { + if(d_main_gui->checkClicked()) { + double freq = d_main_gui->getClickedFreq(); + message_port_pub(pmt::mp("freq"), + pmt::cons(pmt::mp("freq"), + pmt::from_double(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)) { + d_center_freq = pmt::to_double(x); + set_frequency_range(d_center_freq, d_bandwidth); + } + } + } + int sink_f_impl::general_work(int noutput_items, gr_vector_int &ninput_items, @@ -319,6 +355,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; |