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 QCANFRAMEPROCESSOR_P_H
5#define QCANFRAMEPROCESSOR_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 "qcanframeprocessor.h"
20#include "qcanmessagedescription.h"
21#include "qcanuniqueiddescription.h"
22
23#include <QtCore/QHash>
24#include <QtCore/QSharedData>
25
26#include <utility>
27
28QT_BEGIN_NAMESPACE
29
30class QCanFrameProcessorPrivate
31{
32public:
33 void resetErrors();
34 void setError(QCanFrameProcessor::Error err, const QString &desc);
35 void addWarning(const QString &warning);
36 QVariant decodeSignal(const QCanBusFrame &frame, const QCanSignalDescription &signalDesc);
37 QVariant parseData(const unsigned char *data, const QCanSignalDescription &signalDesc);
38 void encodeSignal(unsigned char *data, const QVariant &value,
39 const QCanSignalDescription &signalDesc);
40 std::optional<QtCanBus::UniqueId> extractUniqueId(const QCanBusFrame &frame) const;
41 bool fillUniqueId(unsigned char *data, quint16 sizeInBits, QtCanBus::UniqueId uniqueId);
42
43 static QCanFrameProcessorPrivate *get(const QCanFrameProcessor &processor);
44
45 QCanFrameProcessor::Error error = QCanFrameProcessor::Error::None;
46 QString errorString;
47 QStringList warnings;
48 QHash<QtCanBus::UniqueId, QCanMessageDescription> messages;
49 QCanUniqueIdDescription uidDescription;
50};
51
52QT_END_NAMESPACE
53
54#endif // QCANFRAMEPROCESSOR_P_H
55

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