From c0692647cce3c136dee4d92f8e99a77539dbd0bd Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 21 Apr 2011 19:10:27 -0400 Subject: gr-qtgui: adding time-domain plot specific event updater. --- gr-qtgui/lib/spectrumUpdateEvents.cc | 56 ++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'gr-qtgui/lib/spectrumUpdateEvents.cc') diff --git a/gr-qtgui/lib/spectrumUpdateEvents.cc b/gr-qtgui/lib/spectrumUpdateEvents.cc index 53a205fb7..ab5ef3be5 100644 --- a/gr-qtgui/lib/spectrumUpdateEvents.cc +++ b/gr-qtgui/lib/spectrumUpdateEvents.cc @@ -177,4 +177,60 @@ SpectrumFrequencyRangeEvent::GetStopFrequency() const return _stopFrequency; } + +/***************************************************************************/ + +TimeUpdateEvent::TimeUpdateEvent(const gr_complex *timeDomainPoints, + const uint64_t numTimeDomainDataPoints, + const timespec dataTimestamp, + const bool repeatDataFlag) + : QEvent(QEvent::Type(10005)) +{ + if(numTimeDomainDataPoints < 1) { + _numTimeDomainDataPoints = 1; + } + else { + _numTimeDomainDataPoints = numTimeDomainDataPoints; + } + + _dataTimeDomainPoints = new gr_complex[_numTimeDomainDataPoints]; + memset(_dataTimeDomainPoints, 0x0, _numTimeDomainDataPoints*sizeof(gr_complex)); + if(numTimeDomainDataPoints > 0) { + memcpy(_dataTimeDomainPoints, timeDomainPoints, + numTimeDomainDataPoints*sizeof(gr_complex)); + } + + _dataTimestamp = dataTimestamp; + _repeatDataFlag = repeatDataFlag; +} + +TimeUpdateEvent::~TimeUpdateEvent() +{ + delete[] _dataTimeDomainPoints; +} + +const gr_complex* +TimeUpdateEvent::getTimeDomainPoints() const +{ + return _dataTimeDomainPoints; +} + +uint64_t +TimeUpdateEvent::getNumTimeDomainDataPoints() const +{ + return _numTimeDomainDataPoints; +} + +timespec +TimeUpdateEvent::getDataTimestamp() const +{ + return _dataTimestamp; +} + +bool +TimeUpdateEvent::getRepeatDataFlag() const +{ + return _repeatDataFlag; +} + #endif /* SPECTRUM_UPDATE_EVENTS_C */ -- cgit From bbb5e850224aca9dae15d24bd898cc56232327c9 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sat, 23 Apr 2011 12:00:54 -0400 Subject: gr-qtgui: setting up ability to have multiple connections to the time sink. --- gr-qtgui/lib/spectrumUpdateEvents.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gr-qtgui/lib/spectrumUpdateEvents.cc') diff --git a/gr-qtgui/lib/spectrumUpdateEvents.cc b/gr-qtgui/lib/spectrumUpdateEvents.cc index ab5ef3be5..7d297a0d2 100644 --- a/gr-qtgui/lib/spectrumUpdateEvents.cc +++ b/gr-qtgui/lib/spectrumUpdateEvents.cc @@ -180,7 +180,7 @@ SpectrumFrequencyRangeEvent::GetStopFrequency() const /***************************************************************************/ -TimeUpdateEvent::TimeUpdateEvent(const gr_complex *timeDomainPoints, +TimeUpdateEvent::TimeUpdateEvent(const std::vector &timeDomainPoints, const uint64_t numTimeDomainDataPoints, const timespec dataTimestamp, const bool repeatDataFlag) @@ -196,7 +196,7 @@ TimeUpdateEvent::TimeUpdateEvent(const gr_complex *timeDomainPoints, _dataTimeDomainPoints = new gr_complex[_numTimeDomainDataPoints]; memset(_dataTimeDomainPoints, 0x0, _numTimeDomainDataPoints*sizeof(gr_complex)); if(numTimeDomainDataPoints > 0) { - memcpy(_dataTimeDomainPoints, timeDomainPoints, + memcpy(_dataTimeDomainPoints, timeDomainPoints[0], numTimeDomainDataPoints*sizeof(gr_complex)); } -- cgit From 01f44f64c916b4aa38bc81662d2c8b82c4cc0b57 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sat, 23 Apr 2011 14:30:32 -0400 Subject: gr-qtgui: moving towards allowing time plot to have multiple connections. --- gr-qtgui/lib/spectrumUpdateEvents.cc | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'gr-qtgui/lib/spectrumUpdateEvents.cc') diff --git a/gr-qtgui/lib/spectrumUpdateEvents.cc b/gr-qtgui/lib/spectrumUpdateEvents.cc index 7d297a0d2..037225760 100644 --- a/gr-qtgui/lib/spectrumUpdateEvents.cc +++ b/gr-qtgui/lib/spectrumUpdateEvents.cc @@ -179,13 +179,15 @@ SpectrumFrequencyRangeEvent::GetStopFrequency() const /***************************************************************************/ - -TimeUpdateEvent::TimeUpdateEvent(const std::vector &timeDomainPoints, +#include +TimeUpdateEvent::TimeUpdateEvent(const int which, + const double *timeDomainPoints, const uint64_t numTimeDomainDataPoints, const timespec dataTimestamp, const bool repeatDataFlag) : QEvent(QEvent::Type(10005)) { + _which = which; if(numTimeDomainDataPoints < 1) { _numTimeDomainDataPoints = 1; } @@ -193,11 +195,11 @@ TimeUpdateEvent::TimeUpdateEvent(const std::vector &timeDomainPoint _numTimeDomainDataPoints = numTimeDomainDataPoints; } - _dataTimeDomainPoints = new gr_complex[_numTimeDomainDataPoints]; - memset(_dataTimeDomainPoints, 0x0, _numTimeDomainDataPoints*sizeof(gr_complex)); + _dataTimeDomainPoints = new double[_numTimeDomainDataPoints]; + memset(_dataTimeDomainPoints, 0x0, _numTimeDomainDataPoints*sizeof(double)); if(numTimeDomainDataPoints > 0) { - memcpy(_dataTimeDomainPoints, timeDomainPoints[0], - numTimeDomainDataPoints*sizeof(gr_complex)); + memcpy(_dataTimeDomainPoints, timeDomainPoints, + numTimeDomainDataPoints*sizeof(double)); } _dataTimestamp = dataTimestamp; @@ -209,7 +211,13 @@ TimeUpdateEvent::~TimeUpdateEvent() delete[] _dataTimeDomainPoints; } -const gr_complex* +int +TimeUpdateEvent::which() const +{ + return _which; +} + +const double* TimeUpdateEvent::getTimeDomainPoints() const { return _dataTimeDomainPoints; -- cgit From 0877adb2e194c9dfad2484519b2979e2bed93958 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sat, 23 Apr 2011 15:11:17 -0400 Subject: gr-qtgui: Passing vectors of data to update plot for stability; also moving responsibility of keeping track of plot updates out to qtgui_sink instead of inside plot qidget. --- gr-qtgui/lib/spectrumUpdateEvents.cc | 48 +++++++++++------------------------- 1 file changed, 14 insertions(+), 34 deletions(-) (limited to 'gr-qtgui/lib/spectrumUpdateEvents.cc') diff --git a/gr-qtgui/lib/spectrumUpdateEvents.cc b/gr-qtgui/lib/spectrumUpdateEvents.cc index 037225760..6730ae51d 100644 --- a/gr-qtgui/lib/spectrumUpdateEvents.cc +++ b/gr-qtgui/lib/spectrumUpdateEvents.cc @@ -180,14 +180,10 @@ SpectrumFrequencyRangeEvent::GetStopFrequency() const /***************************************************************************/ #include -TimeUpdateEvent::TimeUpdateEvent(const int which, - const double *timeDomainPoints, - const uint64_t numTimeDomainDataPoints, - const timespec dataTimestamp, - const bool repeatDataFlag) +TimeUpdateEvent::TimeUpdateEvent(const std::vector timeDomainPoints, + const uint64_t numTimeDomainDataPoints) : QEvent(QEvent::Type(10005)) { - _which = which; if(numTimeDomainDataPoints < 1) { _numTimeDomainDataPoints = 1; } @@ -195,29 +191,25 @@ TimeUpdateEvent::TimeUpdateEvent(const int which, _numTimeDomainDataPoints = numTimeDomainDataPoints; } - _dataTimeDomainPoints = new double[_numTimeDomainDataPoints]; - memset(_dataTimeDomainPoints, 0x0, _numTimeDomainDataPoints*sizeof(double)); - if(numTimeDomainDataPoints > 0) { - memcpy(_dataTimeDomainPoints, timeDomainPoints, - numTimeDomainDataPoints*sizeof(double)); - } + _nplots = timeDomainPoints.size(); + for(size_t i = 0; i < _nplots; i++) { + _dataTimeDomainPoints.push_back(new double[_numTimeDomainDataPoints]); - _dataTimestamp = dataTimestamp; - _repeatDataFlag = repeatDataFlag; + if(numTimeDomainDataPoints > 0) { + memcpy(_dataTimeDomainPoints[i], timeDomainPoints[i], + numTimeDomainDataPoints*sizeof(double)); + } + } } TimeUpdateEvent::~TimeUpdateEvent() { - delete[] _dataTimeDomainPoints; -} - -int -TimeUpdateEvent::which() const -{ - return _which; + for(size_t i = 0; i < _nplots; i++) { + delete[] _dataTimeDomainPoints[i]; + } } -const double* +const std::vector TimeUpdateEvent::getTimeDomainPoints() const { return _dataTimeDomainPoints; @@ -229,16 +221,4 @@ TimeUpdateEvent::getNumTimeDomainDataPoints() const return _numTimeDomainDataPoints; } -timespec -TimeUpdateEvent::getDataTimestamp() const -{ - return _dataTimestamp; -} - -bool -TimeUpdateEvent::getRepeatDataFlag() const -{ - return _repeatDataFlag; -} - #endif /* SPECTRUM_UPDATE_EVENTS_C */ -- cgit From 350611ddd9295ba8af6ea5913630ec0670208b43 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sat, 23 Apr 2011 23:56:52 -0400 Subject: gr-qtgui: multiple connections working, each with their own color. --- gr-qtgui/lib/spectrumUpdateEvents.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'gr-qtgui/lib/spectrumUpdateEvents.cc') diff --git a/gr-qtgui/lib/spectrumUpdateEvents.cc b/gr-qtgui/lib/spectrumUpdateEvents.cc index 6730ae51d..ae4caf31a 100644 --- a/gr-qtgui/lib/spectrumUpdateEvents.cc +++ b/gr-qtgui/lib/spectrumUpdateEvents.cc @@ -194,10 +194,9 @@ TimeUpdateEvent::TimeUpdateEvent(const std::vector timeDomainPoints, _nplots = timeDomainPoints.size(); for(size_t i = 0; i < _nplots; i++) { _dataTimeDomainPoints.push_back(new double[_numTimeDomainDataPoints]); - if(numTimeDomainDataPoints > 0) { memcpy(_dataTimeDomainPoints[i], timeDomainPoints[i], - numTimeDomainDataPoints*sizeof(double)); + _numTimeDomainDataPoints*sizeof(double)); } } } -- cgit