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`를 반환합니다.
© 2026 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.