CANdevStudio
Development tool for CAN bus simulation
Loading...
Searching...
No Matches
canrawfiltermodel.h
Go to the documentation of this file.
1#ifndef CANRAWFILTERMODEL_H
2#define CANRAWFILTERMODEL_H
3
4#include "canrawfilter.h"
5#include "componentmodel.h"
6#include "nodepainter.h"
7#include <QtCore/QObject>
8#include <readerwriterqueue.h>
9
10using QtNodes::NodeData;
11using QtNodes::NodeDataType;
12using QtNodes::PortIndex;
13using QtNodes::PortType;
14
15class QCanBusFrame;
16enum class Direction;
17
18class CanRawFilterModel : public ComponentModel<CanRawFilter, CanRawFilterModel> {
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
30public slots:
31 void filteredTx(const QCanBusFrame& frame);
32 void filteredRx(const QCanBusFrame& frame);
33
34signals:
35 void filterTx(const QCanBusFrame& frame);
36 void filterRx(const QCanBusFrame& frame);
38
39private:
40 std::unique_ptr<NodePainter> _painter;
41 // 127 to use 4 blocks, 512 bytes each
42 moodycamel::ReaderWriterQueue<std::shared_ptr<NodeData>> _fwdQueue{ 127 };
43};
44
45#endif // CANRAWFILTERMODEL_H
Definition canrawfiltermodel.h:18
std::shared_ptr< NodeData > outData(PortIndex port) override
Definition canrawfiltermodel.cpp:59
void filteredTx(const QCanBusFrame &frame)
Definition canrawfiltermodel.cpp:91
void filterRx(const QCanBusFrame &frame)
QtNodes::NodePainterDelegate * painterDelegate() const override
Definition canrawfiltermodel.cpp:39
unsigned int nPorts(PortType portType) const override
Definition canrawfiltermodel.cpp:44
void filterTx(const QCanBusFrame &frame)
void filteredRx(const QCanBusFrame &frame)
Definition canrawfiltermodel.cpp:102
void setInData(std::shared_ptr< NodeData > nodeData, PortIndex port) override
Definition canrawfiltermodel.cpp:72
CanRawFilterModel()
Definition canrawfiltermodel.cpp:25
NodeDataType dataType(PortType portType, PortIndex portIndex) const override
Definition canrawfiltermodel.cpp:49
Definition componentmodel.h:37
Direction
The enum class describing frame direction.
Definition datadirection.h:7