CANdevStudio
Development tool for CAN bus simulation
Loading...
Searching...
No Matches
qmlexecutormodel.h
Go to the documentation of this file.
1#ifndef QMLEXECUTORMODEL_H
2#define QMLEXECUTORMODEL_H
3
4#include <deque>
5
6#include <QtCore/QObject>
7#include <QtSerialBus/QCanBusFrame>
8
9
12#include <qmlexecutor.h>
13#include "componentmodel.h"
14#include "nodepainter.h"
15#include "canbusmodel.hpp"
16
17
18
19using QtNodes::NodeData;
20using QtNodes::NodeDataType;
21using QtNodes::PortIndex;
22using QtNodes::PortType;
23
24enum class Direction;
25
26
31class QMLExecutorModel : public ComponentModel<QMLExecutor, QMLExecutorModel> {
32 Q_OBJECT
33
34public:
39
40public: // ComponentModelInterface
42 unsigned int nPorts(PortType portType) const override;
43
45 NodeDataType dataType(PortType portType, PortIndex portIndex) const override;
46
48 std::shared_ptr<NodeData> outData(PortIndex port) override;
49
51 void setInData(std::shared_ptr<NodeData> nodeData, PortIndex port) override;
52
54 QtNodes::NodePainterDelegate* painterDelegate() const override;
55
56public:
62
63public slots:
67 void sendFrame(const quint32& frameId, const QByteArray& frameData);
68
72 void sendSignal(const QString& name, const QVariant& value);
73
74signals:
78 void frameReceived(const quint32& frameId, const QByteArray& frameData);
79
85 void signalReceived(const QString& name, const QVariant& value);
86
91
96
101
102private:
107 std::shared_ptr<NodeData> getNextQueuedFrame();
108
113 std::shared_ptr<NodeData> getNextQueuedSignal();
114
115private:
117 std::unique_ptr<NodePainter> _painter;
118
120 std::deque<CanRawData> _rawSendQueue;
121
123 std::deque<CanSignalModel> _signalSendQueue;
124
126 std::unique_ptr<CANBusModel> _CANBusModel;
127};
128
129#endif // QMLEXECUTORMODEL_H
The CANBusModel class is used to interface CAN operations with QML stack.
Definition canbusmodel.hpp:11
Definition componentmodel.h:37
virtual QString name() const override
Used to identify model by data model name.
Definition componentmodel.h:115
The QMLExecutorModel A model for QML executor component.
Definition qmlexecutormodel.h:31
void sendFrame(const quint32 &frameId, const QByteArray &frameData)
Definition qmlexecutormodel.cpp:162
void sendSignal(const QString &name, const QVariant &value)
Definition qmlexecutormodel.cpp:174
QMLExecutorModel()
only constructor to satisfy ql
Definition qmlexecutormodel.cpp:35
void simulationStopped()
not used currently
void requestRedraw()
not used currently
std::shared_ptr< NodeData > outData(PortIndex port) override
Definition qmlexecutormodel.cpp:76
NodeDataType dataType(PortType portType, PortIndex portIndex) const override
Definition qmlexecutormodel.cpp:65
void signalReceived(const QString &name, const QVariant &value)
A CAN signal was received.
QtNodes::NodePainterDelegate * painterDelegate() const override
Definition qmlexecutormodel.cpp:55
void simulationStarted()
not used currently
void setInData(std::shared_ptr< NodeData > nodeData, PortIndex port) override
Definition qmlexecutormodel.cpp:123
CANBusModel * getCANBusModel()
testing facility
Definition qmlexecutormodel.cpp:183
unsigned int nPorts(PortType portType) const override
Definition qmlexecutormodel.cpp:60
void frameReceived(const quint32 &frameId, const QByteArray &frameData)
Direction
The enum class describing frame direction.
Definition datadirection.h:7