CANdevStudio
Development tool for CAN bus simulation
Loading...
Searching...
No Matches
cansignaldecodermodel.h
Go to the documentation of this file.
1#ifndef CANSIGNALDECODERMODEL_H
2#define CANSIGNALDECODERMODEL_H
3
4#include "componentmodel.h"
5#include "nodepainter.h"
6#include <QtCore/QObject>
7#include <cansignaldecoder.h>
8#include <candbpainter.h>
9#include <readerwriterqueue.h>
10
11using QtNodes::NodeData;
12using QtNodes::NodeDataType;
13using QtNodes::PortIndex;
14using QtNodes::PortType;
15
16enum class Direction;
17class QCanBusFrame;
18
19class CanSignalDecoderModel : public ComponentModel<CanSignalDecoder, CanSignalDecoderModel> {
20 Q_OBJECT
21
22public:
24
25 unsigned int nPorts(PortType portType) const override;
26 NodeDataType dataType(PortType portType, PortIndex portIndex) const override;
27 std::shared_ptr<NodeData> outData(PortIndex port) override;
28 void setInData(std::shared_ptr<NodeData> nodeData, PortIndex port) override;
29 QtNodes::NodePainterDelegate* painterDelegate() const override;
30
31public slots:
32 void rcvSignal(const QString& name, const QVariant& val, const Direction& dir);
33
34signals:
36 void sndFrame(const QCanBusFrame& frame, Direction const direction, bool status);
37
38private:
39 std::unique_ptr<CanDbPainter> _painter;
40 // 127 to use 4 blocks, 512 bytes each
41 moodycamel::ReaderWriterQueue<std::shared_ptr<NodeData>> _rxQueue{ 127 };
42};
43
44#endif // CANSIGNALDECODERMODEL_H
Definition cansignaldecodermodel.h:19
unsigned int nPorts(PortType portType) const override
Definition cansignaldecodermodel.cpp:44
QtNodes::NodePainterDelegate * painterDelegate() const override
Definition cansignaldecodermodel.cpp:39
void setInData(std::shared_ptr< NodeData > nodeData, PortIndex port) override
Definition cansignaldecodermodel.cpp:72
std::shared_ptr< NodeData > outData(PortIndex port) override
Definition cansignaldecodermodel.cpp:59
CanSignalDecoderModel()
Definition cansignaldecodermodel.cpp:26
NodeDataType dataType(PortType portType, PortIndex portIndex) const override
Definition cansignaldecodermodel.cpp:49
void rcvSignal(const QString &name, const QVariant &val, const Direction &dir)
Definition cansignaldecodermodel.cpp:83
void sndFrame(const QCanBusFrame &frame, Direction const direction, bool status)
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