CANdevStudio
Development tool for CAN bus simulation
Loading...
Searching...
No Matches
cansignalsendermodel.h
Go to the documentation of this file.
1#ifndef CANSIGNALSENDERMODEL_H
2#define CANSIGNALSENDERMODEL_H
3
4#include "componentmodel.h"
5#include "nodepainter.h"
6#include <QtCore/QObject>
7#include <candbpainter.h>
8#include <cansignalsender.h>
9#include <readerwriterqueue.h>
10
11using QtNodes::NodeData;
12using QtNodes::NodeDataType;
13using QtNodes::PortIndex;
14using QtNodes::PortType;
15
16enum class Direction;
17
18class CanSignalSenderModel : public ComponentModel<CanSignalSender, CanSignalSenderModel> {
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>, PortIndex) override {}
28 QtNodes::NodePainterDelegate* painterDelegate() const override;
29
30public slots:
31 void rcvSignal(const QString& name, const QVariant& val);
32
33signals:
35
36private:
37 std::unique_ptr<CanDbPainter> _painter;
38 QString _sigName;
39 QVariant _sigVal;
40 // 127 to use 4 blocks, 512 bytes each
41 moodycamel::ReaderWriterQueue<std::shared_ptr<NodeData>> _rxQueue{ 127 };
42};
43
44#endif // CANSIGNALSENDERMODEL_H
Definition cansignalsendermodel.h:18
void rcvSignal(const QString &name, const QVariant &val)
Definition cansignalsendermodel.cpp:70
std::shared_ptr< NodeData > outData(PortIndex port) override
Definition cansignalsendermodel.cpp:57
NodeDataType dataType(PortType portType, PortIndex portIndex) const override
Definition cansignalsendermodel.cpp:47
QtNodes::NodePainterDelegate * painterDelegate() const override
Definition cansignalsendermodel.cpp:37
void setInData(std::shared_ptr< NodeData >, PortIndex) override
Definition cansignalsendermodel.h:27
CanSignalSenderModel()
Definition cansignalsendermodel.cpp:24
unsigned int nPorts(PortType portType) const override
Definition cansignalsendermodel.cpp:42
Definition componentmodel.h:37
virtual QString name() const override
Used to identify model by data model name.
Definition componentmodel.h:115
Direction
The enum class describing frame direction.
Definition datadirection.h:7