CANdevStudio
Development tool for CAN bus simulation
Loading...
Searching...
No Matches
candevice.h
Go to the documentation of this file.
1#ifndef __CANDEVICE_H
2#define __CANDEVICE_H
3
4#include <QScopedPointer>
5#include <QWidget>
7#include <context.h>
8
10class QCanBusFrame;
11
15class CanDevice : public QObject, public ComponentInterface {
16 Q_OBJECT
17 Q_DECLARE_PRIVATE(CanDevice)
18
19public:
20 explicit CanDevice();
21 explicit CanDevice(CanDeviceCtx&& ctx);
22 ~CanDevice();
23
31 bool init();
32
36 QWidget* mainWidget() override;
37
41 void setConfig(const QJsonObject& json) override;
42
46 void setConfig(const QWidget& qobject) override;
47
51 QJsonObject getConfig() const override;
52
56 std::shared_ptr<QWidget> getQConfig() const override;
57
61 virtual void configChanged() override;
62
66 bool mainWidgetDocked() const override;
67
72
73
74signals:
75 void frameReceived(const QCanBusFrame& frame);
76 void frameSent(bool status, const QCanBusFrame& frame);
77
81 void mainWidgetDockToggled(QWidget* widget) override;
82 void simBcastSnd(const QJsonObject &msg, const QVariant &param = QVariant()) override;
83
84public slots:
85 void sendFrame(const QCanBusFrame& frame);
86
90 void startSimulation() override;
91
95 void stopSimulation() override;
96
97 void simBcastRcv(const QJsonObject &msg, const QVariant &param) override;
98
99private slots:
100 void errorOccurred(int error);
101 void framesWritten(qint64 cnt);
102 void framesReceived();
103
104private:
105 QScopedPointer<CanDevicePrivate> d_ptr;
106};
107
108#endif /* !__CANDEVICE_H */
The class provides abstraction layer for CAN BUS hardware.
Definition candevice.h:15
bool init()
Configures CAN BUS backend and interface.
Definition candevice.cpp:20
bool mainWidgetDocked() const override
Definition candevice.cpp:200
void simBcastRcv(const QJsonObject &msg, const QVariant &param) override
Definition candevice.cpp:217
~CanDevice()
Definition candevice.cpp:18
void simBcastSnd(const QJsonObject &msg, const QVariant &param=QVariant()) override
virtual void configChanged() override
Definition candevice.cpp:206
void sendFrame(const QCanBusFrame &frame)
Definition candevice.cpp:58
CanDevice()
Definition candevice.cpp:8
void startSimulation() override
Definition candevice.cpp:149
std::shared_ptr< QWidget > getQConfig() const override
Definition candevice.cpp:142
void frameReceived(const QCanBusFrame &frame)
void stopSimulation() override
Definition candevice.cpp:180
QJsonObject getConfig() const override
Definition candevice.cpp:126
QWidget * mainWidget() override
Definition candevice.cpp:194
void setConfig(const QJsonObject &json) override
Definition candevice.cpp:120
void frameSent(bool status, const QCanBusFrame &frame)
ComponentProperties getSupportedProperties() const override
Definition candevice.cpp:75
void mainWidgetDockToggled(QWidget *widget) override
Definition candevice_p.h:13
Interface to be implemented by every component.
Definition componentinterface.h:15
std::vector< ComponentProperty > ComponentProperties
Definition componentinterface.h:66