[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 01/02: qtgui: updating how freq message por
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 01/02: qtgui: updating how freq message ports work. |
Date: |
Mon, 7 Jul 2014 14:55:28 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
trondeau pushed a commit to branch master
in repository gnuradio.
commit eceee28baeed6ee0bdcb66f36992c2a5851ff3bd
Author: Tom Rondeau <address@hidden>
Date: Mon Jul 7 10:38:47 2014 -0400
qtgui: updating how freq message ports work.
Use absolte frequencies relative to sample rate and center freq.
Double-click does not retune, just sends message. Feedback to input freq
can be used to retune.
---
gr-qtgui/include/gnuradio/qtgui/freq_sink_c.h | 14 +++++++++-----
gr-qtgui/include/gnuradio/qtgui/freq_sink_f.h | 14 +++++++++-----
gr-qtgui/include/gnuradio/qtgui/sink_c.h | 14 +++++++++-----
gr-qtgui/include/gnuradio/qtgui/sink_f.h | 15 ++++++++++-----
gr-qtgui/include/gnuradio/qtgui/waterfall_sink_c.h | 14 +++++++++-----
gr-qtgui/include/gnuradio/qtgui/waterfall_sink_f.h | 14 +++++++++-----
gr-qtgui/lib/freq_sink_c_impl.cc | 10 ++++------
gr-qtgui/lib/freq_sink_f_impl.cc | 10 ++++------
gr-qtgui/lib/freqdisplayform.cc | 4 +---
gr-qtgui/lib/sink_c_impl.cc | 11 +++++------
gr-qtgui/lib/sink_c_impl.h | 2 +-
gr-qtgui/lib/sink_f_impl.cc | 20 ++++++++++++++------
gr-qtgui/lib/sink_f_impl.h | 3 ++-
gr-qtgui/lib/spectrumdisplayform.cc | 2 +-
gr-qtgui/lib/waterfall_sink_c_impl.cc | 10 ++++------
gr-qtgui/lib/waterfall_sink_f_impl.cc | 10 ++++------
gr-qtgui/lib/waterfalldisplayform.cc | 4 +---
17 files changed, 96 insertions(+), 75 deletions(-)
diff --git a/gr-qtgui/include/gnuradio/qtgui/freq_sink_c.h
b/gr-qtgui/include/gnuradio/qtgui/freq_sink_c.h
index d47b5e4..d02505c 100644
--- a/gr-qtgui/include/gnuradio/qtgui/freq_sink_c.h
+++ b/gr-qtgui/include/gnuradio/qtgui/freq_sink_c.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012,2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -56,11 +56,15 @@ namespace gr {
*
* - freq (output):
* Produces a PMT pair with (intern("freq"), double(frequency).
- * When a user double-clicks on the display, the frequency
- * that the cursor is on is used to retune the x-axis scale
- * to recenter onto the clicked frequency. A message
- * containing the new frequency is also produced and can be
+ * When a user double-clicks on the display, the block
+ * produces and emits a message containing the frequency of
+ * where on the x-axis the user clicked. This value can be
* used by other blocks to update their frequency setting.
+ *
+ * To perform click-to-tune behavior, this output 'freq'
+ * port can be redirected to this block's input 'freq' port
+ * to catch the message and update the center frequency of
+ * the display.
*/
class QTGUI_API freq_sink_c : virtual public sync_block
{
diff --git a/gr-qtgui/include/gnuradio/qtgui/freq_sink_f.h
b/gr-qtgui/include/gnuradio/qtgui/freq_sink_f.h
index 98ac018..81f9c0c 100644
--- a/gr-qtgui/include/gnuradio/qtgui/freq_sink_f.h
+++ b/gr-qtgui/include/gnuradio/qtgui/freq_sink_f.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012,2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -56,11 +56,15 @@ namespace gr {
*
* - freq (output):
* Produces a PMT pair with (intern("freq"), double(frequency).
- * When a user double-clicks on the display, the frequency
- * that the cursor is on is used to retune the x-axis scale
- * to recenter onto the clicked frequency. A message
- * containing the new frequency is also produced and can be
+ * When a user double-clicks on the display, the block
+ * produces and emits a message containing the frequency of
+ * where on the x-axis the user clicked. This value can be
* used by other blocks to update their frequency setting.
+ *
+ * To perform click-to-tune behavior, this output 'freq'
+ * port can be redirected to this block's input 'freq' port
+ * to catch the message and update the center frequency of
+ * the display.
*/
class QTGUI_API freq_sink_f : virtual public sync_block
{
diff --git a/gr-qtgui/include/gnuradio/qtgui/sink_c.h
b/gr-qtgui/include/gnuradio/qtgui/sink_c.h
index 74a9636..c1c8777 100644
--- a/gr-qtgui/include/gnuradio/qtgui/sink_c.h
+++ b/gr-qtgui/include/gnuradio/qtgui/sink_c.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2008,2009,2011,2012 Free Software Foundation, Inc.
+ * Copyright 2008,2009,2011,2012,2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -57,11 +57,15 @@ namespace gr {
*
* - freq (output):
* Produces a PMT pair with (intern("freq"), double(frequency).
- * When a user double-clicks on the display, the frequency
- * that the cursor is on is used to retune the x-axis scale
- * to recenter onto the clicked frequency. A message
- * containing the new frequency is also produced and can be
+ * When a user double-clicks on the display, the block
+ * produces and emits a message containing the frequency of
+ * where on the x-axis the user clicked. This value can be
* used by other blocks to update their frequency setting.
+ *
+ * To perform click-to-tune behavior, this output 'freq'
+ * port can be redirected to this block's input 'freq' port
+ * to catch the message and update the center frequency of
+ * the display.
*/
class QTGUI_API sink_c : virtual public block
{
diff --git a/gr-qtgui/include/gnuradio/qtgui/sink_f.h
b/gr-qtgui/include/gnuradio/qtgui/sink_f.h
index a371171..32854ec 100644
--- a/gr-qtgui/include/gnuradio/qtgui/sink_f.h
+++ b/gr-qtgui/include/gnuradio/qtgui/sink_f.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2008,2009,2011,2012 Free Software Foundation, Inc.
+ * Copyright 2008,2009,2011,2012,2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -57,11 +57,15 @@ namespace gr {
*
* - freq (output):
* Produces a PMT pair with (intern("freq"), double(frequency).
- * When a user double-clicks on the display, the frequency
- * that the cursor is on is used to retune the x-axis scale
- * to recenter onto the clicked frequency. A message
- * containing the new frequency is also produced and can be
+ * When a user double-clicks on the display, the block
+ * produces and emits a message containing the frequency of
+ * where on the x-axis the user clicked. This value can be
* used by other blocks to update their frequency setting.
+ *
+ * To perform click-to-tune behavior, this output 'freq'
+ * port can be redirected to this block's input 'freq' port
+ * to catch the message and update the center frequency of
+ * the display.
*/
class QTGUI_API sink_f : virtual public block
{
@@ -105,6 +109,7 @@ namespace gr {
virtual void set_frequency_range(const double centerfreq,
const double bandwidth) = 0;
virtual void set_fft_power_db(double min, double max) = 0;
+ virtual void enable_rf_freq(bool en) = 0;
//void set_time_domain_axis(double min, double max);
//void set_constellation_axis(double xmin, double xmax,
diff --git a/gr-qtgui/include/gnuradio/qtgui/waterfall_sink_c.h
b/gr-qtgui/include/gnuradio/qtgui/waterfall_sink_c.h
index 657bbae..bf73db3 100644
--- a/gr-qtgui/include/gnuradio/qtgui/waterfall_sink_c.h
+++ b/gr-qtgui/include/gnuradio/qtgui/waterfall_sink_c.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012,2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -62,11 +62,15 @@ namespace gr {
*
* - freq (output):
* Produces a PMT pair with (intern("freq"), double(frequency).
- * When a user double-clicks on the display, the frequency
- * that the cursor is on is used to retune the x-axis scale
- * to recenter onto the clicked frequency. A message
- * containing the new frequency is also produced and can be
+ * When a user double-clicks on the display, the block
+ * produces and emits a message containing the frequency of
+ * where on the x-axis the user clicked. This value can be
* used by other blocks to update their frequency setting.
+ *
+ * To perform click-to-tune behavior, this output 'freq'
+ * port can be redirected to this block's input 'freq' port
+ * to catch the message and update the center frequency of
+ * the display.
*/
class QTGUI_API waterfall_sink_c : virtual public sync_block
{
diff --git a/gr-qtgui/include/gnuradio/qtgui/waterfall_sink_f.h
b/gr-qtgui/include/gnuradio/qtgui/waterfall_sink_f.h
index c8fa9a0..bbfcc33 100644
--- a/gr-qtgui/include/gnuradio/qtgui/waterfall_sink_f.h
+++ b/gr-qtgui/include/gnuradio/qtgui/waterfall_sink_f.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012,2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -62,11 +62,15 @@ namespace gr {
*
* - freq (output):
* Produces a PMT pair with (intern("freq"), double(frequency).
- * When a user double-clicks on the display, the frequency
- * that the cursor is on is used to retune the x-axis scale
- * to recenter onto the clicked frequency. A message
- * containing the new frequency is also produced and can be
+ * When a user double-clicks on the display, the block
+ * produces and emits a message containing the frequency of
+ * where on the x-axis the user clicked. This value can be
* used by other blocks to update their frequency setting.
+ *
+ * To perform click-to-tune behavior, this output 'freq'
+ * port can be redirected to this block's input 'freq' port
+ * to catch the message and update the center frequency of
+ * the display.
*/
class QTGUI_API waterfall_sink_f : virtual public sync_block
{
diff --git a/gr-qtgui/lib/freq_sink_c_impl.cc b/gr-qtgui/lib/freq_sink_c_impl.cc
index 6e5822b..4b43967 100644
--- a/gr-qtgui/lib/freq_sink_c_impl.cc
+++ b/gr-qtgui/lib/freq_sink_c_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012,2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -470,11 +470,10 @@ namespace gr {
freq_sink_c_impl::check_clicked()
{
if(d_main_gui->checkClicked()) {
- d_center_freq = d_main_gui->getClickedFreq();
- double norm_freq = d_center_freq / d_bandwidth;
+ double freq = d_main_gui->getClickedFreq();
message_port_pub(pmt::mp("freq"),
pmt::cons(pmt::mp("freq"),
- pmt::from_double(norm_freq)));
+ pmt::from_double(freq)));
}
}
@@ -484,8 +483,7 @@ namespace gr {
if(pmt::is_pair(msg)) {
pmt::pmt_t x = pmt::cdr(msg);
if(pmt::is_real(x)) {
- double freq = pmt::to_double(x);
- d_center_freq = freq*d_bandwidth;
+ d_center_freq = pmt::to_double(x);
d_qApplication->postEvent(d_main_gui,
new SetFreqEvent(d_center_freq,
d_bandwidth));
}
diff --git a/gr-qtgui/lib/freq_sink_f_impl.cc b/gr-qtgui/lib/freq_sink_f_impl.cc
index 0d12e0c..ab6167d 100644
--- a/gr-qtgui/lib/freq_sink_f_impl.cc
+++ b/gr-qtgui/lib/freq_sink_f_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012,2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -473,11 +473,10 @@ namespace gr {
freq_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;
+ double freq = d_main_gui->getClickedFreq();
message_port_pub(pmt::mp("freq"),
pmt::cons(pmt::mp("freq"),
- pmt::from_double(norm_freq)));
+ pmt::from_double(freq)));
}
}
@@ -487,8 +486,7 @@ namespace gr {
if(pmt::is_pair(msg)) {
pmt::pmt_t x = pmt::cdr(msg);
if(pmt::is_real(x)) {
- double freq = pmt::to_double(x);
- d_center_freq = freq*d_bandwidth;
+ d_center_freq = pmt::to_double(x);
d_qApplication->postEvent(d_main_gui,
new SetFreqEvent(d_center_freq,
d_bandwidth));
}
diff --git a/gr-qtgui/lib/freqdisplayform.cc b/gr-qtgui/lib/freqdisplayform.cc
index ae62136..e9968df 100644
--- a/gr-qtgui/lib/freqdisplayform.cc
+++ b/gr-qtgui/lib/freqdisplayform.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012,2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -210,8 +210,6 @@ FreqDisplayForm::onPlotPointSelected(const QPointF p)
{
d_clicked = true;
d_clicked_freq = d_units*p.x();
-
- setFrequencyRange(d_clicked_freq, d_samp_rate);
}
bool
diff --git a/gr-qtgui/lib/sink_c_impl.cc b/gr-qtgui/lib/sink_c_impl.cc
index 01e60a6..bcd2c44 100644
--- a/gr-qtgui/lib/sink_c_impl.cc
+++ b/gr-qtgui/lib/sink_c_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
*
@@ -329,11 +329,10 @@ namespace gr {
sink_c_impl::check_clicked()
{
if(d_main_gui->checkClicked()) {
- d_center_freq = d_main_gui->getClickedFreq();
- double norm_freq = d_center_freq / d_bandwidth;
+ double freq = d_main_gui->getClickedFreq();
message_port_pub(pmt::mp("freq"),
pmt::cons(pmt::mp("freq"),
- pmt::from_double(norm_freq)));
+ pmt::from_double(freq)));
}
}
@@ -343,8 +342,8 @@ namespace gr {
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);
+ d_center_freq = pmt::to_double(x);
+ set_frequency_range(d_center_freq, d_bandwidth);
}
}
}
diff --git a/gr-qtgui/lib/sink_c_impl.h b/gr-qtgui/lib/sink_c_impl.h
index 0628bc2..87ce7ad 100644
--- a/gr-qtgui/lib/sink_c_impl.h
+++ b/gr-qtgui/lib/sink_c_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2008,2009,2011,2012 Free Software Foundation, Inc.
+ * Copyright 2008,2009,2011,2012,2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
diff --git a/gr-qtgui/lib/sink_f_impl.cc b/gr-qtgui/lib/sink_f_impl.cc
index 28ba314..67896b7 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
*
@@ -76,6 +76,9 @@ namespace gr {
// 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;
@@ -214,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)
@@ -315,11 +324,10 @@ namespace gr {
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;
+ double freq = d_main_gui->getClickedFreq();
message_port_pub(pmt::mp("freq"),
pmt::cons(pmt::mp("freq"),
- pmt::from_double(norm_freq)));
+ pmt::from_double(freq)));
}
}
@@ -329,8 +337,8 @@ namespace gr {
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);
+ d_center_freq = pmt::to_double(x);
+ set_frequency_range(d_center_freq, d_bandwidth);
}
}
}
diff --git a/gr-qtgui/lib/sink_f_impl.h b/gr-qtgui/lib/sink_f_impl.h
index 5b39d82..53494b9 100644
--- a/gr-qtgui/lib/sink_f_impl.h
+++ b/gr-qtgui/lib/sink_f_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2008,2009,2011,2012 Free Software Foundation, Inc.
+ * Copyright 2008,2009,2011,2012,2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -98,6 +98,7 @@ namespace gr {
void set_frequency_range(const double centerfreq,
const double bandwidth);
void set_fft_power_db(double min, double max);
+ void enable_rf_freq(bool en);
//void set_time_domain_axis(double min, double max);
//void set_constellation_axis(double xmin, double xmax,
diff --git a/gr-qtgui/lib/spectrumdisplayform.cc
b/gr-qtgui/lib/spectrumdisplayform.cc
index ca9d981..8c67b7a 100644
--- a/gr-qtgui/lib/spectrumdisplayform.cc
+++ b/gr-qtgui/lib/spectrumdisplayform.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2008-2011 Free Software Foundation, Inc.
+ * Copyright 2008-2011,2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
diff --git a/gr-qtgui/lib/waterfall_sink_c_impl.cc
b/gr-qtgui/lib/waterfall_sink_c_impl.cc
index ff3cf36..8cb3f1a 100644
--- a/gr-qtgui/lib/waterfall_sink_c_impl.cc
+++ b/gr-qtgui/lib/waterfall_sink_c_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012,2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -432,11 +432,10 @@ namespace gr {
waterfall_sink_c_impl::check_clicked()
{
if(d_main_gui->checkClicked()) {
- d_center_freq = d_main_gui->getClickedFreq();
- double norm_freq = d_center_freq / d_bandwidth;
+ double freq = d_main_gui->getClickedFreq();
message_port_pub(pmt::mp("freq"),
pmt::cons(pmt::mp("freq"),
- pmt::from_double(norm_freq)));
+ pmt::from_double(freq)));
}
}
@@ -446,8 +445,7 @@ namespace gr {
if(pmt::is_pair(msg)) {
pmt::pmt_t x = pmt::cdr(msg);
if(pmt::is_real(x)) {
- double freq = pmt::to_double(x);
- d_center_freq = freq*d_bandwidth;
+ d_center_freq = pmt::to_double(x);
d_qApplication->postEvent(d_main_gui,
new SetFreqEvent(d_center_freq,
d_bandwidth));
}
diff --git a/gr-qtgui/lib/waterfall_sink_f_impl.cc
b/gr-qtgui/lib/waterfall_sink_f_impl.cc
index 9facec4..1c1453c 100644
--- a/gr-qtgui/lib/waterfall_sink_f_impl.cc
+++ b/gr-qtgui/lib/waterfall_sink_f_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012,2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -433,11 +433,10 @@ namespace gr {
waterfall_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;
+ double freq = d_main_gui->getClickedFreq();
message_port_pub(pmt::mp("freq"),
pmt::cons(pmt::mp("freq"),
- pmt::from_double(norm_freq)));
+ pmt::from_double(freq)));
}
}
@@ -447,8 +446,7 @@ namespace gr {
if(pmt::is_pair(msg)) {
pmt::pmt_t x = pmt::cdr(msg);
if(pmt::is_real(x)) {
- double freq = pmt::to_double(x);
- d_center_freq = freq*d_bandwidth;
+ d_center_freq = pmt::to_double(x);
d_qApplication->postEvent(d_main_gui,
new SetFreqEvent(d_center_freq,
d_bandwidth));
}
diff --git a/gr-qtgui/lib/waterfalldisplayform.cc
b/gr-qtgui/lib/waterfalldisplayform.cc
index fa6c2f7..51f518f 100644
--- a/gr-qtgui/lib/waterfalldisplayform.cc
+++ b/gr-qtgui/lib/waterfalldisplayform.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012,2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -282,8 +282,6 @@ WaterfallDisplayForm::onPlotPointSelected(const QPointF p)
{
d_clicked = true;
d_clicked_freq = d_units*p.x();
-
- setFrequencyRange(d_clicked_freq, d_samp_rate);
}
bool