SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Classes | Public Member Functions | Static Public Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
ScopeVis Class Reference

#include <scopevis.h>

+ Inheritance diagram for ScopeVis:
+ Collaboration diagram for ScopeVis:

Classes

class  MsgConfigureScopeVisNG
 
class  MsgScopeVisNGAddTrace
 
class  MsgScopeVisNGAddTrigger
 
class  MsgScopeVisNGChangeTrace
 
class  MsgScopeVisNGChangeTrigger
 
class  MsgScopeVisNGFocusOnTrace
 
class  MsgScopeVisNGFocusOnTrigger
 
class  MsgScopeVisNGMemoryTrace
 
class  MsgScopeVisNGMoveTrace
 
class  MsgScopeVisNGMoveTrigger
 
class  MsgScopeVisNGOneShot
 
class  MsgScopeVisNGRemoveTrace
 
class  MsgScopeVisNGRemoveTrigger
 
struct  TraceBackBuffer
 
struct  TraceBackDiscreteMemory
 
struct  TraceControl
 
struct  TraceData
 
struct  Traces
 
class  TriggerComparator
 
struct  TriggerCondition
 
struct  TriggerData
 

Public Member Functions

 ScopeVis (GLScope *glScope=0)
 
virtual ~ScopeVis ()
 
void setLiveRate (int sampleRate)
 
void setLiveRateLog2Decim (int log2Decim)
 
void configure (uint32_t traceSize, uint32_t timeBase, uint32_t timeOfsProMill, uint32_t triggerPre, bool freeRun)
 
void addTrace (const TraceData &traceData)
 
void changeTrace (const TraceData &traceData, uint32_t traceIndex)
 
void removeTrace (uint32_t traceIndex)
 
void moveTrace (uint32_t traceIndex, bool upElseDown)
 
void focusOnTrace (uint32_t traceIndex)
 
void addTrigger (const TriggerData &triggerData)
 
void changeTrigger (const TriggerData &triggerData, uint32_t triggerIndex)
 
void removeTrigger (uint32_t triggerIndex)
 
void moveTrigger (uint32_t triggerIndex, bool upElseDown)
 
void focusOnTrigger (uint32_t triggerIndex)
 
void setOneShot (bool oneShot)
 
void setMemoryIndex (uint32_t memoryIndex)
 
QByteArray serializeMemory () const
 
bool deserializeMemory (const QByteArray &data)
 
void getTriggerData (TriggerData &triggerData, uint32_t triggerIndex)
 
void getTraceData (TraceData &traceData, uint32_t traceIndex)
 
const TriggerDatagetTriggerData (uint32_t triggerIndex) const
 
const std::vector< TraceData > & getTracesData () const
 
uint32_t getNbTriggers () const
 
virtual void feed (const SampleVector::const_iterator &begin, const SampleVector::const_iterator &end, bool positiveOnly)
 
virtual void start ()
 
virtual void stop ()
 
virtual bool handleMessage (const Message &message)
 Processing of a message. Returns true if message has actually been processed. More...
 
int getTriggerLocation () const
 
- Public Member Functions inherited from BasebandSampleSink
 BasebandSampleSink ()
 
virtual ~BasebandSampleSink ()
 
MessageQueuegetInputMessageQueue ()
 Get the queue for asynchronous inbound communication. More...
 
virtual void setMessageQueueToGUI (MessageQueue *queue)
 
MessageQueuegetMessageQueueToGUI ()
 

Static Public Attributes

static const uint32_t m_traceChunkSize = 4800
 
static const uint32_t m_maxNbTriggers = 10
 
static const uint32_t m_maxNbTraces = 10
 
static const uint32_t m_nbTraceMemories = 50
 

Private Types

enum  TriggerState { TriggerUntriggered, TriggerTriggered, TriggerDelay }
 
typedef DoubleBufferSimple< SampleTraceBuffer
 

Private Member Functions

bool nextTrigger ()
 Returns true if not final. More...
 
void processTrace (const SampleVector::const_iterator &begin, const SampleVector::const_iterator &end, int &triggerPointToEnd)
 
void processMemoryTrace ()
 
int processTraces (const SampleVector::const_iterator &begin, const SampleVector::const_iterator &end, bool traceBack=false)
 
void updateMaxTraceDelay ()
 
void initTraceBuffers ()
 
void computeDisplayTriggerLevels ()
 
void updateGLScopeDisplay ()
 
void setSampleRate (int sampleRate)
 
void setTraceSize (uint32_t traceSize, bool emitSignal=false)
 
void setPreTriggerDelay (uint32_t preTriggerDelay, bool emitSignal=false)
 

Private Attributes

GLScopem_glScope
 
uint32_t m_preTriggerDelay
 Pre-trigger delay in number of samples. More...
 
uint32_t m_livePreTriggerDelay
 Pre-trigger delay in number of samples in live mode. More...
 
std::vector< TriggerCondition * > m_triggerConditions
 Chain of triggers. More...
 
uint32_t m_currentTriggerIndex
 Index of current index in the chain. More...
 
uint32_t m_focusedTriggerIndex
 Index of the trigger that has focus. More...
 
TriggerState m_triggerState
 Current trigger state. More...
 
Traces m_traces
 Displayable traces. More...
 
int m_focusedTraceIndex
 Index of the trace that has focus. More...
 
uint32_t m_traceSize
 Size of traces in number of samples. More...
 
uint32_t m_liveTraceSize
 Size of traces in number of samples in live mode. More...
 
int m_nbSamples
 Number of samples yet to process in one complex trace. More...
 
uint32_t m_timeBase
 Trace display time divisor. More...
 
uint32_t m_timeOfsProMill
 Start trace shift in 1/1000 trace size. More...
 
bool m_traceStart
 Trace is at start point. More...
 
int m_triggerLocation
 Trigger location from end point. More...
 
int m_sampleRate
 Actual sample rate being used. More...
 
int m_liveSampleRate
 Sample rate in live mode. More...
 
int m_liveLog2Decim
 Sample rate decimation log2 in live mode. More...
 
TraceBackDiscreteMemory m_traceDiscreteMemory
 Complex trace memory for triggered states TODO: vectorize when more than on input is allowed. More...
 
bool m_freeRun
 True if free running (trigger globally disabled) More...
 
int m_maxTraceDelay
 Maximum trace delay. More...
 
TriggerComparator m_triggerComparator
 Compares sample level to trigger level. More...
 
QMutex m_mutex
 
Real m_projectorCache [(int) Projector::nbProjectionTypes]
 
bool m_triggerOneShot
 True when one shot mode is active. More...
 
bool m_triggerWaitForReset
 In one shot mode suspended until reset by UI. More...
 
uint32_t m_currentTraceMemoryIndex
 The current index of trace in memory (0: current) More...
 

Additional Inherited Members

- Protected Slots inherited from BasebandSampleSink
void handleInputMessages ()
 
- Protected Attributes inherited from BasebandSampleSink
MessageQueue m_inputMessageQueue
 Queue for asynchronous inbound communication. More...
 
MessageQueuem_guiMessageQueue
 Input message queue to the GUI. More...
 

Detailed Description

Definition at line 45 of file scopevis.h.

Member Typedef Documentation

◆ TraceBuffer

Complex trace stuff

Definition at line 631 of file scopevis.h.

Member Enumeration Documentation

◆ TriggerState

enum ScopeVis::TriggerState
private

Trigger stuff

Enumerator
TriggerUntriggered 

Trigger is not kicked off yet (or trigger list is empty)

TriggerTriggered 

Trigger has been kicked off.

TriggerDelay 

Trigger conditions have been kicked off but it is waiting for delay before final kick off.

Definition at line 563 of file scopevis.h.

564  {
567  TriggerDelay,
568  };
Trigger is not kicked off yet (or trigger list is empty)
Definition: scopevis.h:565
Trigger conditions have been kicked off but it is waiting for delay before final kick off...
Definition: scopevis.h:567
Trigger has been kicked off.
Definition: scopevis.h:566

Constructor & Destructor Documentation

◆ ScopeVis()

ScopeVis::ScopeVis ( GLScope glScope = 0)

Definition at line 43 of file scopevis.cpp.

References i, m_glScope, m_projectorCache, m_traceChunkSize, m_traceDiscreteMemory, ScopeVis::Traces::m_traces, m_traces, ScopeVis::Traces::m_tracesData, Projector::nbProjectionTypes, ScopeVis::TraceBackDiscreteMemory::resize(), and GLScope::setTraces().

43  :
44  m_glScope(glScope),
53  m_nbSamples(0),
54  m_timeBase(1),
56  m_traceStart(true),
58  m_sampleRate(0),
60  m_liveLog2Decim(0),
62  m_freeRun(true),
63  m_maxTraceDelay(0),
64  m_triggerOneShot(false),
65  m_triggerWaitForReset(false),
67 {
68  setObjectName("ScopeVis");
71  for (int i = 0; i < (int) Projector::nbProjectionTypes; i++) {
72  m_projectorCache[i] = 0.0;
73  }
74 }
uint32_t m_focusedTriggerIndex
Index of the trigger that has focus.
Definition: scopevis.h:1126
bool m_triggerWaitForReset
In one shot mode suspended until reset by UI.
Definition: scopevis.h:1147
int m_liveSampleRate
Sample rate in live mode.
Definition: scopevis.h:1138
void setTraces(std::vector< ScopeVis::TraceData > *tracesData, std::vector< float *> *traces)
Definition: glscope.cpp:97
std::vector< TraceData > m_tracesData
Corresponding traces data.
Definition: scopevis.h:877
int m_focusedTraceIndex
Index of the trace that has focus.
Definition: scopevis.h:1129
Trigger is not kicked off yet (or trigger list is empty)
Definition: scopevis.h:565
Gives the number of projections in the enum.
Definition: projector.h:38
uint32_t m_timeOfsProMill
Start trace shift in 1/1000 trace size.
Definition: scopevis.h:1134
Real m_projectorCache[(int) Projector::nbProjectionTypes]
Definition: scopevis.h:1145
uint32_t m_traceSize
Size of traces in number of samples.
Definition: scopevis.h:1130
uint32_t m_livePreTriggerDelay
Pre-trigger delay in number of samples in live mode.
Definition: scopevis.h:1123
uint32_t m_liveTraceSize
Size of traces in number of samples in live mode.
Definition: scopevis.h:1131
GLScope * m_glScope
Definition: scopevis.h:1121
int m_liveLog2Decim
Sample rate decimation log2 in live mode.
Definition: scopevis.h:1139
uint32_t m_timeBase
Trace display time divisor.
Definition: scopevis.h:1133
int m_triggerLocation
Trigger location from end point.
Definition: scopevis.h:1136
int m_maxTraceDelay
Maximum trace delay.
Definition: scopevis.h:1142
int32_t i
Definition: decimators.h:244
uint32_t m_currentTriggerIndex
Index of current index in the chain.
Definition: scopevis.h:1125
bool m_traceStart
Trace is at start point.
Definition: scopevis.h:1135
static const uint32_t m_traceChunkSize
Definition: scopevis.h:150
void resize(uint32_t size)
Definition: scopevis.h:721
uint32_t m_preTriggerDelay
Pre-trigger delay in number of samples.
Definition: scopevis.h:1122
Traces m_traces
Displayable traces.
Definition: scopevis.h:1128
static const uint32_t m_nbTraceMemories
Definition: scopevis.h:153
int m_nbSamples
Number of samples yet to process in one complex trace.
Definition: scopevis.h:1132
uint32_t m_currentTraceMemoryIndex
The current index of trace in memory (0: current)
Definition: scopevis.h:1148
TraceBackDiscreteMemory m_traceDiscreteMemory
Complex trace memory for triggered states TODO: vectorize when more than on input is allowed...
Definition: scopevis.h:1140
TriggerState m_triggerState
Current trigger state.
Definition: scopevis.h:1127
bool m_triggerOneShot
True when one shot mode is active.
Definition: scopevis.h:1146
int m_sampleRate
Actual sample rate being used.
Definition: scopevis.h:1137
std::vector< float * > m_traces[2]
Double buffer of traces processed by glScope.
Definition: scopevis.h:878
bool m_freeRun
True if free running (trigger globally disabled)
Definition: scopevis.h:1141
+ Here is the call graph for this function:

◆ ~ScopeVis()

ScopeVis::~ScopeVis ( )
virtual

Definition at line 76 of file scopevis.cpp.

References m_triggerConditions.

77 {
78  for (std::vector<TriggerCondition*>::iterator it = m_triggerConditions.begin(); it != m_triggerConditions.end(); ++ it) {
79  delete *it;
80  }
81 }
std::vector< TriggerCondition * > m_triggerConditions
Chain of triggers.
Definition: scopevis.h:1124

Member Function Documentation

◆ addTrace()

void ScopeVis::addTrace ( const TraceData traceData)

Definition at line 135 of file scopevis.cpp.

References ScopeVis::MsgScopeVisNGAddTrace::create(), BasebandSampleSink::getInputMessageQueue(), ScopeVis::TraceData::m_amp, ScopeVis::TraceData::m_ofs, ScopeVis::TraceData::m_traceDelay, and MessageQueue::push().

Referenced by GLScopeGUI::addTrace(), GLScopeGUI::deserialize(), and GLScopeGUI::setBuddies().

136 {
137  qDebug() << "ScopeVis::addTrace:"
138  << " m_amp: " << traceData.m_amp
139  << " m_ofs: " << traceData.m_ofs
140  << " m_traceDelay: " << traceData.m_traceDelay;
141  Message* cmd = MsgScopeVisNGAddTrace::create(traceData);
142  getInputMessageQueue()->push(cmd);
143 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
static MsgScopeVisNGAddTrace * create(const TraceData &traceData)
Definition: scopevis.h:409
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addTrigger()

void ScopeVis::addTrigger ( const TriggerData triggerData)

Definition at line 179 of file scopevis.cpp.

References ScopeVis::MsgScopeVisNGAddTrigger::create(), BasebandSampleSink::getInputMessageQueue(), and MessageQueue::push().

Referenced by GLScopeGUI::addTrigger(), GLScopeGUI::deserialize(), and GLScopeGUI::setBuddies().

180 {
181  Message* cmd = MsgScopeVisNGAddTrigger::create(triggerData);
182  getInputMessageQueue()->push(cmd);
183 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
static MsgScopeVisNGAddTrigger * create(const TriggerData &triggerData)
Definition: scopevis.h:297
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ changeTrace()

void ScopeVis::changeTrace ( const TraceData traceData,
uint32_t  traceIndex 
)

Definition at line 145 of file scopevis.cpp.

References ScopeVis::MsgScopeVisNGChangeTrace::create(), BasebandSampleSink::getInputMessageQueue(), ScopeVis::TraceData::m_amp, ScopeVis::TraceData::m_ofs, ScopeVis::TraceData::m_traceDelay, and MessageQueue::push().

Referenced by GLScopeGUI::changeCurrentTrace(), GLScopeGUI::changeTrace(), and GLScopeGUI::deserialize().

146 {
147  qDebug() << "ScopeVis::changeTrace:"
148  << " trace: " << traceIndex
149  << " m_amp: " << traceData.m_amp
150  << " m_ofs: " << traceData.m_ofs
151  << " m_traceDelay: " << traceData.m_traceDelay;
152  Message* cmd = MsgScopeVisNGChangeTrace::create(traceData, traceIndex);
153  getInputMessageQueue()->push(cmd);
154 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
static MsgScopeVisNGChangeTrace * create(const TraceData &traceData, uint32_t traceIndex)
Definition: scopevis.h:430
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ changeTrigger()

void ScopeVis::changeTrigger ( const TriggerData triggerData,
uint32_t  triggerIndex 
)

Definition at line 185 of file scopevis.cpp.

References ScopeVis::MsgScopeVisNGChangeTrigger::create(), BasebandSampleSink::getInputMessageQueue(), and MessageQueue::push().

Referenced by GLScopeGUI::changeCurrentTrigger(), GLScopeGUI::changeTrigger(), and GLScopeGUI::deserialize().

186 {
187  Message* cmd = MsgScopeVisNGChangeTrigger::create(triggerData, triggerIndex);
188  getInputMessageQueue()->push(cmd);
189 }
static MsgScopeVisNGChangeTrigger * create(const TriggerData &triggerData, uint32_t triggerIndex)
Definition: scopevis.h:318
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ computeDisplayTriggerLevels()

void ScopeVis::computeDisplayTriggerLevels ( )
private

Calculate trigger levels on display

  • every time a trigger condition focus changes TBD
  • every time the focused trigger condition changes its projection type or level
  • every time a trace data changes: projection type, amp, offset
  • every time a trace data is added or removed

Definition at line 978 of file scopevis.cpp.

References m_focusedTriggerIndex, m_traces, ScopeVis::Traces::m_tracesData, m_triggerConditions, Projector::ProjectionMagDB, Projector::ProjectionMagLin, and Projector::ProjectionMagSq.

Referenced by handleMessage().

979 {
980  std::vector<TraceData>::iterator itData = m_traces.m_tracesData.begin();
981 
982  for (; itData != m_traces.m_tracesData.end(); ++itData)
983  {
984  if ((m_focusedTriggerIndex < m_triggerConditions.size()) && (m_triggerConditions[m_focusedTriggerIndex]->m_projector.getProjectionType() == itData->m_projectionType))
985  {
986  float level = m_triggerConditions[m_focusedTriggerIndex]->m_triggerData.m_triggerLevel;
987  float levelPowerLin = level + 1.0f;
988  float levelPowerdB = (100.0f * (level - 1.0f));
989  float v;
990 
991  if ((itData->m_projectionType == Projector::ProjectionMagLin) || (itData->m_projectionType == Projector::ProjectionMagSq))
992  {
993  v = (levelPowerLin - itData->m_ofs)*itData->m_amp - 1.0f;
994  }
995  else if (itData->m_projectionType == Projector::ProjectionMagDB)
996  {
997  float ofsdB = itData->m_ofs * 100.0f;
998  v = ((levelPowerdB + 100.0f - ofsdB)*itData->m_amp)/50.0f - 1.0f;
999  }
1000  else
1001  {
1002  v = (level - itData->m_ofs) * itData->m_amp;
1003  }
1004 
1005  if(v > 1.0f) {
1006  v = 1.0f;
1007  } else if (v < -1.0f) {
1008  v = -1.0f;
1009  }
1010 
1011  itData->m_triggerDisplayLevel = v;
1012  }
1013  else
1014  {
1015  itData->m_triggerDisplayLevel = 2.0f;
1016  }
1017  }
1018 }
uint32_t m_focusedTriggerIndex
Index of the trigger that has focus.
Definition: scopevis.h:1126
std::vector< TraceData > m_tracesData
Corresponding traces data.
Definition: scopevis.h:877
Calculate logarithmic (dB) of squared magnitude.
Definition: projector.h:31
Calculate linear magnitude or modulus.
Definition: projector.h:29
Calculate linear squared magnitude or power.
Definition: projector.h:30
Traces m_traces
Displayable traces.
Definition: scopevis.h:1128
std::vector< TriggerCondition * > m_triggerConditions
Chain of triggers.
Definition: scopevis.h:1124
+ Here is the caller graph for this function:

◆ configure()

void ScopeVis::configure ( uint32_t  traceSize,
uint32_t  timeBase,
uint32_t  timeOfsProMill,
uint32_t  triggerPre,
bool  freeRun 
)

Definition at line 129 of file scopevis.cpp.

References ScopeVis::MsgConfigureScopeVisNG::create(), BasebandSampleSink::getInputMessageQueue(), and MessageQueue::push().

Referenced by GLScopeGUI::on_freerun_toggled(), GLScopeGUI::on_time_valueChanged(), GLScopeGUI::on_timeOfs_valueChanged(), GLScopeGUI::on_traceLen_valueChanged(), GLScopeGUI::on_trigPre_valueChanged(), and GLScopeGUI::setBuddies().

130 {
131  Message* cmd = MsgConfigureScopeVisNG::create(traceSize, timeBase, timeOfsProMill, triggerPre, freeRun);
132  getInputMessageQueue()->push(cmd);
133 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
static MsgConfigureScopeVisNG * create(uint32_t traceSize, uint32_t timeBase, uint32_t timeOfsProMill, uint32_t triggerPre, bool freeRun)
Definition: scopevis.h:256
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deserializeMemory()

bool ScopeVis::deserializeMemory ( const QByteArray &  data)
inline

Definition at line 187 of file scopevis.h.

References SimpleDeserializer::getVersion(), SimpleDeserializer::isValid(), SimpleDeserializer::readBlob(), SimpleDeserializer::readS32(), and SimpleDeserializer::readU32().

Referenced by GLScopeGUI::on_memoryLoad_clicked().

188  {
189  SimpleDeserializer d(data);
190 
191  if(!d.isValid()) {
192  return false;
193  }
194 
195  if (d.getVersion() == 1)
196  {
197  uint32_t traceSize, preTriggerDelay;
198  int sampleRate;
199  QByteArray buf;
200  bool traceDiscreteMemorySuccess;
201 
202  d.readU32(1, &traceSize, m_traceChunkSize);
203  d.readU32(2, &preTriggerDelay, 0);
204  d.readS32(3, &sampleRate, 0);
205  setSampleRate(sampleRate);
206  setTraceSize(traceSize, true);
207  setPreTriggerDelay(preTriggerDelay, true);
208  d.readBlob(4, &buf);
209  traceDiscreteMemorySuccess = m_traceDiscreteMemory.deserialize(buf);
210 
211  if (traceDiscreteMemorySuccess && (m_glScope) && (m_currentTraceMemoryIndex > 0)) {
213  }
214 
215  return traceDiscreteMemorySuccess;
216  }
217  else
218  {
219  return false;
220  }
221  }
bool deserialize(const QByteArray &data)
Definition: scopevis.h:799
unsigned int uint32_t
Definition: rtptypes_win.h:46
GLScope * m_glScope
Definition: scopevis.h:1121
void setPreTriggerDelay(uint32_t preTriggerDelay, bool emitSignal=false)
Definition: scopevis.cpp:120
static const uint32_t m_traceChunkSize
Definition: scopevis.h:150
void setSampleRate(int sampleRate)
Definition: scopevis.cpp:98
void processMemoryTrace()
Definition: scopevis.cpp:279
void setTraceSize(uint32_t traceSize, bool emitSignal=false)
Definition: scopevis.cpp:108
uint32_t m_currentTraceMemoryIndex
The current index of trace in memory (0: current)
Definition: scopevis.h:1148
TraceBackDiscreteMemory m_traceDiscreteMemory
Complex trace memory for triggered states TODO: vectorize when more than on input is allowed...
Definition: scopevis.h:1140
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ feed()

void ScopeVis::feed ( const SampleVector::const_iterator &  begin,
const SampleVector::const_iterator &  end,
bool  positiveOnly 
)
virtual

Implements BasebandSampleSink.

Definition at line 221 of file scopevis.cpp.

References m_currentTraceMemoryIndex, m_freeRun, m_mutex, m_traceSize, m_triggerLocation, m_triggerState, m_triggerWaitForReset, processTrace(), TriggerTriggered, and TriggerUntriggered.

Referenced by SpectrumScopeComboVis::feed().

222 {
223  (void) positiveOnly;
224 
225  if (m_currentTraceMemoryIndex > 0) { // in memory mode live trace is suspended
226  return;
227  }
228 
229  if (!m_mutex.tryLock(0)) { // prevent conflicts with configuration process
230  return;
231  }
232 
233  if (m_freeRun) {
234  m_triggerLocation = end - cbegin;
235  }
236  else if (m_triggerState == TriggerTriggered) {
237  m_triggerLocation = end - cbegin;
238  }
239  else if (m_triggerState == TriggerUntriggered) {
240  m_triggerLocation = 0;
241  }
242  else if (m_triggerWaitForReset) {
243  m_triggerLocation = 0;
244  }
245  else {
246  m_triggerLocation = end - cbegin;
247  }
248 
249  SampleVector::const_iterator begin(cbegin);
250  int triggerPointToEnd;
251 
252  while (begin < end)
253  {
254  if (begin + m_traceSize > end) // buffer smaller than trace size (end - bagin) < m_traceSize
255  {
256  triggerPointToEnd = -1;
257  processTrace(begin, end, triggerPointToEnd); // use all buffer
258  m_triggerLocation = triggerPointToEnd < 0 ? 0 : triggerPointToEnd; // trim negative values
259  m_triggerLocation = m_triggerLocation > end - begin ? end - begin : m_triggerLocation; // trim past begin values
260 
261  begin = end; // effectively breaks out the loop
262  }
263  else // trace size fits in buffer
264  {
265  triggerPointToEnd = -1;
266  processTrace(begin, begin + m_traceSize, triggerPointToEnd); // use part of buffer to fit trace size
267  //m_triggerPoint = begin + m_traceSize - triggerPointToEnd;
268  m_triggerLocation = end - begin + m_traceSize - triggerPointToEnd; // should always refer to end iterator
269  m_triggerLocation = m_triggerLocation < 0 ? 0 : m_triggerLocation; // trim negative values
270  m_triggerLocation = m_triggerLocation > end - begin ? end - begin : m_triggerLocation; // trim past begin values
271 
272  begin += m_traceSize;
273  }
274  }
275 
276  m_mutex.unlock();
277 }
void processTrace(const SampleVector::const_iterator &begin, const SampleVector::const_iterator &end, int &triggerPointToEnd)
Definition: scopevis.cpp:299
bool m_triggerWaitForReset
In one shot mode suspended until reset by UI.
Definition: scopevis.h:1147
QMutex m_mutex
Definition: scopevis.h:1144
Trigger is not kicked off yet (or trigger list is empty)
Definition: scopevis.h:565
uint32_t m_traceSize
Size of traces in number of samples.
Definition: scopevis.h:1130
int m_triggerLocation
Trigger location from end point.
Definition: scopevis.h:1136
Trigger has been kicked off.
Definition: scopevis.h:566
uint32_t m_currentTraceMemoryIndex
The current index of trace in memory (0: current)
Definition: scopevis.h:1148
TriggerState m_triggerState
Current trigger state.
Definition: scopevis.h:1127
bool m_freeRun
True if free running (trigger globally disabled)
Definition: scopevis.h:1141
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ focusOnTrace()

void ScopeVis::focusOnTrace ( uint32_t  traceIndex)

Definition at line 173 of file scopevis.cpp.

References ScopeVis::MsgScopeVisNGFocusOnTrace::create(), BasebandSampleSink::getInputMessageQueue(), and MessageQueue::push().

Referenced by GLScopeGUI::on_trace_valueChanged(), GLScopeGUI::on_traceDown_clicked(), and GLScopeGUI::on_traceUp_clicked().

174 {
175  Message* cmd = MsgScopeVisNGFocusOnTrace::create(traceIndex);
176  getInputMessageQueue()->push(cmd);
177 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
static MsgScopeVisNGFocusOnTrace * create(uint32_t traceIndex)
Definition: scopevis.h:500
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ focusOnTrigger()

void ScopeVis::focusOnTrigger ( uint32_t  triggerIndex)

Definition at line 203 of file scopevis.cpp.

References ScopeVis::MsgScopeVisNGFocusOnTrigger::create(), BasebandSampleSink::getInputMessageQueue(), and MessageQueue::push().

Referenced by GLScopeGUI::on_trig_valueChanged(), GLScopeGUI::on_trigDown_clicked(), and GLScopeGUI::on_trigUp_clicked().

204 {
205  Message* cmd = MsgScopeVisNGFocusOnTrigger::create(triggerIndex);
206  getInputMessageQueue()->push(cmd);
207 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
static MsgScopeVisNGFocusOnTrigger * create(uint32_t triggerIndex)
Definition: scopevis.h:388
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNbTriggers()

uint32_t ScopeVis::getNbTriggers ( ) const
inline

Definition at line 241 of file scopevis.h.

Referenced by GLScopeGUI::deserialize(), and GLScopeGUI::serialize().

241 { return m_triggerConditions.size(); }
std::vector< TriggerCondition * > m_triggerConditions
Chain of triggers.
Definition: scopevis.h:1124
+ Here is the caller graph for this function:

◆ getTraceData()

void ScopeVis::getTraceData ( TraceData traceData,
uint32_t  traceIndex 
)
inline

Definition at line 231 of file scopevis.h.

Referenced by GLScopeGUI::on_trace_valueChanged(), GLScopeGUI::on_traceDown_clicked(), and GLScopeGUI::on_traceUp_clicked().

232  {
233  if (traceIndex < m_traces.m_tracesData.size())
234  {
235  traceData = m_traces.m_tracesData[traceIndex];
236  }
237  }
std::vector< TraceData > m_tracesData
Corresponding traces data.
Definition: scopevis.h:877
Traces m_traces
Displayable traces.
Definition: scopevis.h:1128
+ Here is the caller graph for this function:

◆ getTracesData()

const std::vector<TraceData>& ScopeVis::getTracesData ( ) const
inline

Definition at line 240 of file scopevis.h.

Referenced by GLScopeGUI::deserialize(), and GLScopeGUI::serialize().

240 { return m_traces.m_tracesData; }
std::vector< TraceData > m_tracesData
Corresponding traces data.
Definition: scopevis.h:877
Traces m_traces
Displayable traces.
Definition: scopevis.h:1128
+ Here is the caller graph for this function:

◆ getTriggerData() [1/2]

void ScopeVis::getTriggerData ( TriggerData triggerData,
uint32_t  triggerIndex 
)
inline

Definition at line 223 of file scopevis.h.

Referenced by GLScopeGUI::on_trig_valueChanged(), GLScopeGUI::on_trigDown_clicked(), GLScopeGUI::on_trigUp_clicked(), and GLScopeGUI::serialize().

224  {
225  if (triggerIndex < m_triggerConditions.size())
226  {
227  triggerData = m_triggerConditions[triggerIndex]->m_triggerData;
228  }
229  }
std::vector< TriggerCondition * > m_triggerConditions
Chain of triggers.
Definition: scopevis.h:1124
+ Here is the caller graph for this function:

◆ getTriggerData() [2/2]

const TriggerData& ScopeVis::getTriggerData ( uint32_t  triggerIndex) const
inline

Definition at line 239 of file scopevis.h.

239 { return m_triggerConditions[triggerIndex]->m_triggerData; }
std::vector< TriggerCondition * > m_triggerConditions
Chain of triggers.
Definition: scopevis.h:1124

◆ getTriggerLocation()

int ScopeVis::getTriggerLocation ( ) const
inline

Definition at line 247 of file scopevis.h.

Referenced by SpectrumScopeComboVis::feed().

247 { return m_triggerLocation; }
int m_triggerLocation
Trigger location from end point.
Definition: scopevis.h:1136
+ Here is the caller graph for this function:

◆ handleMessage()

bool ScopeVis::handleMessage ( const Message cmd)
virtual

Processing of a message. Returns true if message has actually been processed.

Implements BasebandSampleSink.

Definition at line 650 of file scopevis.cpp.

References ScopeVis::Traces::addTrace(), ScopeVis::Traces::changeTrace(), computeDisplayTriggerLevels(), ScopeVis::MsgConfigureScopeVisNG::getFreeRun(), Message::getIdentifier(), ScopeVis::MsgScopeVisNGMemoryTrace::getMemoryIndex(), ScopeVis::MsgScopeVisNGMoveTrigger::getMoveUp(), ScopeVis::MsgScopeVisNGMoveTrace::getMoveUp(), ScopeVis::MsgScopeVisNGOneShot::getOneShot(), DSPSignalNotification::getSampleRate(), ScopeVis::MsgConfigureScopeVisNG::getTimeBase(), ScopeVis::MsgConfigureScopeVisNG::getTimeOfsProMill(), ScopeVis::MsgScopeVisNGAddTrace::getTraceData(), ScopeVis::MsgScopeVisNGChangeTrace::getTraceData(), ScopeVis::MsgScopeVisNGChangeTrace::getTraceIndex(), ScopeVis::MsgScopeVisNGRemoveTrace::getTraceIndex(), ScopeVis::MsgScopeVisNGMoveTrace::getTraceIndex(), ScopeVis::MsgScopeVisNGFocusOnTrace::getTraceIndex(), ScopeVis::MsgConfigureScopeVisNG::getTraceSize(), ScopeVis::MsgScopeVisNGAddTrigger::getTriggerData(), ScopeVis::MsgScopeVisNGChangeTrigger::getTriggerData(), ScopeVis::MsgScopeVisNGChangeTrigger::getTriggerIndex(), ScopeVis::MsgScopeVisNGRemoveTrigger::getTriggerIndex(), ScopeVis::MsgScopeVisNGMoveTrigger::getTriggerIndex(), ScopeVis::MsgScopeVisNGFocusOnTrigger::getTriggerIndex(), ScopeVis::MsgConfigureScopeVisNG::getTriggerPre(), initTraceBuffers(), ScopeVis::Traces::isVerticalDisplayChange(), m_currentTraceMemoryIndex, m_focusedTraceIndex, m_focusedTriggerIndex, m_freeRun, m_glScope, m_livePreTriggerDelay, m_liveSampleRate, m_liveTraceSize, m_mutex, m_preTriggerDelay, m_sampleRate, m_timeBase, m_timeOfsProMill, m_traces, ScopeVis::Traces::m_tracesData, m_traceSize, m_triggerConditions, m_triggerOneShot, m_triggerWaitForReset, Message::match(), ScopeVis::Traces::moveTrace(), nextTrigger(), processMemoryTrace(), ScopeVis::Traces::removeTrace(), GLScope::setFocusedTraceIndex(), GLScope::setFocusedTriggerData(), setLiveRate(), setPreTriggerDelay(), GLScope::setTimeBase(), GLScope::setTimeOfsProMill(), setTraceSize(), updateGLScopeDisplay(), and updateMaxTraceDelay().

Referenced by SpectrumScopeComboVis::handleMessage().

651 {
652  if (DSPSignalNotification::match(message))
653  {
654  DSPSignalNotification& notif = (DSPSignalNotification&) message;
655  setLiveRate(notif.getSampleRate());
656  qDebug() << "ScopeVis::handleMessage: DSPSignalNotification: m_sampleRate: " << m_sampleRate;
657  return true;
658  }
659  else if (MsgConfigureScopeVisNG::match(message))
660  {
661  QMutexLocker configLocker(&m_mutex);
662  MsgConfigureScopeVisNG& conf = (MsgConfigureScopeVisNG&) message;
663 
664  uint32_t traceSize = conf.getTraceSize();
665  uint32_t timeBase = conf.getTimeBase();
666  uint32_t timeOfsProMill = conf.getTimeOfsProMill();
667  uint32_t triggerPre = conf.getTriggerPre();
668  bool freeRun = conf.getFreeRun();
669 
670  if (m_traceSize != traceSize)
671  {
672  setTraceSize(traceSize);
673  }
674 
675  if (m_timeBase != timeBase)
676  {
677  m_timeBase = timeBase;
678 
679  if (m_glScope) {
681  }
682  }
683 
684  if (m_timeOfsProMill != timeOfsProMill)
685  {
686  m_timeOfsProMill = timeOfsProMill;
687 
688  if (m_glScope) {
690  }
691  }
692 
693  if (m_preTriggerDelay != triggerPre)
694  {
695  setPreTriggerDelay(triggerPre);
696  }
697 
698  if (freeRun != m_freeRun)
699  {
700  m_freeRun = freeRun;
701  }
702 
703  qDebug() << "ScopeVis::handleMessage: MsgConfigureScopeVisNG:"
704  << " m_traceSize: " << m_traceSize
705  << " m_timeOfsProMill: " << m_timeOfsProMill
706  << " m_preTriggerDelay: " << m_preTriggerDelay
707  << " m_freeRun: " << m_freeRun;
708 
709  if ((m_glScope) && (m_currentTraceMemoryIndex > 0)) {
711  }
712 
713  return true;
714  }
715  else if (MsgScopeVisNGAddTrigger::match(message))
716  {
717  qDebug() << "ScopeVis::handleMessage: MsgScopeVisNGAddTrigger";
718  QMutexLocker configLocker(&m_mutex);
719  MsgScopeVisNGAddTrigger& conf = (MsgScopeVisNGAddTrigger&) message;
720  m_triggerConditions.push_back(new TriggerCondition(conf.getTriggerData()));
721  m_triggerConditions.back()->initProjector();
722  return true;
723  }
724  else if (MsgScopeVisNGChangeTrigger::match(message))
725  {
726  QMutexLocker configLocker(&m_mutex);
727  MsgScopeVisNGChangeTrigger& conf = (MsgScopeVisNGChangeTrigger&) message;
728  uint32_t triggerIndex = conf.getTriggerIndex();
729  qDebug() << "ScopeVis::handleMessage: MsgScopeVisNGChangeTrigger: " << triggerIndex;
730 
731  if (triggerIndex < m_triggerConditions.size())
732  {
733  m_triggerConditions[triggerIndex]->setData(conf.getTriggerData());
734 
735  if (triggerIndex == m_focusedTriggerIndex)
736  {
740  }
741  }
742 
743  return true;
744  }
745  else if (MsgScopeVisNGRemoveTrigger::match(message))
746  {
747  QMutexLocker configLocker(&m_mutex);
748  MsgScopeVisNGRemoveTrigger& conf = (MsgScopeVisNGRemoveTrigger&) message;
749  uint32_t triggerIndex = conf.getTriggerIndex();
750  qDebug() << "ScopeVis::handleMessage: MsgScopeVisNGRemoveTrigger: " << triggerIndex;
751 
752  if (triggerIndex < m_triggerConditions.size())
753  {
754  TriggerCondition *triggerCondition = m_triggerConditions[triggerIndex];
755  m_triggerConditions.erase(m_triggerConditions.begin() + triggerIndex);
756  delete triggerCondition;
757  }
758 
759  return true;
760  }
761  else if (MsgScopeVisNGMoveTrigger::match(message))
762  {
763  QMutexLocker configLocker(&m_mutex);
764  MsgScopeVisNGMoveTrigger& conf = (MsgScopeVisNGMoveTrigger&) message;
765  int triggerIndex = conf.getTriggerIndex();
766  qDebug() << "ScopeVis::handleMessage: MsgScopeVisNGMoveTrigger: " << triggerIndex;
767 
768  if (!conf.getMoveUp() && (triggerIndex == 0)) {
769  return true;
770  }
771 
772  int nextTriggerIndex = (triggerIndex + (conf.getMoveUp() ? 1 : -1)) % m_triggerConditions.size();
773 
774  TriggerCondition *nextTrigger = m_triggerConditions[nextTriggerIndex];
775  m_triggerConditions[nextTriggerIndex] = m_triggerConditions[triggerIndex];
776  m_triggerConditions[triggerIndex] = nextTrigger;
777 
781 
782  return true;
783  }
784  else if (MsgScopeVisNGFocusOnTrigger::match(message))
785  {
786  MsgScopeVisNGFocusOnTrigger& conf = (MsgScopeVisNGFocusOnTrigger&) message;
787  uint32_t triggerIndex = conf.getTriggerIndex();
788  qDebug() << "ScopeVis::handleMessage: MsgScopeVisNGFocusOnTrigger: " << triggerIndex;
789 
790  if (triggerIndex < m_triggerConditions.size())
791  {
792  m_focusedTriggerIndex = triggerIndex;
796  }
797 
798  return true;
799  }
800  else if (MsgScopeVisNGAddTrace::match(message))
801  {
802  qDebug() << "ScopeVis::handleMessage: MsgScopeVisNGAddTrace";
803  QMutexLocker configLocker(&m_mutex);
804  MsgScopeVisNGAddTrace& conf = (MsgScopeVisNGAddTrace&) message;
805  m_traces.addTrace(conf.getTraceData(), m_traceSize);
810  return true;
811  }
812  else if (MsgScopeVisNGChangeTrace::match(message))
813  {
814  QMutexLocker configLocker(&m_mutex);
815  MsgScopeVisNGChangeTrace& conf = (MsgScopeVisNGChangeTrace&) message;
816  bool doComputeTriggerLevelsOnDisplay = m_traces.isVerticalDisplayChange(conf.getTraceData(), conf.getTraceIndex());
817  uint32_t traceIndex = conf.getTraceIndex();
818  qDebug() << "ScopeVis::handleMessage: MsgScopeVisNGChangeTrace: " << traceIndex;
819  m_traces.changeTrace(conf.getTraceData(), traceIndex);
821  if (doComputeTriggerLevelsOnDisplay) computeDisplayTriggerLevels();
823  return true;
824  }
825  else if (MsgScopeVisNGRemoveTrace::match(message))
826  {
827  QMutexLocker configLocker(&m_mutex);
828  MsgScopeVisNGRemoveTrace& conf = (MsgScopeVisNGRemoveTrace&) message;
829  uint32_t traceIndex = conf.getTraceIndex();
830  qDebug() << "ScopeVis::handleMessage: MsgScopeVisNGRemoveTrace: " << traceIndex;
831  m_traces.removeTrace(traceIndex);
835  return true;
836  }
837  else if (MsgScopeVisNGMoveTrace::match(message))
838  {
839  QMutexLocker configLocker(&m_mutex);
840  MsgScopeVisNGMoveTrace& conf = (MsgScopeVisNGMoveTrace&) message;
841  uint32_t traceIndex = conf.getTraceIndex();
842  qDebug() << "ScopeVis::handleMessage: MsgScopeVisNGMoveTrace: " << traceIndex;
843  m_traces.moveTrace(traceIndex, conf.getMoveUp());
844  //updateMaxTraceDelay();
847  return true;
848  }
849  else if (MsgScopeVisNGFocusOnTrace::match(message))
850  {
851  MsgScopeVisNGFocusOnTrace& conf = (MsgScopeVisNGFocusOnTrace&) message;
852  uint32_t traceIndex = conf.getTraceIndex();
853  qDebug() << "ScopeVis::handleMessage: MsgScopeVisNGFocusOnTrace: " << traceIndex;
854 
855  if (traceIndex < m_traces.m_tracesData.size())
856  {
857  m_focusedTraceIndex = traceIndex;
861  }
862 
863  return true;
864  }
865  else if (MsgScopeVisNGOneShot::match(message))
866  {
867  qDebug() << "ScopeVis::handleMessage: MsgScopeVisNGOneShot";
868  MsgScopeVisNGOneShot& conf = (MsgScopeVisNGOneShot&) message;
869  bool oneShot = conf.getOneShot();
870  m_triggerOneShot = oneShot;
871  if (m_triggerWaitForReset && !oneShot) m_triggerWaitForReset = false;
872  return true;
873  }
874  else if (MsgScopeVisNGMemoryTrace::match(message))
875  {
876  MsgScopeVisNGMemoryTrace& conf = (MsgScopeVisNGMemoryTrace&) message;
877  uint32_t memoryIndex = conf.getMemoryIndex();
878  qDebug() << "ScopeVis::handleMessage: MsgScopeVisNGMemoryTrace: " << memoryIndex;
879 
880  if (memoryIndex != m_currentTraceMemoryIndex)
881  {
882  // transition from live mode
883  if (m_currentTraceMemoryIndex == 0)
884  {
887  }
888 
889  m_currentTraceMemoryIndex = memoryIndex;
890 
891  // transition to live mode
892  if (m_currentTraceMemoryIndex == 0)
893  {
894  setLiveRate(m_liveSampleRate); // reset to live rate
895  setTraceSize(m_liveTraceSize, true); // reset to live trace size
896  setPreTriggerDelay(m_livePreTriggerDelay, true); // reset to live pre-trigger delay
897  }
898  else
899  {
901  }
902  }
903  return true;
904  }
905  else
906  {
907  qDebug() << "ScopeVis::handleMessage" << message.getIdentifier() << " not handled";
908  return false;
909  }
910 }
void addTrace(const TraceData &traceData, int traceSize)
Definition: scopevis.h:917
uint32_t m_focusedTriggerIndex
Index of the trigger that has focus.
Definition: scopevis.h:1126
bool m_triggerWaitForReset
In one shot mode suspended until reset by UI.
Definition: scopevis.h:1147
int m_liveSampleRate
Sample rate in live mode.
Definition: scopevis.h:1138
void updateGLScopeDisplay()
Definition: scopevis.cpp:1020
std::vector< TraceData > m_tracesData
Corresponding traces data.
Definition: scopevis.h:877
QMutex m_mutex
Definition: scopevis.h:1144
bool nextTrigger()
Returns true if not final.
Definition: scopevis.cpp:455
int m_focusedTraceIndex
Index of the trace that has focus.
Definition: scopevis.h:1129
void setLiveRate(int sampleRate)
Definition: scopevis.cpp:83
uint32_t m_timeOfsProMill
Start trace shift in 1/1000 trace size.
Definition: scopevis.h:1134
void setFocusedTriggerData(ScopeVis::TriggerData &triggerData)
Definition: glscope.h:75
unsigned int uint32_t
Definition: rtptypes_win.h:46
uint32_t m_traceSize
Size of traces in number of samples.
Definition: scopevis.h:1130
uint32_t m_livePreTriggerDelay
Pre-trigger delay in number of samples in live mode.
Definition: scopevis.h:1123
uint32_t m_liveTraceSize
Size of traces in number of samples in live mode.
Definition: scopevis.h:1131
GLScope * m_glScope
Definition: scopevis.h:1121
uint32_t m_timeBase
Trace display time divisor.
Definition: scopevis.h:1133
void setFocusedTraceIndex(uint32_t traceIndex)
Definition: glscope.cpp:983
void setPreTriggerDelay(uint32_t preTriggerDelay, bool emitSignal=false)
Definition: scopevis.cpp:120
static bool match(const Message *message)
Definition: message.cpp:45
void setTimeBase(int timeBase)
Definition: glscope.cpp:958
void initTraceBuffers()
Definition: scopevis.cpp:959
uint32_t m_preTriggerDelay
Pre-trigger delay in number of samples.
Definition: scopevis.h:1122
Traces m_traces
Displayable traces.
Definition: scopevis.h:1128
void computeDisplayTriggerLevels()
Definition: scopevis.cpp:978
void changeTrace(const TraceData &traceData, uint32_t traceIndex)
Definition: scopevis.h:933
void processMemoryTrace()
Definition: scopevis.cpp:279
void setTraceSize(uint32_t traceSize, bool emitSignal=false)
Definition: scopevis.cpp:108
void setTimeOfsProMill(int timeOfsProMill)
Definition: glscope.cpp:976
int getSampleRate() const
Definition: dspcommands.h:328
uint32_t m_currentTraceMemoryIndex
The current index of trace in memory (0: current)
Definition: scopevis.h:1148
std::vector< TriggerCondition * > m_triggerConditions
Chain of triggers.
Definition: scopevis.h:1124
void moveTrace(uint32_t traceIndex, bool upElseDown)
Definition: scopevis.h:960
bool isVerticalDisplayChange(const TraceData &traceData, uint32_t traceIndex)
Definition: scopevis.h:909
bool m_triggerOneShot
True when one shot mode is active.
Definition: scopevis.h:1146
int m_sampleRate
Actual sample rate being used.
Definition: scopevis.h:1137
void updateMaxTraceDelay()
Definition: scopevis.cpp:912
void removeTrace(uint32_t traceIndex)
Definition: scopevis.h:943
bool m_freeRun
True if free running (trigger globally disabled)
Definition: scopevis.h:1141
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initTraceBuffers()

void ScopeVis::initTraceBuffers ( )
private

Initialize trace buffers

Definition at line 959 of file scopevis.cpp.

References i, m_timeOfsProMill, ScopeVis::Traces::m_traces, m_traces, and m_traceSize.

Referenced by handleMessage(), processTrace(), and setTraceSize().

960 {
961  int shift = (m_timeOfsProMill / 1000.0) * m_traceSize;
962 
963  std::vector<float *>::iterator it0 = m_traces.m_traces[0].begin();
964  std::vector<float *>::iterator it1 = m_traces.m_traces[1].begin();
965 
966  for (; it0 != m_traces.m_traces[0].end(); ++it0, ++it1)
967  {
968  for (unsigned int i = 0; i < m_traceSize; i++)
969  {
970  (*it0)[2*i] = (i - shift); // display x
971  (*it0)[2*i + 1] = 0.0f; // display y
972  (*it1)[2*i] = (i - shift); // display x
973  (*it1)[2*i + 1] = 0.0f; // display y
974  }
975  }
976 }
uint32_t m_timeOfsProMill
Start trace shift in 1/1000 trace size.
Definition: scopevis.h:1134
uint32_t m_traceSize
Size of traces in number of samples.
Definition: scopevis.h:1130
int32_t i
Definition: decimators.h:244
Traces m_traces
Displayable traces.
Definition: scopevis.h:1128
std::vector< float * > m_traces[2]
Double buffer of traces processed by glScope.
Definition: scopevis.h:878
+ Here is the caller graph for this function:

◆ moveTrace()

void ScopeVis::moveTrace ( uint32_t  traceIndex,
bool  upElseDown 
)

Definition at line 164 of file scopevis.cpp.

References ScopeVis::MsgScopeVisNGMoveTrace::create(), BasebandSampleSink::getInputMessageQueue(), and MessageQueue::push().

Referenced by GLScopeGUI::on_traceDown_clicked(), and GLScopeGUI::on_traceUp_clicked().

165 {
166  qDebug() << "ScopeVis::moveTrace:"
167  << " trace: " << traceIndex
168  << " up: " << upElseDown;
169  Message* cmd = MsgScopeVisNGMoveTrace::create(traceIndex, upElseDown);
170  getInputMessageQueue()->push(cmd);
171 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
static MsgScopeVisNGMoveTrace * create(uint32_t traceIndex, bool moveUpElseDown)
Definition: scopevis.h:475
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ moveTrigger()

void ScopeVis::moveTrigger ( uint32_t  triggerIndex,
bool  upElseDown 
)

Definition at line 197 of file scopevis.cpp.

References ScopeVis::MsgScopeVisNGMoveTrigger::create(), BasebandSampleSink::getInputMessageQueue(), and MessageQueue::push().

Referenced by GLScopeGUI::on_trigDown_clicked(), and GLScopeGUI::on_trigUp_clicked().

198 {
199  Message* cmd = MsgScopeVisNGMoveTrigger::create(triggerIndex, upElseDown);
200  getInputMessageQueue()->push(cmd);
201 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
static MsgScopeVisNGMoveTrigger * create(uint32_t triggerIndex, bool moveUpElseDown)
Definition: scopevis.h:363
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nextTrigger()

bool ScopeVis::nextTrigger ( )
private

Returns true if not final.

Moves on to the next trigger if any or increments trigger count if in repeat mode

  • If not final it returns true
  • If final i.e. signal is actually triggerd it returns false

Definition at line 455 of file scopevis.cpp.

References m_currentTriggerIndex, m_triggerConditions, ScopeVis::TriggerCondition::m_triggerCounter, ScopeVis::TriggerCondition::m_triggerData, and ScopeVis::TriggerData::m_triggerRepeat.

Referenced by handleMessage(), and processTrace().

456 {
457  TriggerCondition *triggerCondition = m_triggerConditions[m_currentTriggerIndex]; // current trigger condition
458 
459  if (triggerCondition->m_triggerData.m_triggerRepeat > 0)
460  {
461  if (triggerCondition->m_triggerCounter < triggerCondition->m_triggerData.m_triggerRepeat)
462  {
463  triggerCondition->m_triggerCounter++;
464  return true; // not final keep going
465  }
466  else
467  {
468  triggerCondition->m_triggerCounter = 0; // reset for next time
469  }
470  }
471 
472  if (m_triggerConditions.size() == 0)
473  {
475  return false; // final
476  }
477  else if (m_currentTriggerIndex < m_triggerConditions.size() - 1) // check if next trigger is available
478  {
480  return true; // not final keep going
481  }
482  else
483  {
484  // now this is really finished
486  return false; // final
487  }
488 }
uint32_t m_currentTriggerIndex
Index of current index in the chain.
Definition: scopevis.h:1125
std::vector< TriggerCondition * > m_triggerConditions
Chain of triggers.
Definition: scopevis.h:1124
+ Here is the caller graph for this function:

◆ processMemoryTrace()

void ScopeVis::processMemoryTrace ( )
private

process a trace in memory at current trace index in memory

Definition at line 279 of file scopevis.cpp.

References ScopeVis::TraceBackDiscreteMemory::at(), ScopeVis::TraceBackDiscreteMemory::currentIndex(), m_currentTraceMemoryIndex, ScopeVis::TraceBackBuffer::m_endPoint, m_maxTraceDelay, m_nbSamples, m_nbTraceMemories, m_traceDiscreteMemory, m_traceSize, and processTraces().

Referenced by handleMessage(), and updateGLScopeDisplay().

280 {
282  {
283  int traceMemoryIndex = m_traceDiscreteMemory.currentIndex() - m_currentTraceMemoryIndex; // actual index in memory bank
284 
285  if (traceMemoryIndex < 0) {
286  traceMemoryIndex += m_nbTraceMemories;
287  }
288 
289  SampleVector::const_iterator mend = m_traceDiscreteMemory.at(traceMemoryIndex).m_endPoint;
290  SampleVector::const_iterator mbegin = mend - m_traceSize;
291  SampleVector::const_iterator mbegin_tb = mbegin - m_maxTraceDelay;
292  m_nbSamples = m_traceSize + m_maxTraceDelay;
293 
294  processTraces(mbegin_tb, mbegin, true); // traceback
295  processTraces(mbegin, mend, false);
296  }
297 }
uint32_t currentIndex() const
Definition: scopevis.h:774
uint32_t m_traceSize
Size of traces in number of samples.
Definition: scopevis.h:1130
TraceBackBuffer & at(int index)
Definition: scopevis.h:766
int m_maxTraceDelay
Maximum trace delay.
Definition: scopevis.h:1142
static const uint32_t m_nbTraceMemories
Definition: scopevis.h:153
SampleVector::iterator m_endPoint
Definition: scopevis.h:636
int m_nbSamples
Number of samples yet to process in one complex trace.
Definition: scopevis.h:1132
uint32_t m_currentTraceMemoryIndex
The current index of trace in memory (0: current)
Definition: scopevis.h:1148
int processTraces(const SampleVector::const_iterator &begin, const SampleVector::const_iterator &end, bool traceBack=false)
Definition: scopevis.cpp:490
TraceBackDiscreteMemory m_traceDiscreteMemory
Complex trace memory for triggered states TODO: vectorize when more than on input is allowed...
Definition: scopevis.h:1140
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ processTrace()

void ScopeVis::processTrace ( const SampleVector::const_iterator &  begin,
const SampleVector::const_iterator &  end,
int &  triggerPointToEnd 
)
private

Process a sample trace which length is at most the trace length (m_traceSize)

Definition at line 299 of file scopevis.cpp.

References ScopeVis::TraceBackBuffer::current(), ScopeVis::TraceBackDiscreteMemory::current(), initTraceBuffers(), m_currentTriggerIndex, ScopeVis::TraceBackBuffer::m_endPoint, m_freeRun, m_maxTraceDelay, m_nbSamples, m_preTriggerDelay, m_sampleRate, m_traceDiscreteMemory, m_traceSize, m_traceStart, m_triggerComparator, m_triggerConditions, ScopeVis::TriggerCondition::m_triggerData, ScopeVis::TriggerData::m_triggerDelay, ScopeVis::TriggerCondition::m_triggerDelayCount, m_triggerOneShot, m_triggerState, m_triggerWaitForReset, nextTrigger(), processTraces(), ScopeVis::TriggerComparator::reset(), ScopeVis::TraceBackDiscreteMemory::store(), TriggerDelay, ScopeVis::TriggerComparator::triggered(), TriggerTriggered, TriggerUntriggered, and ScopeVis::TraceBackBuffer::write().

Referenced by feed().

300 {
301  SampleVector::const_iterator begin(cbegin);
302 
303  // memory storage
304 
305  m_traceDiscreteMemory.current().write(cbegin, end);
306 
307  // Removed in 4.2.4 may cause trigger bug
308  // if (m_traceDiscreteMemory.current().absoluteFill() < m_traceSize)
309  // {
310  // return; // not enough samples in memory
311  // }
312 
313  // trigger process
314 
315  if ((m_freeRun) || (m_triggerConditions.size() == 0)) // immediate re-trigger
316  {
318  {
319  m_traceStart = true; // start trace processing
322  }
323  }
324  else if ((m_triggerState == TriggerUntriggered) || (m_triggerState == TriggerDelay)) // look for trigger or past trigger in delay mode
325  {
326  TriggerCondition* triggerCondition = m_triggerConditions[m_currentTriggerIndex]; // current trigger condition
327 
328  while (begin < end)
329  {
330  if (m_triggerState == TriggerDelay) // delayed trigger
331  {
332  if (triggerCondition->m_triggerDelayCount > 0) // skip samples during delay period
333  {
334  begin += triggerCondition->m_triggerDelayCount;
335  triggerCondition->m_triggerDelayCount = 0;
336  continue;
337  }
338  else // process trigger
339  {
340  if (nextTrigger()) // move to next trigger and keep going
341  {
344  ++begin;
345  continue;
346  }
347  else // this was the last trigger then start trace
348  {
349  m_traceStart = true; // start trace processing
353  triggerPointToEnd = end - begin;
354  break;
355  }
356  }
357  }
358 
359  if (m_triggerComparator.triggered(*begin, *triggerCondition)) // matched the current trigger
360  {
361  if (triggerCondition->m_triggerData.m_triggerDelay > 0)
362  {
363  triggerCondition->m_triggerDelayCount = triggerCondition->m_triggerData.m_triggerDelay; // initialize delayed samples counter
365  ++begin;
366  continue;
367  }
368 
369  if (nextTrigger()) // move to next trigger and keep going
370  {
373  }
374  else // this was the last trigger then start trace
375  {
376  m_traceStart = true; // start of trace processing
380  triggerPointToEnd = end - begin;
381  break;
382  }
383  }
384 
385  ++begin;
386  } // look for trigger
387  } // untriggered or delayed
388 
389  // trace process
390 
392  {
393  int remainder;
394  int count = end - begin; // number of samples in traceback buffer past the current point
395  SampleVector::iterator mend = m_traceDiscreteMemory.current().current();
396  SampleVector::iterator mbegin = mend - count;
397 
398  if (m_traceStart) // start of trace processing
399  {
400  // if trace time is 1s or more the display is progressive so we have to clear it first
401 
402  float traceTime = ((float) m_traceSize) / m_sampleRate;
403 
404  if (traceTime >= 1.0f) {
406  }
407 
408  // process until begin point
409 
410  if (m_maxTraceDelay > 0) { // trace back
412  }
413 
414  if (m_preTriggerDelay > 0) { // pre-trigger
415  processTraces(mbegin - m_preTriggerDelay, mbegin);
416  }
417 
418  // process the rest of the trace
419 
420  remainder = processTraces(mbegin, mend);
421  m_traceStart = false;
422  }
423  else // process the current trace
424  {
425  remainder = processTraces(mbegin, mend);
426  }
427 
428  if (remainder >= 0) // finished
429  {
430  mbegin = mend - remainder;
432  m_traceDiscreteMemory.store(m_preTriggerDelay+remainder); // next memory trace.
435 
436  //if (m_glScope) m_glScope->incrementTraceCounter();
437 
438  // process remainder recursively
439  if (remainder != 0)
440  {
441  int mTriggerPointToEnd = -1;
442 
443  processTrace(mbegin, mend, mTriggerPointToEnd);
444 
445  if (mTriggerPointToEnd >= 0) {
446  triggerPointToEnd = mTriggerPointToEnd;
447  }
448 
449  //qDebug("ScopeVis::processTrace: process remainder recursively (%d %d)", mpoint, mTriggerPoint);
450  }
451  }
452  }
453 }
void write(const SampleVector::const_iterator begin, const SampleVector::const_iterator end)
Definition: scopevis.h:653
void processTrace(const SampleVector::const_iterator &begin, const SampleVector::const_iterator &end, int &triggerPointToEnd)
Definition: scopevis.cpp:299
bool m_triggerWaitForReset
In one shot mode suspended until reset by UI.
Definition: scopevis.h:1147
TraceBackBuffer & current()
Definition: scopevis.h:758
SampleVector::iterator current()
Definition: scopevis.h:662
bool nextTrigger()
Returns true if not final.
Definition: scopevis.cpp:455
Trigger is not kicked off yet (or trigger list is empty)
Definition: scopevis.h:565
Trigger conditions have been kicked off but it is waiting for delay before final kick off...
Definition: scopevis.h:567
uint32_t m_traceSize
Size of traces in number of samples.
Definition: scopevis.h:1130
TraceBackBuffer & store(int samplesToReport)
Definition: scopevis.h:736
int m_maxTraceDelay
Maximum trace delay.
Definition: scopevis.h:1142
uint32_t m_currentTriggerIndex
Index of current index in the chain.
Definition: scopevis.h:1125
bool m_traceStart
Trace is at start point.
Definition: scopevis.h:1135
void initTraceBuffers()
Definition: scopevis.cpp:959
bool triggered(const Sample &s, TriggerCondition &triggerCondition)
Definition: scopevis.h:1039
uint32_t m_preTriggerDelay
Pre-trigger delay in number of samples.
Definition: scopevis.h:1122
SampleVector::iterator m_endPoint
Definition: scopevis.h:636
Trigger has been kicked off.
Definition: scopevis.h:566
int m_nbSamples
Number of samples yet to process in one complex trace.
Definition: scopevis.h:1132
int processTraces(const SampleVector::const_iterator &begin, const SampleVector::const_iterator &end, bool traceBack=false)
Definition: scopevis.cpp:490
std::vector< TriggerCondition * > m_triggerConditions
Chain of triggers.
Definition: scopevis.h:1124
TriggerComparator m_triggerComparator
Compares sample level to trigger level.
Definition: scopevis.h:1143
TraceBackDiscreteMemory m_traceDiscreteMemory
Complex trace memory for triggered states TODO: vectorize when more than on input is allowed...
Definition: scopevis.h:1140
TriggerState m_triggerState
Current trigger state.
Definition: scopevis.h:1127
bool m_triggerOneShot
True when one shot mode is active.
Definition: scopevis.h:1146
int m_sampleRate
Actual sample rate being used.
Definition: scopevis.h:1137
bool m_freeRun
True if free running (trigger globally disabled)
Definition: scopevis.h:1141
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ processTraces()

int ScopeVis::processTraces ( const SampleVector::const_iterator &  begin,
const SampleVector::const_iterator &  end,
bool  traceBack = false 
)
private

Process traces from complex trace memory buffer.

  • if finished it returns the number of unprocessed samples left in the buffer
  • if not finished it returns -1

Definition at line 490 of file scopevis.cpp.

References ScopeVis::Traces::currentBufferIndex(), GLScope::getProcessingTraceIndex(), m_glScope, m_nbSamples, m_sampleRate, m_timeBase, m_timeOfsProMill, ScopeVis::Traces::m_traces, m_traces, ScopeVis::Traces::m_tracesControl, ScopeVis::Traces::m_tracesData, m_traceSize, GLScope::newTraces(), Projector::ProjectionMagDB, Projector::ProjectionMagLin, Projector::ProjectionMagSq, SDR_RX_SCALEF, and ScopeVis::Traces::switchBuffer().

Referenced by processMemoryTrace(), and processTrace().

491 {
492  SampleVector::const_iterator begin(cbegin);
493  uint32_t shift = (m_timeOfsProMill / 1000.0) * m_traceSize;
494  uint32_t length = m_traceSize / m_timeBase;
495 
496  while ((begin < end) && (m_nbSamples > 0))
497  {
498  std::vector<TraceControl*>::iterator itCtl = m_traces.m_tracesControl.begin();
499  std::vector<TraceData>::iterator itData = m_traces.m_tracesData.begin();
500  std::vector<float *>::iterator itTrace = m_traces.m_traces[m_traces.currentBufferIndex()].begin();
501 
502  for (; itCtl != m_traces.m_tracesControl.end(); ++itCtl, ++itData, ++itTrace)
503  {
504  if (traceBack && ((end - begin) > itData->m_traceDelay)) { // before start of trace
505  continue;
506  }
507 
508  Projector::ProjectionType projectionType = itData->m_projectionType;
509 
510  if ((*itCtl)->m_traceCount[m_traces.currentBufferIndex()] < m_traceSize)
511  {
512  uint32_t& traceCount = (*itCtl)->m_traceCount[m_traces.currentBufferIndex()]; // reference for code clarity
513  float v;
514 
515  if (projectionType == Projector::ProjectionMagLin)
516  {
517  v = ((*itCtl)->m_projector.run(*begin) - itData->m_ofs)*itData->m_amp - 1.0f;
518  }
519  else if (projectionType == Projector::ProjectionMagSq)
520  {
521  Real magsq = (*itCtl)->m_projector.run(*begin);
522  v = (magsq - itData->m_ofs)*itData->m_amp - 1.0f;
523 
524  if ((traceCount >= shift) && (traceCount < shift+length)) // power display overlay values construction
525  {
526  if (traceCount == shift)
527  {
528  (*itCtl)->m_maxPow = 0.0f;
529  (*itCtl)->m_sumPow = 0.0f;
530  (*itCtl)->m_nbPow = 1;
531  }
532 
533  if (magsq > 0.0f)
534  {
535  if (magsq > (*itCtl)->m_maxPow)
536  {
537  (*itCtl)->m_maxPow = magsq;
538  }
539 
540  (*itCtl)->m_sumPow += magsq;
541  (*itCtl)->m_nbPow++;
542  }
543  }
544 
545  if ((m_nbSamples == 1) && ((*itCtl)->m_nbPow > 0)) // on last sample create power display overlay
546  {
547  double avgPow = (*itCtl)->m_sumPow / (*itCtl)->m_nbPow;
548  itData->m_textOverlay = QString("%1 %2").arg((*itCtl)->m_maxPow, 0, 'e', 2).arg(avgPow, 0, 'e', 2);
549  (*itCtl)->m_nbPow = 0;
550  }
551  }
552  else if (projectionType == Projector::ProjectionMagDB)
553  {
554  Real re = begin->m_real / SDR_RX_SCALEF;
555  Real im = begin->m_imag / SDR_RX_SCALEF;
556  double magsq = re*re + im*im;
557  float pdB = log10f(magsq) * 10.0f;
558  float p = pdB - (100.0f * itData->m_ofs);
559  v = ((p/50.0f) + 2.0f)*itData->m_amp - 1.0f;
560 
561  if ((traceCount >= shift) && (traceCount < shift+length)) // power display overlay values construction
562  {
563  if (traceCount == shift)
564  {
565  (*itCtl)->m_maxPow = 0.0f;
566  (*itCtl)->m_sumPow = 0.0f;
567  (*itCtl)->m_nbPow = 1;
568  }
569 
570  if (magsq > 0.0f)
571  {
572  if (magsq > (*itCtl)->m_maxPow)
573  {
574  (*itCtl)->m_maxPow = magsq;
575  }
576 
577  (*itCtl)->m_sumPow += magsq;
578  (*itCtl)->m_nbPow++;
579  }
580  }
581 
582  if ((m_nbSamples == 1) && ((*itCtl)->m_nbPow > 0)) // on last sample create power display overlay
583  {
584  double avgPow = log10f((*itCtl)->m_sumPow / (*itCtl)->m_nbPow)*10.0;
585  double peakPow = log10f((*itCtl)->m_maxPow)*10.0;
586  double peakToAvgPow = peakPow - avgPow;
587  itData->m_textOverlay = QString("%1 %2 %3").arg(peakPow, 0, 'f', 1).arg(avgPow, 0, 'f', 1).arg(peakToAvgPow, 4, 'f', 1, ' ');
588  (*itCtl)->m_nbPow = 0;
589  }
590  }
591  else
592  {
593  v = ((*itCtl)->m_projector.run(*begin) - itData->m_ofs) * itData->m_amp;
594  }
595 
596  if(v > 1.0f) {
597  v = 1.0f;
598  } else if (v < -1.0f) {
599  v = -1.0f;
600  }
601 
602  (*itTrace)[2*traceCount]
603  = traceCount - shift; // display x
604  (*itTrace)[2*traceCount + 1] = v; // display y
605  traceCount++;
606  }
607  }
608 
609  ++begin;
610  m_nbSamples--;
611  }
612 
613  float traceTime = ((float) m_traceSize) / m_sampleRate;
614 
615  if (traceTime >= 1.0f) { // display continuously if trace time is 1 second or more
617  }
618 
619  if (m_nbSamples == 0) // finished
620  {
621  // display only at trace end if trace time is less than 1 second
622  if (traceTime < 1.0f)
623  {
624  if (m_glScope->getProcessingTraceIndex().load() < 0) {
626  }
627  }
628 
629  // switch to next buffer only if it is not being processed by the scope
630  if (m_glScope->getProcessingTraceIndex().load() != (((int) m_traces.currentBufferIndex() + 1) % 2)) {
632  }
633 
634  return end - begin; // return remainder count
635  }
636  else
637  {
638  return -1; // mark not finished
639  }
640 }
void newTraces(std::vector< float *> *traces)
Definition: glscope.cpp:103
uint32_t currentBufferIndex() const
Definition: scopevis.h:1013
std::vector< TraceControl * > m_tracesControl
Corresponding traces control data.
Definition: scopevis.h:876
std::vector< TraceData > m_tracesData
Corresponding traces data.
Definition: scopevis.h:877
Calculate logarithmic (dB) of squared magnitude.
Definition: projector.h:31
ProjectionType
Definition: projector.h:25
uint32_t m_timeOfsProMill
Start trace shift in 1/1000 trace size.
Definition: scopevis.h:1134
unsigned int uint32_t
Definition: rtptypes_win.h:46
#define SDR_RX_SCALEF
Definition: dsptypes.h:33
uint32_t m_traceSize
Size of traces in number of samples.
Definition: scopevis.h:1130
GLScope * m_glScope
Definition: scopevis.h:1121
uint32_t m_timeBase
Trace display time divisor.
Definition: scopevis.h:1133
Calculate linear magnitude or modulus.
Definition: projector.h:29
Calculate linear squared magnitude or power.
Definition: projector.h:30
void switchBuffer()
Definition: scopevis.h:1016
Traces m_traces
Displayable traces.
Definition: scopevis.h:1128
const QAtomicInt & getProcessingTraceIndex() const
Definition: glscope.h:82
int m_nbSamples
Number of samples yet to process in one complex trace.
Definition: scopevis.h:1132
float Real
Definition: dsptypes.h:42
int m_sampleRate
Actual sample rate being used.
Definition: scopevis.h:1137
std::vector< float * > m_traces[2]
Double buffer of traces processed by glScope.
Definition: scopevis.h:878
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeTrace()

void ScopeVis::removeTrace ( uint32_t  traceIndex)

Definition at line 156 of file scopevis.cpp.

References ScopeVis::MsgScopeVisNGRemoveTrace::create(), BasebandSampleSink::getInputMessageQueue(), and MessageQueue::push().

Referenced by GLScopeGUI::deserialize(), and GLScopeGUI::on_traceDel_clicked().

157 {
158  qDebug() << "ScopeVis::removeTrace:"
159  << " trace: " << traceIndex;
160  Message* cmd = MsgScopeVisNGRemoveTrace::create(traceIndex);
161  getInputMessageQueue()->push(cmd);
162 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
static MsgScopeVisNGRemoveTrace * create(uint32_t traceIndex)
Definition: scopevis.h:454
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeTrigger()

void ScopeVis::removeTrigger ( uint32_t  triggerIndex)

Definition at line 191 of file scopevis.cpp.

References ScopeVis::MsgScopeVisNGRemoveTrigger::create(), BasebandSampleSink::getInputMessageQueue(), and MessageQueue::push().

Referenced by GLScopeGUI::deserialize(), and GLScopeGUI::on_trigDel_clicked().

192 {
193  Message* cmd = MsgScopeVisNGRemoveTrigger::create(triggerIndex);
194  getInputMessageQueue()->push(cmd);
195 }
static MsgScopeVisNGRemoveTrigger * create(uint32_t triggerIndex)
Definition: scopevis.h:342
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ serializeMemory()

QByteArray ScopeVis::serializeMemory ( ) const
inline

Definition at line 174 of file scopevis.h.

References SimpleSerializer::final(), SimpleSerializer::writeBlob(), SimpleSerializer::writeS32(), and SimpleSerializer::writeU32().

Referenced by GLScopeGUI::on_memorySave_clicked().

175  {
176  SimpleSerializer s(1);
177 
178  s.writeU32(1, m_traceSize);
179  s.writeU32(2, m_preTriggerDelay);
180  s.writeS32(3, m_sampleRate);
181  QByteArray buffer = m_traceDiscreteMemory.serialize();
182  s.writeBlob(4, buffer);
183 
184  return s.final();
185  }
uint32_t m_traceSize
Size of traces in number of samples.
Definition: scopevis.h:1130
uint32_t m_preTriggerDelay
Pre-trigger delay in number of samples.
Definition: scopevis.h:1122
TraceBackDiscreteMemory m_traceDiscreteMemory
Complex trace memory for triggered states TODO: vectorize when more than on input is allowed...
Definition: scopevis.h:1140
QByteArray serialize() const
Definition: scopevis.h:779
int m_sampleRate
Actual sample rate being used.
Definition: scopevis.h:1137
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setLiveRate()

void ScopeVis::setLiveRate ( int  sampleRate)

Definition at line 83 of file scopevis.cpp.

References m_currentTraceMemoryIndex, m_liveLog2Decim, m_liveSampleRate, and setSampleRate().

Referenced by ATVDemodGUI::handleMessage(), handleMessage(), setLiveRateLog2Decim(), and ChannelAnalyzerGUI::setNewFinalRate().

84 {
85  m_liveSampleRate = sampleRate;
86 
87  if (m_currentTraceMemoryIndex == 0) { // update only in live mode
89  }
90 }
int m_liveSampleRate
Sample rate in live mode.
Definition: scopevis.h:1138
int m_liveLog2Decim
Sample rate decimation log2 in live mode.
Definition: scopevis.h:1139
void setSampleRate(int sampleRate)
Definition: scopevis.cpp:98
uint32_t m_currentTraceMemoryIndex
The current index of trace in memory (0: current)
Definition: scopevis.h:1148
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setLiveRateLog2Decim()

void ScopeVis::setLiveRateLog2Decim ( int  log2Decim)

Definition at line 92 of file scopevis.cpp.

References m_liveLog2Decim, m_liveSampleRate, and setLiveRate().

Referenced by ChannelAnalyzerGUI::applySettings().

93 {
94  m_liveLog2Decim = log2Decim;
96 }
int m_liveSampleRate
Sample rate in live mode.
Definition: scopevis.h:1138
void setLiveRate(int sampleRate)
Definition: scopevis.cpp:83
int m_liveLog2Decim
Sample rate decimation log2 in live mode.
Definition: scopevis.h:1139
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setMemoryIndex()

void ScopeVis::setMemoryIndex ( uint32_t  memoryIndex)

Definition at line 215 of file scopevis.cpp.

References ScopeVis::MsgScopeVisNGMemoryTrace::create(), BasebandSampleSink::getInputMessageQueue(), and MessageQueue::push().

Referenced by GLScopeGUI::on_mem_valueChanged().

216 {
217  Message* cmd = MsgScopeVisNGMemoryTrace::create(memoryIndex);
218  getInputMessageQueue()->push(cmd);
219 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
static MsgScopeVisNGMemoryTrace * create(uint32_t memoryIndex)
Definition: scopevis.h:542
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setOneShot()

void ScopeVis::setOneShot ( bool  oneShot)

Definition at line 209 of file scopevis.cpp.

References ScopeVis::MsgScopeVisNGOneShot::create(), BasebandSampleSink::getInputMessageQueue(), and MessageQueue::push().

Referenced by GLScopeGUI::on_trigOneShot_toggled().

210 {
211  Message* cmd = MsgScopeVisNGOneShot::create(oneShot);
212  getInputMessageQueue()->push(cmd);
213 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
static MsgScopeVisNGOneShot * create(bool oneShot)
Definition: scopevis.h:521
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPreTriggerDelay()

void ScopeVis::setPreTriggerDelay ( uint32_t  preTriggerDelay,
bool  emitSignal = false 
)
private

Set the pre trigger delay

Definition at line 120 of file scopevis.cpp.

References m_glScope, m_preTriggerDelay, and GLScope::setTriggerPre().

Referenced by handleMessage().

121 {
122  m_preTriggerDelay = preTriggerDelay;
123 
124  if (m_glScope) {
126  }
127 }
void setTriggerPre(uint32_t triggerPre, bool emitSignal=false)
number of samples
Definition: glscope.cpp:965
GLScope * m_glScope
Definition: scopevis.h:1121
uint32_t m_preTriggerDelay
Pre-trigger delay in number of samples.
Definition: scopevis.h:1122
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSampleRate()

void ScopeVis::setSampleRate ( int  sampleRate)
private

Set the actual sample rate

Definition at line 98 of file scopevis.cpp.

References m_glScope, m_sampleRate, and GLScope::setSampleRate().

Referenced by setLiveRate().

99 {
100  qDebug("ScopeVis::setSampleRate: %d S/s", sampleRate);
101  m_sampleRate = sampleRate;
102 
103  if (m_glScope) {
105  }
106 }
GLScope * m_glScope
Definition: scopevis.h:1121
int m_sampleRate
Actual sample rate being used.
Definition: scopevis.h:1137
void setSampleRate(int sampleRate)
Definition: glscope.cpp:950
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTraceSize()

void ScopeVis::setTraceSize ( uint32_t  traceSize,
bool  emitSignal = false 
)
private

Set the traces size

Definition at line 108 of file scopevis.cpp.

References initTraceBuffers(), m_glScope, m_traceDiscreteMemory, m_traces, m_traceSize, ScopeVis::TraceBackDiscreteMemory::resize(), ScopeVis::Traces::resize(), and GLScope::setTraceSize().

Referenced by handleMessage().

109 {
110  m_traceSize = traceSize;
114 
115  if (m_glScope) {
116  m_glScope->setTraceSize(m_traceSize, emitSignal);
117  }
118 }
void setTraceSize(int trceSize, bool emitSignal=false)
Definition: glscope.cpp:997
uint32_t m_traceSize
Size of traces in number of samples.
Definition: scopevis.h:1130
GLScope * m_glScope
Definition: scopevis.h:1121
void initTraceBuffers()
Definition: scopevis.cpp:959
void resize(uint32_t size)
Definition: scopevis.h:721
Traces m_traces
Displayable traces.
Definition: scopevis.h:1128
void resize(int traceSize)
Definition: scopevis.h:989
TraceBackDiscreteMemory m_traceDiscreteMemory
Complex trace memory for triggered states TODO: vectorize when more than on input is allowed...
Definition: scopevis.h:1140
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ start()

void ScopeVis::start ( )
virtual

Implements BasebandSampleSink.

Definition at line 642 of file scopevis.cpp.

Referenced by SpectrumScopeComboVis::start().

643 {
644 }
+ Here is the caller graph for this function:

◆ stop()

void ScopeVis::stop ( )
virtual

Implements BasebandSampleSink.

Definition at line 646 of file scopevis.cpp.

Referenced by SpectrumScopeComboVis::stop().

647 {
648 }
+ Here is the caller graph for this function:

◆ updateGLScopeDisplay()

void ScopeVis::updateGLScopeDisplay ( )
private

Update glScope display

  • Live trace: call glScipe update method
  • Trace in memory: call process memory trace

Definition at line 1020 of file scopevis.cpp.

References m_currentTraceMemoryIndex, m_glScope, processMemoryTrace(), GLScope::setConfigChanged(), and GLScope::updateDisplay().

Referenced by handleMessage().

1021 {
1022  if (m_currentTraceMemoryIndex > 0) {
1025  } else {
1027  }
1028 }
void setConfigChanged()
Definition: glscope.h:76
void updateDisplay()
Definition: glscope.cpp:1008
GLScope * m_glScope
Definition: scopevis.h:1121
void processMemoryTrace()
Definition: scopevis.cpp:279
uint32_t m_currentTraceMemoryIndex
The current index of trace in memory (0: current)
Definition: scopevis.h:1148
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateMaxTraceDelay()

void ScopeVis::updateMaxTraceDelay ( )
private

Get maximum trace delay

Definition at line 912 of file scopevis.cpp.

References m_maxTraceDelay, m_projectorCache, m_traces, ScopeVis::Traces::m_tracesControl, ScopeVis::Traces::m_tracesData, Projector::nbProjectionTypes, and Projector::ProjectionReal.

Referenced by handleMessage().

913 {
914  int maxTraceDelay = 0;
915  bool allocateCache = false;
916  uint32_t projectorCounts[(int) Projector::nbProjectionTypes];
917  memset(projectorCounts, 0, ((int) Projector::nbProjectionTypes)*sizeof(uint32_t));
918  std::vector<TraceData>::iterator itData = m_traces.m_tracesData.begin();
919  std::vector<TraceControl*>::iterator itCtrl = m_traces.m_tracesControl.begin();
920 
921  for (; itData != m_traces.m_tracesData.end(); ++itData, ++itCtrl)
922  {
923  if (itData->m_traceDelay > maxTraceDelay)
924  {
925  maxTraceDelay = itData->m_traceDelay;
926  }
927 
928  if (itData->m_projectionType < 0) {
929  itData->m_projectionType = Projector::ProjectionReal;
930  }
931 
932  if (projectorCounts[(int) itData->m_projectionType] > 0)
933  {
934  allocateCache = true;
935  (*itCtrl)->m_projector.setCacheMaster(false);
936  }
937  else
938  {
939  (*itCtrl)->m_projector.setCacheMaster(true);
940  }
941 
942  projectorCounts[(int) itData->m_projectionType]++;
943  }
944 
945  itCtrl = m_traces.m_tracesControl.begin();
946 
947  for (; itCtrl != m_traces.m_tracesControl.end(); ++itCtrl)
948  {
949  if (allocateCache) {
950  (*itCtrl)->m_projector.setCache(m_projectorCache);
951  } else {
952  (*itCtrl)->m_projector.setCache(0);
953  }
954  }
955 
956  m_maxTraceDelay = maxTraceDelay;
957 }
std::vector< TraceControl * > m_tracesControl
Corresponding traces control data.
Definition: scopevis.h:876
std::vector< TraceData > m_tracesData
Corresponding traces data.
Definition: scopevis.h:877
Gives the number of projections in the enum.
Definition: projector.h:38
unsigned int uint32_t
Definition: rtptypes_win.h:46
Real m_projectorCache[(int) Projector::nbProjectionTypes]
Definition: scopevis.h:1145
int m_maxTraceDelay
Maximum trace delay.
Definition: scopevis.h:1142
Traces m_traces
Displayable traces.
Definition: scopevis.h:1128
Extract real part.
Definition: projector.h:27
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_currentTraceMemoryIndex

uint32_t ScopeVis::m_currentTraceMemoryIndex
private

The current index of trace in memory (0: current)

Definition at line 1148 of file scopevis.h.

Referenced by feed(), handleMessage(), processMemoryTrace(), setLiveRate(), and updateGLScopeDisplay().

◆ m_currentTriggerIndex

uint32_t ScopeVis::m_currentTriggerIndex
private

Index of current index in the chain.

Definition at line 1125 of file scopevis.h.

Referenced by nextTrigger(), and processTrace().

◆ m_focusedTraceIndex

int ScopeVis::m_focusedTraceIndex
private

Index of the trace that has focus.

Definition at line 1129 of file scopevis.h.

Referenced by handleMessage().

◆ m_focusedTriggerIndex

uint32_t ScopeVis::m_focusedTriggerIndex
private

Index of the trigger that has focus.

Definition at line 1126 of file scopevis.h.

Referenced by computeDisplayTriggerLevels(), and handleMessage().

◆ m_freeRun

bool ScopeVis::m_freeRun
private

True if free running (trigger globally disabled)

Definition at line 1141 of file scopevis.h.

Referenced by feed(), handleMessage(), and processTrace().

◆ m_glScope

GLScope* ScopeVis::m_glScope
private

◆ m_liveLog2Decim

int ScopeVis::m_liveLog2Decim
private

Sample rate decimation log2 in live mode.

Definition at line 1139 of file scopevis.h.

Referenced by setLiveRate(), and setLiveRateLog2Decim().

◆ m_livePreTriggerDelay

uint32_t ScopeVis::m_livePreTriggerDelay
private

Pre-trigger delay in number of samples in live mode.

Definition at line 1123 of file scopevis.h.

Referenced by handleMessage().

◆ m_liveSampleRate

int ScopeVis::m_liveSampleRate
private

Sample rate in live mode.

Definition at line 1138 of file scopevis.h.

Referenced by handleMessage(), setLiveRate(), and setLiveRateLog2Decim().

◆ m_liveTraceSize

uint32_t ScopeVis::m_liveTraceSize
private

Size of traces in number of samples in live mode.

Definition at line 1131 of file scopevis.h.

Referenced by handleMessage().

◆ m_maxNbTraces

const uint32_t ScopeVis::m_maxNbTraces = 10
static

Definition at line 152 of file scopevis.h.

◆ m_maxNbTriggers

const uint32_t ScopeVis::m_maxNbTriggers = 10
static

Definition at line 151 of file scopevis.h.

◆ m_maxTraceDelay

int ScopeVis::m_maxTraceDelay
private

Maximum trace delay.

Definition at line 1142 of file scopevis.h.

Referenced by processMemoryTrace(), processTrace(), and updateMaxTraceDelay().

◆ m_mutex

QMutex ScopeVis::m_mutex
private

Definition at line 1144 of file scopevis.h.

Referenced by feed(), and handleMessage().

◆ m_nbSamples

int ScopeVis::m_nbSamples
private

Number of samples yet to process in one complex trace.

Definition at line 1132 of file scopevis.h.

Referenced by processMemoryTrace(), processTrace(), and processTraces().

◆ m_nbTraceMemories

const uint32_t ScopeVis::m_nbTraceMemories = 50
static

Definition at line 153 of file scopevis.h.

Referenced by GLScopeGUI::GLScopeGUI(), and processMemoryTrace().

◆ m_preTriggerDelay

uint32_t ScopeVis::m_preTriggerDelay
private

Pre-trigger delay in number of samples.

Definition at line 1122 of file scopevis.h.

Referenced by handleMessage(), processTrace(), and setPreTriggerDelay().

◆ m_projectorCache

Real ScopeVis::m_projectorCache[(int) Projector::nbProjectionTypes]
private

Definition at line 1145 of file scopevis.h.

Referenced by ScopeVis(), and updateMaxTraceDelay().

◆ m_sampleRate

int ScopeVis::m_sampleRate
private

Actual sample rate being used.

Definition at line 1137 of file scopevis.h.

Referenced by handleMessage(), processTrace(), processTraces(), and setSampleRate().

◆ m_timeBase

uint32_t ScopeVis::m_timeBase
private

Trace display time divisor.

Definition at line 1133 of file scopevis.h.

Referenced by handleMessage(), and processTraces().

◆ m_timeOfsProMill

uint32_t ScopeVis::m_timeOfsProMill
private

Start trace shift in 1/1000 trace size.

Definition at line 1134 of file scopevis.h.

Referenced by handleMessage(), initTraceBuffers(), and processTraces().

◆ m_traceChunkSize

const uint ScopeVis::m_traceChunkSize = 4800
static

◆ m_traceDiscreteMemory

TraceBackDiscreteMemory ScopeVis::m_traceDiscreteMemory
private

Complex trace memory for triggered states TODO: vectorize when more than on input is allowed.

Definition at line 1140 of file scopevis.h.

Referenced by processMemoryTrace(), processTrace(), ScopeVis(), and setTraceSize().

◆ m_traces

Traces ScopeVis::m_traces
private

◆ m_traceSize

uint32_t ScopeVis::m_traceSize
private

Size of traces in number of samples.

Definition at line 1130 of file scopevis.h.

Referenced by feed(), handleMessage(), initTraceBuffers(), processMemoryTrace(), processTrace(), processTraces(), and setTraceSize().

◆ m_traceStart

bool ScopeVis::m_traceStart
private

Trace is at start point.

Definition at line 1135 of file scopevis.h.

Referenced by processTrace().

◆ m_triggerComparator

TriggerComparator ScopeVis::m_triggerComparator
private

Compares sample level to trigger level.

Definition at line 1143 of file scopevis.h.

Referenced by processTrace().

◆ m_triggerConditions

std::vector<TriggerCondition*> ScopeVis::m_triggerConditions
private

Chain of triggers.

Definition at line 1124 of file scopevis.h.

Referenced by computeDisplayTriggerLevels(), handleMessage(), nextTrigger(), processTrace(), and ~ScopeVis().

◆ m_triggerLocation

int ScopeVis::m_triggerLocation
private

Trigger location from end point.

Definition at line 1136 of file scopevis.h.

Referenced by feed().

◆ m_triggerOneShot

bool ScopeVis::m_triggerOneShot
private

True when one shot mode is active.

Definition at line 1146 of file scopevis.h.

Referenced by handleMessage(), and processTrace().

◆ m_triggerState

TriggerState ScopeVis::m_triggerState
private

Current trigger state.

Definition at line 1127 of file scopevis.h.

Referenced by feed(), and processTrace().

◆ m_triggerWaitForReset

bool ScopeVis::m_triggerWaitForReset
private

In one shot mode suspended until reset by UI.

Definition at line 1147 of file scopevis.h.

Referenced by feed(), handleMessage(), and processTrace().


The documentation for this class was generated from the following files: