1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QCANSIGNALDESCRIPTION_P_H
5#define QCANSIGNALDESCRIPTION_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "private/qtserialbusexports_p.h"
19#include "qcansignaldescription.h"
20
21#include <QtCore/QHash>
22#include <QtCore/QSharedData>
23#include <QtCore/QVariant>
24
25QT_BEGIN_NAMESPACE
26
27class Q_SERIALBUS_PRIVATE_EXPORT QCanSignalDescriptionPrivate : public QSharedData
28{
29public:
30 QString name;
31 QString unit;
32 QString receiver;
33 QString comment;
34 QtCanBus::DataSource source = QtCanBus::DataSource::Payload;
35 QSysInfo::Endian endian = QSysInfo::Endian::BigEndian;
36 QtCanBus::DataFormat format = QtCanBus::DataFormat::SignedInteger;
37 quint16 startBit = 0;
38 quint16 dataLength = 0;
39 // for conversion, possibly unused
40 double factor = qQNaN();
41 double offset = qQNaN();
42 double scaling = qQNaN();
43 // expected range, possibly unused
44 double minimum = qQNaN();
45 double maximum = qQNaN();
46 // multiplexing state
47 QtCanBus::MultiplexState muxState = QtCanBus::MultiplexState::None;
48 // Multiplexed values. The key of the hash represents the multiplex switch
49 // name, and the value represents the valid range(s) of the mux switch
50 // values.
51 QCanSignalDescription::MultiplexSignalValues muxSignals;
52
53 bool muxValueInRange(const QVariant &value,
54 const QCanSignalDescription::MultiplexValues &ranges) const;
55
56 inline bool isShared() const { return ref.loadRelaxed() != 1; }
57 static QCanSignalDescriptionPrivate *get(const QCanSignalDescription &desc);
58};
59
60QT_END_NAMESPACE
61
62#endif // QCANSIGNALDESCRIPTION_P_H
63

source code of qtserialbus/src/serialbus/qcansignaldescription_p.h