Qt CoAP
受限应用协议(CoAP)是一种机器对机器(M2M)网络传输协议,适用于物联网(IoT)中的受限节点和受限网络。它的设计目的是方便地与 HTTP 接口,以便与网络集成,同时满足一些特殊要求,如支持组播、开销极低以及适用于受限环境的简易性。
Qt CoAP 模块实现了RFC 7252 定义的 CoAP 客户端。一般来说,CoAP 是为使用 UDP 等面向数据报的传输而设计的,因此当前的传输实现是基于 UDP 的。不过,基于 TCP、WebSocket 等的自定义传输也是可以实现的。
Qt CoAP 模块支持
使用模块
使用 Qt 模块需要直接或通过其他依赖关系与模块库链接。有几种构建工具为此提供了专门支持,包括CMake和qmake。
使用 CMake 构建
使用find_package()
命令在Qt6
软件包中找到所需的模块组件:
find_package(Qt6 REQUIRED COMPONENTS Coap) target_link_libraries(mytarget PRIVATE Qt6::Coap)
另请参阅使用 CMake 构建概述。
使用 qmake 构建
要配置使用 qmake 构建的模块,请在项目的 .pro 文件中添加模块作为QT
变量的值:
QT += coap
文章和指南
示例
参考资料
许可证和归属
Qt CoAP 可通过Qt 公司的商业许可证获取。此外,它还受GNU 通用公共许可证第 3 版的保护。
© 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.