CANdevStudio
Development tool for CAN bus simulation
Loading...
Searching...
No Matches
canrawplayermodel.h
Go to the documentation of this file.
1#ifndef CANRAWPLAYERMODEL_H
2#define CANRAWPLAYERMODEL_H
3
4#include "canrawplayer.h"
5#include "componentmodel.h"
6#include "nodepainter.h"
7#include <QCanBusFrame>
8#include <QtCore/QObject>
9#include <readerwriterqueue.h>
10
11using QtNodes::NodeData;
12using QtNodes::NodeDataType;
13using QtNodes::PortIndex;
14using QtNodes::PortType;
15
16enum class Direction;
17
18class CanRawPlayerModel : public ComponentModel<CanRawPlayer, CanRawPlayerModel> {
19 Q_OBJECT
20
21public:
23
24 unsigned int nPorts(PortType portType) const override;
25 NodeDataType dataType(PortType portType, PortIndex portIndex) const override;
26 std::shared_ptr<NodeData> outData(PortIndex port) override;
27 void setInData(std::shared_ptr<NodeData> nodeData, PortIndex port) override;
28 QtNodes::NodePainterDelegate* painterDelegate() const override;
29
30 virtual bool hasSeparateThread() const override
31 {
32 return true;
33 }
34
35public slots:
36
41 void sendFrame(const QCanBusFrame& frame);
42
43signals:
45
46private:
47 std::unique_ptr<NodePainter> _painter;
48 moodycamel::ReaderWriterQueue<std::shared_ptr<NodeData>> _msgQueue{ 127 };
49};
50
51#endif // CANRAWPLAYERMODEL_H
Definition canrawplayermodel.h:18
QtNodes::NodePainterDelegate * painterDelegate() const override
Definition canrawplayermodel.cpp:34
std::shared_ptr< NodeData > outData(PortIndex port) override
Definition canrawplayermodel.cpp:54
unsigned int nPorts(PortType portType) const override
Definition canrawplayermodel.cpp:39
void setInData(std::shared_ptr< NodeData > nodeData, PortIndex port) override
Definition canrawplayermodel.cpp:67
virtual bool hasSeparateThread() const override
Definition canrawplayermodel.h:30
NodeDataType dataType(PortType portType, PortIndex portIndex) const override
Definition canrawplayermodel.cpp:44
void sendFrame(const QCanBusFrame &frame)
Callback, called when CanRawSender emits signal sendFrame, sends frame.
Definition canrawplayermodel.cpp:72
CanRawPlayerModel()
Definition canrawplayermodel.cpp:23
Definition componentmodel.h:37
Direction
The enum class describing frame direction.
Definition datadirection.h:7