1 | // Copyright (C) 2018 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | #ifndef QMQTTPUBLISHPROPERTIES_H |
4 | #define QMQTTPUBLISHPROPERTIES_H |
5 | |
6 | #include <QtMqtt/qmqttglobal.h> |
7 | #include <QtMqtt/qmqtttype.h> |
8 | |
9 | #include <QtCore/QObject> |
10 | #include <QtCore/QSharedDataPointer> |
11 | |
12 | QT_BEGIN_NAMESPACE |
13 | |
14 | class QMqttPublishPropertiesData; |
15 | class QMqttMessageStatusPropertiesData; |
16 | |
17 | class Q_MQTT_EXPORT QMqttPublishProperties |
18 | { |
19 | public: |
20 | enum PublishPropertyDetail : quint32 { |
21 | None = 0x00000000, |
22 | PayloadFormatIndicator = 0x00000001, |
23 | MessageExpiryInterval = 0x00000002, |
24 | TopicAlias = 0x00000004, |
25 | ResponseTopic = 0x00000008, |
26 | CorrelationData = 0x00000010, |
27 | UserProperty = 0x00000020, |
28 | SubscriptionIdentifier = 0x00000040, |
29 | ContentType = 0x00000080 |
30 | }; |
31 | Q_DECLARE_FLAGS(PublishPropertyDetails, PublishPropertyDetail) |
32 | |
33 | QMqttPublishProperties(); |
34 | QMqttPublishProperties(const QMqttPublishProperties &); |
35 | QMqttPublishProperties &operator=(const QMqttPublishProperties &); |
36 | ~QMqttPublishProperties(); |
37 | |
38 | PublishPropertyDetails availableProperties() const; |
39 | |
40 | QMqtt::PayloadFormatIndicator payloadFormatIndicator() const; |
41 | void setPayloadFormatIndicator(QMqtt::PayloadFormatIndicator indicator); |
42 | |
43 | quint32 messageExpiryInterval() const; |
44 | void setMessageExpiryInterval(quint32 interval); |
45 | |
46 | quint16 topicAlias() const; |
47 | void setTopicAlias(quint16 alias); |
48 | |
49 | QString responseTopic() const; |
50 | void setResponseTopic(const QString &topic); |
51 | |
52 | QByteArray correlationData() const; |
53 | void setCorrelationData(const QByteArray &correlation); |
54 | |
55 | QMqttUserProperties userProperties() const; |
56 | void setUserProperties(const QMqttUserProperties &properties); |
57 | |
58 | QList<quint32> subscriptionIdentifiers() const; |
59 | void setSubscriptionIdentifiers(const QList<quint32> &ids); |
60 | |
61 | QString contentType() const; |
62 | void setContentType(const QString &type); |
63 | private: |
64 | QSharedDataPointer<QMqttPublishPropertiesData> data; |
65 | }; |
66 | |
67 | Q_DECLARE_OPERATORS_FOR_FLAGS(QMqttPublishProperties::PublishPropertyDetails) |
68 | |
69 | class Q_MQTT_EXPORT QMqttMessageStatusProperties |
70 | { |
71 | public: |
72 | QMqttMessageStatusProperties(); |
73 | QMqttMessageStatusProperties(const QMqttMessageStatusProperties &); |
74 | QMqttMessageStatusProperties &operator=(const QMqttMessageStatusProperties &); |
75 | ~QMqttMessageStatusProperties(); |
76 | |
77 | QMqtt::ReasonCode reasonCode() const; |
78 | QString reason() const; |
79 | QMqttUserProperties userProperties() const; |
80 | |
81 | private: |
82 | friend class QMqttConnection; |
83 | QSharedDataPointer<QMqttMessageStatusPropertiesData> data; |
84 | }; |
85 | |
86 | QT_END_NAMESPACE |
87 | |
88 | #endif // QMQTTPUBLISHPROPERTIES_H |
89 |