1#ifndef CANDEVICEMODEL_H
2#define CANDEVICEMODEL_H
7#include <QtCore/QObject>
8#include <QtSerialBus/QCanBusFrame>
9#include <readerwriterqueue.h>
11using QtNodes::NodeData;
12using QtNodes::NodeDataType;
13using QtNodes::PortIndex;
14using QtNodes::PortType;
32 unsigned int nPorts(PortType portType)
const override;
40 NodeDataType
dataType(PortType portType, PortIndex portIndex)
const override;
47 std::shared_ptr<NodeData>
outData(PortIndex port)
override;
54 void setInData(std::shared_ptr<NodeData> nodeData, PortIndex port)
override;
80 void frameSent(
bool status,
const QCanBusFrame& frame);
91 std::shared_ptr<NodeData> _nodeData;
95 std::unique_ptr<NodePainter> _painter;
97 moodycamel::ReaderWriterQueue<std::shared_ptr<NodeData>> _rxQueue{ 127 };
The class provides node graphical representation of CanDevice.
Definition candevicemodel.h:21
virtual bool hasSeparateThread() const override
Definition candevicemodel.h:62
void frameSent(bool status, const QCanBusFrame &frame)
Callback, called when CanDevice emits signal frameReceived.
Definition candevicemodel.cpp:45
void setInData(std::shared_ptr< NodeData > nodeData, PortIndex port) override
Handles data on input port, sends frame if correct.
Definition candevicemodel.cpp:76
NodeDataType dataType(PortType portType, PortIndex portIndex) const override
Used to get data type of each port.
Definition candevicemodel.cpp:56
QtNodes::NodePainterDelegate * painterDelegate() const override
Used to provide custom painter to nodeeditor.
Definition candevicemodel.cpp:22
unsigned int nPorts(PortType portType) const override
Used to get number of ports of each type used by model.
Definition candevicemodel.cpp:27
std::shared_ptr< NodeData > outData(PortIndex port) override
Sets output data for propagation.
Definition candevicemodel.cpp:63
CanDeviceModel()
Definition candevicemodel.cpp:7
void sendFrame(const QCanBusFrame &frame)
Used to send a frame.
void frameReceived(const QCanBusFrame &frame)
Callback, called when CanDevice emits signal frameReceived.
Definition candevicemodel.cpp:34
Definition componentmodel.h:37
Direction
The enum class describing frame direction.
Definition datadirection.h:7