From befadabc2f18b483c71250adfd7dbf42f66b16f0 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 27 Mar 2011 12:55:16 -0400 Subject: gr-qtgui: restructuring qtgui directory to new layout. --- gr-qtgui/lib/spectrumUpdateEvents.cc | 180 +++++++++++++++++++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 gr-qtgui/lib/spectrumUpdateEvents.cc (limited to 'gr-qtgui/lib/spectrumUpdateEvents.cc') diff --git a/gr-qtgui/lib/spectrumUpdateEvents.cc b/gr-qtgui/lib/spectrumUpdateEvents.cc new file mode 100644 index 000000000..53a205fb7 --- /dev/null +++ b/gr-qtgui/lib/spectrumUpdateEvents.cc @@ -0,0 +1,180 @@ +#ifndef SPECTRUM_UPDATE_EVENTS_C +#define SPECTRUM_UPDATE_EVENTS_C + +#include + +SpectrumUpdateEvent::SpectrumUpdateEvent(const std::complex* fftPoints, + const uint64_t numFFTDataPoints, + const double* realTimeDomainPoints, + const double* imagTimeDomainPoints, + const uint64_t numTimeDomainDataPoints, + const timespec dataTimestamp, + const bool repeatDataFlag, + const bool lastOfMultipleUpdateFlag, + const timespec generatedTimestamp, + const int droppedFFTFrames) + : QEvent(QEvent::Type(10005)) +{ + if(numFFTDataPoints < 1) { + _numFFTDataPoints = 1; + } + else { + _numFFTDataPoints = numFFTDataPoints; + } + + if(numTimeDomainDataPoints < 1) { + _numTimeDomainDataPoints = 1; + } + else { + _numTimeDomainDataPoints = numTimeDomainDataPoints; + } + + _fftPoints = new std::complex[_numFFTDataPoints]; + _fftPoints[0] = std::complex(0,0); + memcpy(_fftPoints, fftPoints, numFFTDataPoints*sizeof(std::complex)); + + _realDataTimeDomainPoints = new double[_numTimeDomainDataPoints]; + memset(_realDataTimeDomainPoints, 0x0, _numTimeDomainDataPoints*sizeof(double)); + if(numTimeDomainDataPoints > 0) { + memcpy(_realDataTimeDomainPoints, realTimeDomainPoints, + numTimeDomainDataPoints*sizeof(double)); + } + + _imagDataTimeDomainPoints = new double[_numTimeDomainDataPoints]; + memset(_imagDataTimeDomainPoints, 0x0, _numTimeDomainDataPoints*sizeof(double)); + if(numTimeDomainDataPoints > 0) { + memcpy(_imagDataTimeDomainPoints, imagTimeDomainPoints, + numTimeDomainDataPoints*sizeof(double)); + } + _dataTimestamp = dataTimestamp; + _repeatDataFlag = repeatDataFlag; + _lastOfMultipleUpdateFlag = lastOfMultipleUpdateFlag; + _eventGeneratedTimestamp = generatedTimestamp; + _droppedFFTFrames = droppedFFTFrames; +} + +SpectrumUpdateEvent::~SpectrumUpdateEvent() +{ + delete[] _fftPoints; + delete[] _realDataTimeDomainPoints; + delete[] _imagDataTimeDomainPoints; +} + +const std::complex* +SpectrumUpdateEvent::getFFTPoints() const +{ + return _fftPoints; +} + +const double* +SpectrumUpdateEvent::getRealTimeDomainPoints() const +{ + return _realDataTimeDomainPoints; +} + +const double* +SpectrumUpdateEvent::getImagTimeDomainPoints() const +{ + return _imagDataTimeDomainPoints; +} + +uint64_t +SpectrumUpdateEvent::getNumFFTDataPoints() const +{ + return _numFFTDataPoints; +} + +uint64_t +SpectrumUpdateEvent::getNumTimeDomainDataPoints() const +{ + return _numTimeDomainDataPoints; +} + +timespec +SpectrumUpdateEvent::getDataTimestamp() const +{ + return _dataTimestamp; +} + +bool +SpectrumUpdateEvent::getRepeatDataFlag() const +{ + return _repeatDataFlag; +} + +bool +SpectrumUpdateEvent::getLastOfMultipleUpdateFlag() const +{ + return _lastOfMultipleUpdateFlag; +} + +timespec +SpectrumUpdateEvent::getEventGeneratedTimestamp() const +{ + return _eventGeneratedTimestamp; +} + +int +SpectrumUpdateEvent::getDroppedFFTFrames() const +{ + return _droppedFFTFrames; +} + +SpectrumWindowCaptionEvent::SpectrumWindowCaptionEvent(const QString& newLbl) + : QEvent(QEvent::Type(10008)) +{ + _labelString = newLbl; +} + +SpectrumWindowCaptionEvent::~SpectrumWindowCaptionEvent() +{ +} + +QString +SpectrumWindowCaptionEvent::getLabel() +{ + return _labelString; +} + +SpectrumWindowResetEvent::SpectrumWindowResetEvent() + : QEvent(QEvent::Type(10009)) +{ +} + +SpectrumWindowResetEvent::~SpectrumWindowResetEvent() +{ +} + +SpectrumFrequencyRangeEvent::SpectrumFrequencyRangeEvent(const double centerFreq, + const double startFreq, + const double stopFreq) + : QEvent(QEvent::Type(10010)) +{ + _centerFrequency = centerFreq; + _startFrequency = startFreq; + _stopFrequency = stopFreq; +} + +SpectrumFrequencyRangeEvent::~SpectrumFrequencyRangeEvent() +{ +} + +double +SpectrumFrequencyRangeEvent::GetCenterFrequency() const +{ + return _centerFrequency; +} + +double +SpectrumFrequencyRangeEvent::GetStartFrequency() const +{ + return _startFrequency; +} + +double +SpectrumFrequencyRangeEvent::GetStopFrequency() const +{ + return _stopFrequency; +} + +#endif /* SPECTRUM_UPDATE_EVENTS_C */ -- cgit 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 From 697562c3d4319ab6f13e4c2910a853409731595d Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 7 Jun 2011 21:48:02 -0400 Subject: qtgui: replace timespec with typedef so its easier to replace --- gr-qtgui/lib/spectrumUpdateEvents.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gr-qtgui/lib/spectrumUpdateEvents.cc') diff --git a/gr-qtgui/lib/spectrumUpdateEvents.cc b/gr-qtgui/lib/spectrumUpdateEvents.cc index ae4caf31a..6d7ca2701 100644 --- a/gr-qtgui/lib/spectrumUpdateEvents.cc +++ b/gr-qtgui/lib/spectrumUpdateEvents.cc @@ -8,10 +8,10 @@ SpectrumUpdateEvent::SpectrumUpdateEvent(const std::complex* fftPoints, const double* realTimeDomainPoints, const double* imagTimeDomainPoints, const uint64_t numTimeDomainDataPoints, - const timespec dataTimestamp, + const highres_timespec dataTimestamp, const bool repeatDataFlag, const bool lastOfMultipleUpdateFlag, - const timespec generatedTimestamp, + const highres_timespec generatedTimestamp, const int droppedFFTFrames) : QEvent(QEvent::Type(10005)) { @@ -90,7 +90,7 @@ SpectrumUpdateEvent::getNumTimeDomainDataPoints() const return _numTimeDomainDataPoints; } -timespec +highres_timespec SpectrumUpdateEvent::getDataTimestamp() const { return _dataTimestamp; @@ -108,7 +108,7 @@ SpectrumUpdateEvent::getLastOfMultipleUpdateFlag() const return _lastOfMultipleUpdateFlag; } -timespec +highres_timespec SpectrumUpdateEvent::getEventGeneratedTimestamp() const { return _eventGeneratedTimestamp; -- cgit From bbf11bb338a4a88a1f270f77649212fea0b0cab0 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 7 Jun 2011 22:55:41 -0400 Subject: qtgui: removed all traces of highResTimeFunctions.h --- gr-qtgui/lib/spectrumUpdateEvents.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gr-qtgui/lib/spectrumUpdateEvents.cc') diff --git a/gr-qtgui/lib/spectrumUpdateEvents.cc b/gr-qtgui/lib/spectrumUpdateEvents.cc index 6d7ca2701..9be2f5357 100644 --- a/gr-qtgui/lib/spectrumUpdateEvents.cc +++ b/gr-qtgui/lib/spectrumUpdateEvents.cc @@ -8,10 +8,10 @@ SpectrumUpdateEvent::SpectrumUpdateEvent(const std::complex* fftPoints, const double* realTimeDomainPoints, const double* imagTimeDomainPoints, const uint64_t numTimeDomainDataPoints, - const highres_timespec dataTimestamp, + const gruel::high_res_timer_type dataTimestamp, const bool repeatDataFlag, const bool lastOfMultipleUpdateFlag, - const highres_timespec generatedTimestamp, + const gruel::high_res_timer_type generatedTimestamp, const int droppedFFTFrames) : QEvent(QEvent::Type(10005)) { @@ -90,7 +90,7 @@ SpectrumUpdateEvent::getNumTimeDomainDataPoints() const return _numTimeDomainDataPoints; } -highres_timespec +gruel::high_res_timer_type SpectrumUpdateEvent::getDataTimestamp() const { return _dataTimestamp; @@ -108,7 +108,7 @@ SpectrumUpdateEvent::getLastOfMultipleUpdateFlag() const return _lastOfMultipleUpdateFlag; } -highres_timespec +gruel::high_res_timer_type SpectrumUpdateEvent::getEventGeneratedTimestamp() const { return _eventGeneratedTimestamp; -- cgit From f919f9dcbb54a08e6e26d6c229ce92fb784fa1b2 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Fri, 13 Apr 2012 18:36:53 -0400 Subject: Removed whitespace and added dtools/bin/remove-whitespace as a tool to do this in the future. The sed script was provided by Moritz Fischer. --- gr-qtgui/lib/spectrumUpdateEvents.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gr-qtgui/lib/spectrumUpdateEvents.cc') diff --git a/gr-qtgui/lib/spectrumUpdateEvents.cc b/gr-qtgui/lib/spectrumUpdateEvents.cc index 9be2f5357..bec39747b 100644 --- a/gr-qtgui/lib/spectrumUpdateEvents.cc +++ b/gr-qtgui/lib/spectrumUpdateEvents.cc @@ -145,7 +145,7 @@ SpectrumWindowResetEvent::~SpectrumWindowResetEvent() { } -SpectrumFrequencyRangeEvent::SpectrumFrequencyRangeEvent(const double centerFreq, +SpectrumFrequencyRangeEvent::SpectrumFrequencyRangeEvent(const double centerFreq, const double startFreq, const double stopFreq) : QEvent(QEvent::Type(10010)) -- cgit