QMqttMessage Class
QMqttMessage 클래스는 구독을 기반으로 메시지 브로커로부터 받은 메시지에 대한 정보를 제공합니다. 더 보기...
헤더: | #include <QMqttMessage> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Mqtt) target_link_libraries(mytarget PRIVATE Qt6::Mqtt) |
qmake: | QT += mqtt |
속성
공공 기능
QMqttMessage() | |
QMqttMessage(const QMqttMessage &other) | |
bool | duplicate() const |
quint16 | id() const |
const QByteArray & | payload() const |
QMqttPublishProperties | publishProperties() const |
quint8 | qos() const |
bool | retain() const |
QMqttTopicName | topic() const |
bool | operator!=(const QMqttMessage &other) const |
QMqttMessage & | operator=(const QMqttMessage &other) |
bool | operator==(const QMqttMessage &other) const |
상세 설명
모듈 내부에서 MQTT 메시지를 생성하고 QMqttSubscription::messageReceived() 신호를 통해 반환합니다.
속성 문서
[read-only]
duplicate : const bool
이 속성은 메시지가 중복 메시지인지 여부를 저장합니다.
중복 메시지는 메시지가 이전에 전송되었지만 아직 확인되지 않았음을 나타냅니다. 따라서 브로커는 메시지 자체의 전송을 확인하기 위해 다시 전송해야 한다고 가정합니다. 중복 메시지는 QoS 수준이 1 또는 2인 경우에만 발생할 수 있습니다.
액세스 기능:
bool | duplicate() const |
[read-only]
id : const quint16
이 속성에는 메시지의 ID가 저장됩니다.
ID는 QoS 수준이 0보다 높은 메시지에 사용됩니다.
액세스 기능:
quint16 | id() const |
[read-only]
payload : const QByteArray
이 속성은 메시지의 페이로드를 저장합니다.
액세스 함수:
const QByteArray & | payload() const |
[read-only]
qos : const quint8
이 속성은 메시지의 QoS 수준을 보유합니다.
액세스 함수:
quint8 | qos() const |
[read-only]
retain : const bool
이 속성은 메시지가 보존되었는지 여부를 보유합니다.
보존된 메시지는 향후 클라이언트가 구독할 수 있도록 브로커에 보관됩니다. 따라서 보류된 메시지는 이전에 작성된 것으로 실시간 업데이트가 아닙니다. 브로커는 주제당 하나의 보류된 메시지만 저장할 수 있습니다.
액세스 기능:
bool | retain() const |
[read-only]
topic : const QMqttTopicName
이 속성에는 메시지의 토픽이 저장됩니다.
구독에 와일드카드가 사용된 경우 이 구독과 일치하는 토픽을 설명합니다. 이 속성에는 와일드카드가 포함되지 않습니다.
액세스 함수:
QMqttTopicName | topic() const |
멤버 함수 문서
QMqttMessage::QMqttMessage()
새 MQTT 메시지를 생성합니다.
QMqttMessage::QMqttMessage(const QMqttMessage &other)
other 의 복사본인 새 MQTT 메시지를 작성합니다.
QMqttPublishProperties QMqttMessage::publishProperties() const
메시지의 일부로 받은 게시 속성을 반환합니다.
참고: 이 함수는 게시 메시지가 수신될 때만 속성을 지정합니다. QoS 값이 1 또는 2인 메시지는 메시지가 릴리스될 때 추가 속성을 포함할 수 있습니다. 이러한 속성은 QMqttClient::messageStatusChanged 신호로 얻을 수 있습니다.
참고: 이 함수는 클라이언트가 QMqttClient::MQTT_5_0 을 QMqttClient::ProtocolVersion 으로 지정하는 경우에만 유효한 데이터를 제공합니다.
bool QMqttMessage::operator!=(const QMqttMessage &other) const
메시지와 other 이 같지 않으면 true
을 반환하고, 그렇지 않으면 false
을 반환합니다.
QMqttMessage &QMqttMessage::operator=(const QMqttMessage &other)
이 객체를 other 의 복사본으로 만들고 이 객체의 새 값을 반환합니다.
bool QMqttMessage::operator==(const QMqttMessage &other) const
메시지와 other 이 같으면 true
을 반환하고, 그렇지 않으면 false
을 반환합니다.
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.