OpenCurves  0.9
realtimeplot.h
1 //
2 // author Kazys Stepanas
3 //
4 // Copyright (c) CSIRO 2015
5 //
6 #ifndef REALTIMEPLOT_H_
7 #define REALTIMEPLOT_H_
8 
9 #include "ocurvesconfig.h"
10 
11 #include "plotgenerator.h"
12 #include "plotsource.h"
13 
14 #include <QMutex>
15 
16 class Curves;
17 class QSerialPort;
18 class QAbstractSocket;
19 class QMutex;
20 
98 class RealTimeCommSpec;
99 
113 {
114  Q_OBJECT
115 public:
116  enum
117  {
120  };
121 
124  {
127  QByteArray readBuffer;
128 
131 
134  };
135 
139  RealTimePlot(Curves *curves, const QStringList &connectionFiles);
140 
142  ~RealTimePlot();
143 
146  void appendLoad(const QStringList &connectionFiles);
147 
151  bool pendingLoad(QStringList &pendingFiles);
152 
154  void stop();
155 
156 protected:
158  void run() override;
159 
160 private:
164  unsigned loadSpecs(double startTime);
165 
169  RealTimePlotInfo *loadCommFile(const QString &filePath);
170 
180  void createPlots(RealTimePlotInfo &rtplot, unsigned count, const QStringList *headings = nullptr);
181 
183  void createPlots(RealTimePlotInfo &rtplot, const QStringList &headings);
184 
185  QStringList _connectionFiles;
186  QList<RealTimePlotInfo *> _sources;
187  bool _stopRequested;
188 };
189 
190 #endif // REALTIMEPLOT_H_
bool pendingLoad(QStringList &pendingFiles)
Retrieve the list of connection files pending processing.
const Curves * curves() const
Access the curves model to load data into.
Definition: plotgenerator.h:105
RealTimeCommSpec * spec
Communications specification.
Definition: realtimeplot.h:126
void stop()
Stop current real-time plots without terminating the thread.
Generates PlotInstance objects for plotting over real-time connections.
Definition: realtimeplot.h:112
Default read buffer size (bytes).
Definition: realtimeplot.h:119
Default sample buffer size limit (element count).
Definition: realtimeplot.h:118
QByteArray readBuffer
Read buffer.
Definition: realtimeplot.h:127
The data model for loaded plots and curves.
Definition: curves.h:36
void run() override
Run loop.
Data tracked about a real time source.
Definition: realtimeplot.h:123
~RealTimePlot()
Destructor, ensuring the thread is stopped and connections are closed.
Specifies a real time communication specification, messaging and buffer setup.
Definition: realtimecommspec.h:37
RealTimePlot(Curves *curves, const QStringList &connectionFiles)
Create a real-time plot generator based on the given connection file set.
A curve generation thread.
Definition: plotgenerator.h:84
PlotSource::Ptr source
The source.
Definition: realtimeplot.h:125
~RealTimePlotInfo()
Deletes the spec.
void appendLoad(const QStringList &connectionFiles)
Adds additional comm-specs to load (xml files).