CANdevStudio
Development tool for CAN bus simulation
Loading...
Searching...
No Matches
cansignaldecoder_p.h
Go to the documentation of this file.
1#ifndef CANSIGNALDECODER_P_H
2#define CANSIGNALDECODER_P_H
3
4#include "cansignaldecoder.h"
5#include <candbhandler.h>
6#include <memory>
7#include <propertyfields.h>
8
10
11class CanSignalDecoderPrivate : public QObject {
12 Q_OBJECT
13 Q_DECLARE_PUBLIC(CanSignalDecoder)
14
15public:
18 QJsonObject getSettings();
19 void setSettings(const QJsonObject& json);
20 void decodeFrame(const QCanBusFrame& frame, Direction const direction, bool status);
21
22private:
23 void initProps();
24 int64_t rawToSignal(const uint8_t* data, int startBit, int sigSize, bool littleEndian, bool isSigned);
25
26 public : bool _simStarted{ false };
28 std::map<QString, QVariant> _props;
29 CanDbHandler _db{ _props, _dbProperty };
30
31private:
32 CanSignalDecoder* q_ptr;
33 const QString _nameProperty = "name";
34 const QString _dbProperty = "CAN database";
35 std::map<QString, QVariant> _signalCache;
36
37 // workaround for clang 3.5
39
40 // clang-format off
42 std::make_tuple(_nameProperty, QVariant::String, true, cf(nullptr)),
43 std::make_tuple(_dbProperty, QVariant::String, true, cf(std::bind(&CanDbHandler::createPropertyWidget, &_db)))
44 };
45 // clang-format on
46};
47
48#endif // CANSIGNALDECODER_P_H
Context CanSignalDecoderCtx
Definition cansignaldecoder.h:12
Definition candbhandler.h:14
QWidget * createPropertyWidget()
Definition candbhandler.cpp:96
Definition cansignaldecoder.h:16
Definition cansignaldecoder_p.h:11
CanDbHandler _db
Definition cansignaldecoder_p.h:29
CanSignalDecoderCtx _ctx
Definition cansignaldecoder_p.h:27
void setSettings(const QJsonObject &json)
Definition cansignaldecoder_p.cpp:64
bool _simStarted
Definition cansignaldecoder_p.h:26
QJsonObject getSettings()
Definition cansignaldecoder_p.cpp:53
std::map< QString, QVariant > _props
Definition cansignaldecoder_p.h:28
void decodeFrame(const QCanBusFrame &frame, Direction const direction, bool status)
Definition cansignaldecoder_p.cpp:75
ComponentInterface::ComponentProperties getSupportedProperties() const
Definition cansignaldecoder_p.cpp:48
Direction
The enum class describing frame direction.
Definition datadirection.h:7
std::vector< ComponentProperty > ComponentProperties
Definition componentinterface.h:66
std::function< QWidget *(void)> CustomEditFieldCbk
Definition componentinterface.h:64
Definition context.h:13