CANdevStudio
Development tool for CAN bus simulation
Loading...
Searching...
No Matches
canrawsendermodel.h
Go to the documentation of this file.
1#ifndef CANRAWSENDERMODEL_H
2#define CANRAWSENDERMODEL_H
3
4#include "canrawsender.h"
5#include "componentmodel.h"
6#include "nodepainter.h"
7#include <QtSerialBus/QCanBusFrame>
8
9using QtNodes::NodeData;
10using QtNodes::NodeDataType;
11using QtNodes::PortIndex;
12using QtNodes::PortType;
13
17class CanRawSenderModel : public ComponentModel<CanRawSender, CanRawSenderModel> {
18 Q_OBJECT
19
20public:
22 virtual ~CanRawSenderModel() = default;
23
29 unsigned int nPorts(PortType portType) const override;
30
37 NodeDataType dataType(PortType portType, PortIndex portIndex) const override;
38
44 std::shared_ptr<NodeData> outData(PortIndex port) override;
45
51 void setInData(std::shared_ptr<NodeData>, PortIndex) override{};
52
57 QtNodes::NodePainterDelegate* painterDelegate() const override;
58
59public slots:
60
65 void sendFrame(const QCanBusFrame& frame);
66
67signals:
69
70private:
71 QCanBusFrame _frame;
72 std::unique_ptr<NodePainter> _painter;
73};
74
75#endif // CANRAWSENDERMODEL_H
The class provides node graphical representation of CanRawSender.
Definition canrawsendermodel.h:17
void setInData(std::shared_ptr< NodeData >, PortIndex) override
Handles data on input port, not used in this class.
Definition canrawsendermodel.h:51
std::shared_ptr< NodeData > outData(PortIndex port) override
Sets output data for propagation.
Definition canrawsendermodel.cpp:29
CanRawSenderModel()
Definition canrawsendermodel.cpp:5
NodeDataType dataType(PortType portType, PortIndex portIndex) const override
Used to get data type of each port.
Definition canrawsendermodel.cpp:24
unsigned int nPorts(PortType portType) const override
Used to get number of ports of each type used by model.
Definition canrawsendermodel.cpp:41
void sendFrame(const QCanBusFrame &frame)
Callback, called when CanRawSender emits signal sendFrame, sends frame.
Definition canrawsendermodel.cpp:34
virtual ~CanRawSenderModel()=default
QtNodes::NodePainterDelegate * painterDelegate() const override
Used to provide custom painter to nodeeditor.
Definition canrawsendermodel.cpp:19
Definition componentmodel.h:37