CANdevStudio
Development tool for CAN bus simulation
Loading...
Searching...
No Matches
cansignalencoder_p.h
Go to the documentation of this file.
1#ifndef CANSIGNALENCODER_P_H
2#define CANSIGNALENCODER_P_H
3
4#include "cansignalencoder.h"
5#include <QUuid>
6#include <candbhandler.h>
7#include <memory>
8#include <propertyfields.h>
9#include <QTimer>
10
12
13class CanSignalEncoderPrivate : public QObject {
14 Q_OBJECT
15 Q_DECLARE_PUBLIC(CanSignalEncoder)
16
17public:
20 QJsonObject getSettings();
21 void setSettings(const QJsonObject& json);
22 void encodeSignal(const QString& name, const QVariant& val);
23
24private:
25 void initProps();
26 void signalToRaw(const uint32_t id, const CANsignal& sigDesc, const QVariant& sigVal, const uint32_t updateCycle);
27
28public:
29 bool _simStarted{ false };
31 std::map<QString, QVariant> _props;
32 CanDbHandler _db{ _props, _dbProperty };
33 std::vector<std::unique_ptr<QTimer>> _cycleTimers;
34
35public slots:
36 void initCacheAndTimers();
37
38private:
39 CanSignalEncoder* q_ptr;
40 const QString _nameProperty = "name";
41 const QString _dbProperty = "CAN database";
42 std::map<uint32_t, QByteArray> _rawCache;
43
44 // workaround for clang 3.5
46
47 // clang-format off
49 std::make_tuple(_nameProperty, QVariant::String, true, cf(nullptr)),
50 std::make_tuple(_dbProperty, QVariant::String, true, cf(std::bind(&CanDbHandler::createPropertyWidget, &_db)))
51 };
52 // clang-format on
53};
54
55#endif // CANSIGNALENCODER_P_H
Context CanSignalEncoderCtx
Definition cansignalencoder.h:14
Definition candbhandler.h:14
QWidget * createPropertyWidget()
Definition candbhandler.cpp:96
Definition cansignalencoder.h:16
Definition cansignalencoder_p.h:13
std::map< QString, QVariant > _props
Definition cansignalencoder_p.h:31
void setSettings(const QJsonObject &json)
Definition cansignalencoder_p.cpp:63
void initCacheAndTimers()
Definition cansignalencoder_p.cpp:204
bool _simStarted
Definition cansignalencoder_p.h:29
CanSignalEncoderCtx _ctx
Definition cansignalencoder_p.h:30
std::vector< std::unique_ptr< QTimer > > _cycleTimers
Definition cansignalencoder_p.h:33
QJsonObject getSettings()
Definition cansignalencoder_p.cpp:52
void encodeSignal(const QString &name, const QVariant &val)
Definition cansignalencoder_p.cpp:74
CanDbHandler _db
Definition cansignalencoder_p.h:32
ComponentInterface::ComponentProperties getSupportedProperties() const
Definition cansignalencoder_p.cpp:47
std::vector< ComponentProperty > ComponentProperties
Definition componentinterface.h:66
std::function< QWidget *(void)> CustomEditFieldCbk
Definition componentinterface.h:64
Definition context.h:13