CANdevStudio
Development tool for CAN bus simulation
Loading...
Searching...
No Matches
canrawviewmodel.h
Go to the documentation of this file.
1#ifndef CANRAWVIEWMODEL_H
2#define CANRAWVIEWMODEL_H
3
4#include "canrawview.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 CanRawViewModel : public ComponentModel<CanRawView, CanRawViewModel> {
18 Q_OBJECT
19
20public:
22 virtual ~CanRawViewModel() = 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> nodeData, PortIndex port) override;
52
57 QtNodes::NodePainterDelegate* painterDelegate() const override;
58
59signals:
64 void frameReceived(const QCanBusFrame& frame);
65
71 void frameSent(bool status, const QCanBusFrame& frame);
73
74private:
75 QCanBusFrame _frame;
76 std::unique_ptr<NodePainter> _painter;
77};
78
79#endif // CANRAWVIEWMODEL_H
The class provides node graphical representation of CanRawView.
Definition canrawviewmodel.h:17
void frameSent(bool status, const QCanBusFrame &frame)
Emits signal on CAN fram transmission.
CanRawViewModel()
Definition canrawviewmodel.cpp:6
QtNodes::NodePainterDelegate * painterDelegate() const override
Used to provide custom painter to nodeeditor.
Definition canrawviewmodel.cpp:20
std::shared_ptr< NodeData > outData(PortIndex port) override
Sets output data for propagation, not used in this class.
Definition canrawviewmodel.cpp:35
unsigned int nPorts(PortType portType) const override
Used to get number of ports of each type used by model.
Definition canrawviewmodel.cpp:25
virtual ~CanRawViewModel()=default
void setInData(std::shared_ptr< NodeData > nodeData, PortIndex port) override
Handles data on input port, send frames to CanRawView.
Definition canrawviewmodel.cpp:40
void requestRedraw()
NodeDataType dataType(PortType portType, PortIndex portIndex) const override
Used to get data type of each port.
Definition canrawviewmodel.cpp:30
void frameReceived(const QCanBusFrame &frame)
Emits singal on CAN frame receival.
Definition componentmodel.h:37