CANdevStudio
Development tool for CAN bus simulation
Loading...
Searching...
No Matches
canrawplayer_p.h
Go to the documentation of this file.
1#ifndef CANRAWPLAYER_P_H
2#define CANRAWPLAYER_P_H
3
4#include <QtCore/QObject>
5#include <QtSerialBus/QCanBusFrame>
6#include <QtCore/QTimer>
7#include <memory>
8#include "canrawplayer.h"
9#include <propertyfields.h>
10
11class CanRawPlayer;
12
13class CanRawPlayerPrivate : public QObject {
14 Q_OBJECT
15 Q_DECLARE_PUBLIC(CanRawPlayer)
16
17public:
20 QJsonObject getSettings();
21 void setSettings(const QJsonObject& json);
22 void loadTraceFile(const QString& filename);
23 void startPlayback();
24 void stopPlayback();
25
26private:
27 void initProps();
28
29
30private slots:
31 void timeout();
32
33public:
34 bool _simStarted{ false };
36 std::map<QString, QVariant> _props;
37 uint32_t _tick{ 10 };
38 const QString _nameProperty = "name";
39 const QString _fileProperty = "file";
40 const QString _tickProperty = "timer tick [ms]";
41
42private:
43 CanRawPlayer* q_ptr;
44 std::vector<std::pair<unsigned int, QCanBusFrame>> _frames;
45 uint32_t _frameNdx;
46 uint32_t _ticks;
47 QTimer _timer;
48
49 // workaround for clang 3.5
51
52 // clang-format off
54 std::make_tuple(_nameProperty, QVariant::String, true, cf(nullptr)),
55 std::make_tuple(_fileProperty, QVariant::String, true, cf([] { return new PropertyFieldPath; } )),
56 std::make_tuple(_tickProperty, QVariant::String, true, cf([] { return new PropertyFieldText(true); } ))
57 };
58 // clang-format on
59};
60
61#endif // CANRAWPLAYER_P_H
Context CanRawPlayerCtx
Definition canrawplayer.h:13
Definition canrawplayer.h:15
Definition canrawplayer_p.h:13
const QString _fileProperty
Definition canrawplayer_p.h:39
CanRawPlayerCtx _ctx
Definition canrawplayer_p.h:35
void setSettings(const QJsonObject &json)
Definition canrawplayer_p.cpp:47
uint32_t _tick
Definition canrawplayer_p.h:37
void stopPlayback()
Definition canrawplayer_p.cpp:96
QJsonObject getSettings()
Definition canrawplayer_p.cpp:36
bool _simStarted
Definition canrawplayer_p.h:34
ComponentInterface::ComponentProperties getSupportedProperties() const
Definition canrawplayer_p.cpp:31
std::map< QString, QVariant > _props
Definition canrawplayer_p.h:36
const QString _nameProperty
Definition canrawplayer_p.h:38
void startPlayback()
Definition canrawplayer_p.cpp:101
const QString _tickProperty
Definition canrawplayer_p.h:40
void loadTraceFile(const QString &filename)
Definition canrawplayer_p.cpp:56
std::vector< ComponentProperty > ComponentProperties
Definition componentinterface.h:66
std::function< QWidget *(void)> CustomEditFieldCbk
Definition componentinterface.h:64
Definition context.h:13
Definition propertyfields.h:49
Definition propertyfields.h:17