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 QCANCOMMONDEFINITIONS_H
5#define QCANCOMMONDEFINITIONS_H
6
7#include <QtCore/qendian.h>
8#include <QtCore/qsysinfo.h>
9#include <QtCore/qtconfigmacros.h>
10#include <QtCore/qtypes.h>
11
12#include <QtSerialBus/qtserialbusglobal.h>
13
14QT_BEGIN_NAMESPACE
15
16namespace QtCanBus {
17
18enum class DataSource : quint8 {
19 Payload = 0,
20 FrameId,
21};
22
23enum class DataFormat : quint8 {
24 SignedInteger = 0,
25 UnsignedInteger,
26 Float,
27 Double,
28 AsciiString,
29};
30
31enum class MultiplexState : quint8 {
32 None = 0x00,
33 MultiplexorSwitch = 0x01,
34 MultiplexedSignal = 0x02,
35 SwitchAndSignal = MultiplexorSwitch | MultiplexedSignal,
36};
37
38enum class UniqueId : quint32 {};
39
40inline UniqueId qbswap(UniqueId src) noexcept
41{
42 return UniqueId{qbswap_helper(source: qToUnderlying(e: src))};
43}
44
45} // namespace QtCanBus
46
47
48#ifndef QT_NO_DEBUG_STREAM
49
50class QDebug;
51
52namespace QtCanBus {
53Q_SERIALBUS_EXPORT QDebug operator<<(QDebug dbg, DataSource source);
54Q_SERIALBUS_EXPORT QDebug operator<<(QDebug dbg, DataFormat format);
55Q_SERIALBUS_EXPORT QDebug operator<<(QDebug dbg, MultiplexState state);
56Q_SERIALBUS_EXPORT QDebug operator<<(QDebug dbg, UniqueId uid);
57} // namespace QtCanBus
58
59#endif // QT_NO_DEBUG_STREAM
60
61QT_END_NAMESPACE
62
63#endif // QCANCOMMONDEFINITIONS_H
64

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