From 4d7436f861fd47da2b3d0220ebdfb42da030ea19 Mon Sep 17 00:00:00 2001 From: Linda Date: Fri, 20 Sep 2024 12:17:36 +0800 Subject: [PATCH] docs: update application examples for modbus.rst, mqtt.rst and lwip.rst --- docs/en/api-guides/lwip.rst | 27 ++++++++++++------- docs/en/api-reference/network/esp_netif.rst | 15 +++++------ docs/en/api-reference/protocols/icmp_echo.rst | 6 ++--- docs/en/api-reference/protocols/modbus.rst | 17 ++++++------ docs/en/api-reference/protocols/mqtt.rst | 27 ++++++++++++------- docs/zh_CN/api-guides/lwip.rst | 23 ++++++++++------ .../zh_CN/api-reference/network/esp_netif.rst | 14 +++++----- .../api-reference/protocols/icmp_echo.rst | 2 +- docs/zh_CN/api-reference/protocols/modbus.rst | 11 +++++--- docs/zh_CN/api-reference/protocols/mqtt.rst | 25 +++++++++++------ 10 files changed, 101 insertions(+), 66 deletions(-) diff --git a/docs/en/api-guides/lwip.rst b/docs/en/api-guides/lwip.rst index 462ded4e9e..1920e2b03a 100644 --- a/docs/en/api-guides/lwip.rst +++ b/docs/en/api-guides/lwip.rst @@ -31,9 +31,9 @@ Some common lwIP app APIs are supported indirectly by ESP-IDF: DNS server configuration in lwIP is global, not interface-specific. If you are using multiple network interfaces with distinct DNS servers, exercise caution to prevent inadvertent overwrites of one interface's DNS settings when acquiring a DHCP lease from another interface. -- Simple Network Time Protocol (SNTP) is also supported via the :doc:`/api-reference/network/esp_netif`, or directly via the :component_file:`lwip/include/apps/esp_sntp.h` functions, which also provide thread-safe API to :component_file:`lwip/lwip/src/include/lwip/apps/sntp.h` functions, see also :ref:`system-time-sntp-sync`. +- Simple Network Time Protocol (SNTP) is also supported via the :doc:`/api-reference/network/esp_netif`, or directly via the :component_file:`lwip/include/apps/esp_sntp.h` functions, which also provide thread-safe API to :component_file:`lwip/lwip/src/include/lwip/apps/sntp.h` functions, see also :ref:`system-time-sntp-sync`. For implementation details, see :example:`protocols/sntp`. This example demonstrates how to use the LwIP SNTP module to obtain time from internet servers, configure the synchronization method and interval, and retrieve time using the SNTP-over-DHCP module. - ICMP Ping is supported using a variation on the lwIP ping API, see :doc:`/api-reference/protocols/icmp_echo`. -- ICMPv6 Ping, supported by lwIP's ICMPv6 Echo API, is used to test IPv6 network connectivity. For more information, see :example:`protocols/sockets/icmpv6_ping`. +- ICMPv6 Ping, supported by lwIP's ICMPv6 Echo API, is used to test IPv6 network connectivity. For more information, see :example:`protocols/sockets/icmpv6_ping`. This example demonstrates how to use the network interface to discover an IPv6 address, create a raw ICMPv6 socket, send an ICMPv6 Echo Request to a destination IPv6 address, and wait for an Echo Reply from the target. - NetBIOS lookup is available using the standard lwIP API. :example:`protocols/http_server/restful_server` has the option to demonstrate using NetBIOS to look up a host on the LAN. - mDNS uses a different implementation to the lwIP default mDNS, see :doc:`/api-reference/protocols/mdns`. But lwIP can look up mDNS hosts using standard APIs such as ``gethostbyname()`` and the convention ``hostname.local``, provided the :ref:`CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES` setting is enabled. - The PPP implementation in lwIP can be used to create PPPoS (PPP over serial) interface in ESP-IDF. Please refer to the documentation of the :doc:`/api-reference/network/esp_netif` component to create and configure a PPP network interface, by means of the ``ESP_NETIF_DEFAULT_PPP()`` macro defined in :component_file:`esp_netif/include/esp_netif_defaults.h`. Additional runtime settings are provided via :component_file:`esp_netif/include/esp_netif_ppp.h`. PPPoS interfaces are typically used to interact with NBIoT/GSM/LTE modems. More application-level friendly API is supported by the `esp_modem `_ library, which uses this PPP lwIP module behind the scenes. @@ -53,17 +53,24 @@ A wide range of BSD Sockets reference materials are available, including: - `Single UNIX Specification - BSD Sockets page `_ - `Berkeley Sockets - Wikipedia page `_ -Examples -^^^^^^^^ +Application Examples +^^^^^^^^^^^^^^^^^^^^ A number of ESP-IDF examples show how to use the BSD Sockets APIs: -- :example:`protocols/sockets/tcp_server` -- :example:`protocols/sockets/tcp_client` -- :example:`protocols/sockets/udp_server` -- :example:`protocols/sockets/udp_client` -- :example:`protocols/sockets/udp_multicast` -- :example:`protocols/http_request`: this simplified example uses a TCP socket to send an HTTP request, but :doc:`/api-reference/protocols/esp_http_client` is a much better option for sending HTTP requests +- :example:`protocols/sockets/non_blocking` demonstrates how to configure and run a non-blocking TCP client and server, supporting both IPv4 and IPv6 protocols. + +- :example:`protocols/sockets/tcp_server` demonstrates how to create a TCP server that accepts client connection requests and receives data. + +- :example:`protocols/sockets/tcp_client` demonstrates how to create a TCP client that connects to a server using a predefined IP address and port. + +- :example:`protocols/sockets/tcp_client_multi_net` demonstrates how to use Ethernet and Wi-Fi interfaces together, connect to both simultaneously, create a TCP client for each interface, and send a basic HTTP request and response. + +- :example:`protocols/sockets/udp_server` demonstrates how to create a UDP server that receives client connection requests and data. + +- :example:`protocols/sockets/udp_client` demonstrates how to create a UDP client that connects to a server using a predefined IP address and port. + +- :example:`protocols/sockets/udp_multicast` demonstrates how to use the IPV4 and IPV6 UDP multicast features via the BSD-style sockets interface. Supported Functions ^^^^^^^^^^^^^^^^^^^ diff --git a/docs/en/api-reference/network/esp_netif.rst b/docs/en/api-reference/network/esp_netif.rst index 70faff41a1..e9ffb448be 100644 --- a/docs/en/api-reference/network/esp_netif.rst +++ b/docs/en/api-reference/network/esp_netif.rst @@ -82,20 +82,19 @@ Common Network Interfaces As the initialization of network interfaces could be quite complex, ESP-NETIF provides some convenient methods of creating the most common ones, such as Wi-Fi and Ethernet. -Please refer to the following example to understand the initialization process of the default interface: +Please refer to the following examples to understand the initialization process of the default interface: +.. list:: -.. only:: SOC_WIFI_SUPPORTED + :SOC_WIFI_SUPPORTED: - :example:`wifi/getting_started/station` demonstrates how to use the station functionality to connect {IDF_TARGET_NAME} to an AP. - - Wi-Fi Station: :example_file:`wifi/getting_started/station/main/station_example_main.c` + :CONFIG_ESP_WIFI_SOFTAP_SUPPORT: - :example:`wifi/getting_started/softAP` demonstrates how to use the SoftAP functionality to configure {IDF_TARGET_NAME} as an AP. -- Ethernet: :example_file:`ethernet/basic/main/ethernet_example_main.c` + - :example:`ethernet/basic` demonstrates how to use the Ethernet driver, attach it to `esp_netif`, and obtain an IP address that can be pinged. -- L2 TAP: :example_file:`protocols/l2tap/main/l2tap_main.c` + - :example:`protocols/l2tap` demonstrates how to use the ESP-NETIF L2 TAP interface to access the Data Link Layer for receiving and transmitting frames, implement non-IP protocols, and echo Ethernet frames with specific EthTypes. -.. only:: CONFIG_ESP_WIFI_SOFTAP_SUPPORT - - - Wi-Fi Access Point: :example_file:`wifi/getting_started/softAP/main/softap_example_main.c` + - :example:`protocols/static_ip` demonstrates how to configure Wi-Fi as a station, including setting up a static IP, netmask, gateway and DNS server. .. only:: SOC_WIFI_SUPPORTED diff --git a/docs/en/api-reference/protocols/icmp_echo.rst b/docs/en/api-reference/protocols/icmp_echo.rst index 929211088b..5aa1451133 100644 --- a/docs/en/api-reference/protocols/icmp_echo.rst +++ b/docs/en/api-reference/protocols/icmp_echo.rst @@ -109,10 +109,10 @@ Get Runtime Statistics As the example code above, you can call ``esp_ping_get_profile`` to get different runtime statistics of ping session in the callback function. -Application Example -------------------- +Application Examples +-------------------- -ICMP echo example: :example:`protocols/icmp_echo` +- :example:`protocols/icmp_echo` demonstrates how to implement a simple ping command line utility to test if a remote host is reachable on the IP network, using ICMP echo request packets. API Reference ------------- diff --git a/docs/en/api-reference/protocols/modbus.rst b/docs/en/api-reference/protocols/modbus.rst index c74978e2f2..529f3c8b41 100644 --- a/docs/en/api-reference/protocols/modbus.rst +++ b/docs/en/api-reference/protocols/modbus.rst @@ -14,15 +14,18 @@ The documentation can be found through the link below: * `ESP-Modbus documentation (English) `__ -Application Example -------------------- +Application Examples +-------------------- The examples below demonstrate the ESP-Modbus library of serial and TCP ports for both slave and master implementations respectively. -- :example:`protocols/modbus/serial/mb_slave` -- :example:`protocols/modbus/serial/mb_master` -- :example:`protocols/modbus/tcp/mb_tcp_slave` -- :example:`protocols/modbus/tcp/mb_tcp_master` +- :example:`protocols/modbus/serial/mb_slave` demonstrates how to use {IDF_TARGET_NAME} as a Modbus serial slave device with the esp-modbus stack, enabling an external Modbus host to read and write device parameters using the Modbus protocol. + +- :example:`protocols/modbus/serial/mb_master` demonstrates how to use the esp-modbus stack port on {IDF_TARGET_NAME} as a Modbus serial master device, capable of reading and writing values from slave devices in a Modbus segment. + +- :example:`protocols/modbus/tcp/mb_tcp_slave` demonstrates the esp-modbus TCP slave stack port, allowing an external Modbus host to read and write device parameters via the Modbus protocol. + +- :example:`protocols/modbus/tcp/mb_tcp_master` demonstrates how to use the esp-modbus stack port on {IDF_TARGET_NAME} as a Modbus TCP master device, capable of reading and writing values from slave devices in a Modbus network. Please refer to the ``README.md`` documents of each specific example for details. @@ -30,5 +33,3 @@ Protocol References ------------------- - For the detailed protocol specifications, see `The Modbus Organization `_. - - diff --git a/docs/en/api-reference/protocols/mqtt.rst b/docs/en/api-reference/protocols/mqtt.rst index 7c5899de56..b408c3bc2d 100644 --- a/docs/en/api-reference/protocols/mqtt.rst +++ b/docs/en/api-reference/protocols/mqtt.rst @@ -19,16 +19,25 @@ Features Application Examples ---------------------- +-------------------- - * :example:`protocols/mqtt/tcp`: MQTT over TCP, default port 1883 - * :example:`protocols/mqtt/ssl`: MQTT over TLS, default port 8883 - * :example:`protocols/mqtt/ssl_ds`: MQTT over TLS using digital signature peripheral for authentication, default port 8883 - * :example:`protocols/mqtt/ssl_mutual_auth`: MQTT over TLS using certificates for authentication, default port 8883 - * :example:`protocols/mqtt/ssl_psk`: MQTT over TLS using pre-shared keys for authentication, default port 8883 - * :example:`protocols/mqtt/ws`: MQTT over WebSocket, default port 80 - * :example:`protocols/mqtt/wss`: MQTT over WebSocket Secure, default port 443 - * :example:`protocols/mqtt5`: Uses ESP-MQTT library to connect to broker with MQTT v5.0 + - :example:`protocols/mqtt/tcp` demonstrates how to implement MQTT communication over TCP (default port 1883). + + - :example:`protocols/mqtt/ssl` demonstrates how to use SSL transport to implement MQTT communication over TLS (default port 8883). + + - :example:`protocols/mqtt/ssl_ds` demonstrates how to use digital signature peripheral for authentication to implement MQTT communication over TLS (default port 8883). + + - :example:`protocols/mqtt/ssl_mutual_auth` demonstrates how to use certificates for authentication to implement MQTT communication (default port 8883). + + - :example:`protocols/mqtt/ssl_psk` demonstrates how to use pre-shared keys for authentication to implement MQTT communication over TLS (default port 8883). + + - :example:`protocols/mqtt/ws` demonstrates how to implement MQTT communication over WebSocket (default port 80). + + - :example:`protocols/mqtt/wss` demonstrates how to implement MQTT communication over WebSocket Secure (default port 443). + + - :example:`protocols/mqtt5` demonstrates how to use ESP-MQTT library to connect to broker with MQTT v5.0. + + - :example:`protocols/mqtt/custom_outbox` demonstrates how to customize the outbox in the ESP-MQTT library. MQTT Message Retransmission --------------------------- diff --git a/docs/zh_CN/api-guides/lwip.rst b/docs/zh_CN/api-guides/lwip.rst index 34e8b485fe..4ebc597553 100644 --- a/docs/zh_CN/api-guides/lwip.rst +++ b/docs/zh_CN/api-guides/lwip.rst @@ -31,9 +31,9 @@ ESP-IDF 间接支持以下常见的 lwIP 应用程序 API: lwIP 中的 DNS 服务器配置为全局配置,而非针对特定接口的配置。如需同时使用不同 DNS 服务器的多个网络接口,在从一个接口获取 DHCP 租约时,请注意避免意外覆盖另一个接口的 DNS 设置。 -- 简单网络时间协议 (SNTP),由 :doc:`/api-reference/network/esp_netif` 功能间接支持,或通过 :component_file:`lwip/include/apps/esp_sntp.h` 中的函数直接支持。该函数还为 :component_file:`lwip/lwip/src/include/lwip/apps/sntp.h` 函数提供了线程安全的 API,请参阅 :ref:`system-time-sntp-sync`。 +- 简单网络时间协议 (SNTP),由 :doc:`/api-reference/network/esp_netif` 功能间接支持,或通过 :component_file:`lwip/include/apps/esp_sntp.h` 中的函数直接支持。该函数还为 :component_file:`lwip/lwip/src/include/lwip/apps/sntp.h` 函数提供了线程安全的 API,请参阅 :ref:`system-time-sntp-sync`。有关详细信息,请见 :example:`protocols/sntp`。该示例演示了如何使用 LwIP SNTP 模块从互联网服务器获取时间、配置同步方法与时间间隔,并使用 SNTP-over-DHCP 模块检索时间。 - ICMP Ping,由 lwIP ping API 的变体支持,请参阅 :doc:`/api-reference/protocols/icmp_echo`。 -- ICMPv6 Ping,由 lwIP 的 ICMPv6 Echo API 支持,用于测试 IPv6 网络连接情况。有关详细信息,请参阅 :example:`protocols/sockets/icmpv6_ping`。 +- ICMPv6 Ping,由 lwIP 的 ICMPv6 Echo API 支持,用于测试 IPv6 网络连接情况。有关详细信息,请参阅 :example:`protocols/sockets/icmpv6_ping`。该示例演示了如何使用网络接口发现 IPv6 地址,创建原始 ICMPv6 套接字,向目标 IPv6 地址发送 ICMPv6 Echo 请求,并等待目标返回 Echo 回复。 - NetBIOS 查找,由标准的 lwIP API 支持,:example:`protocols/http_server/restful_server` 示例中提供了使用 NetBIOS 在局域网中查找主机的选项。 - mDNS 与 lwIP 的默认 mDNS 使用不同实现方式,请参阅 :doc:`/api-reference/protocols/mdns`。但启用 :ref:`CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES` 设置项后,lwIP 可以使用 ``gethostbyname()`` 等标准 API 和 ``hostname.local`` 约定查找 mDNS 主机。 - lwIP 中的 PPP 实现可用于在 ESP-IDF 中创建 PPPoS(串行 PPP)接口。请参阅 :doc:`/api-reference/network/esp_netif` 组件文档,使用 :component_file:`esp_netif/include/esp_netif_defaults.h` 中定义的 ``ESP_NETIF_DEFAULT_PPP()`` 宏创建并配置 PPP 网络接口。:component_file:`esp_netif/include/esp_netif_ppp.h` 中提供了其他的运行时设置。PPPoS 接口通常用于与 NBIoT/GSM/LTE 调制解调器交互。`esp_modem `_ 仓库还支持更多应用层友好的 API,该仓库内部使用了上述 PPP lwIP 模块。 @@ -58,12 +58,19 @@ BSD 套接字的相关参考资料十分丰富,包括但不限于: 以下为 ESP-IDF 中使用 BSD 套接字 API 的部分示例: -- :example:`protocols/sockets/tcp_server` -- :example:`protocols/sockets/tcp_client` -- :example:`protocols/sockets/udp_server` -- :example:`protocols/sockets/udp_client` -- :example:`protocols/sockets/udp_multicast` -- :example:`protocols/http_request`:此简化示例使用 TCP 套接字发送 HTTP 请求,但更推荐使用 :doc:`/api-reference/protocols/esp_http_client` 发送 HTTP 请求 +- :example:`protocols/sockets/non_blocking` 演示了如何配置和运行一个支持 IPv4 和 IPv6 协议的非阻塞 TCP 客户端和服务器。 + +- :example:`protocols/sockets/tcp_server` 演示了如何创建一个 TCP 服务器,该服务器可以接受客户端的连接请求并接收数据。 + +- :example:`protocols/sockets/tcp_client` 演示了如何创建一个 TCP 客户端,该客户端使用预定义的 IP 地址和端口连接到服务器。 + +- :example:`protocols/sockets/tcp_client_multi_net` 演示了如何同时使用以太网和 Wi-Fi 接口连接,在每个接口上创建一个 TCP 客户端,并发送一个简单的 HTTP 请求和响应。 + +- :example:`protocols/sockets/udp_server` 演示了如何创建一个 UDP 服务器,该服务器可以接收客户端的连接请求和数据。 + +- :example:`protocols/sockets/udp_client` 演示了如何创建一个 UDP 客户端,该客户端使用预定义的 IP 地址和端口连接到服务器。 + +- :example:`protocols/sockets/udp_multicast` 演示了如何通过 BSD 风格的套接字接口使用 IPV4 和 IPV6 的 UDP 组播功能。 支持的函数 ^^^^^^^^^^^^^^^^^^^ diff --git a/docs/zh_CN/api-reference/network/esp_netif.rst b/docs/zh_CN/api-reference/network/esp_netif.rst index 00c0d6fe75..596ecdf4f1 100644 --- a/docs/zh_CN/api-reference/network/esp_netif.rst +++ b/docs/zh_CN/api-reference/network/esp_netif.rst @@ -82,20 +82,20 @@ ESP-NETIF 组件使用了系统事件,典型的网络启动代码如下所示 初始化网络接口可能有些复杂,ESP-NETIF 提供了一些创建常见接口(例如 Wi-Fi 和以太网)的快捷方式。 -以下示例展示了默认接口的初始化过程: +请参考以下示例来了解如何初始化默认接口: -.. only:: SOC_WIFI_SUPPORTED +.. list:: - - Wi-Fi 站点::example_file:`wifi/getting_started/station/main/station_example_main.c` + :SOC_WIFI_SUPPORTED: - :example:`wifi/getting_started/station` 演示了如何使用 station 功能将 {IDF_TARGET_NAME} 连接到 AP。 -- 以太网::example_file:`ethernet/basic/main/ethernet_example_main.c` + :CONFIG_ESP_WIFI_SOFTAP_SUPPORT: - :example:`wifi/getting_started/softAP` 演示了如何使用 SoftAP 功能将 {IDF_TARGET_NAME} 配置为 AP。 -- L2 TAP: :example_file:`protocols/l2tap/main/l2tap_main.c` + - :example:`ethernet/basic` 演示了如何使用以太网驱动程序,将其添加到 `esp_netif`,并获取一个可 ping 的 IP 地址。 -.. only:: CONFIG_ESP_WIFI_SOFTAP_SUPPORT + - :example:`protocols/l2tap` 演示了如何使用 ESP-NETIF L2 TAP 接口访问数据链路层,以接收和传输帧,实现非 IP 协议,并使用特定的 EthTypes 回显以太网帧。 - - Wi-Fi 接入点::example_file:`wifi/getting_started/softAP/main/softap_example_main.c` + - :example:`protocols/static_ip` 演示了如何将 Wi-Fi 配置为 station,包括设置静态 IP、子网掩码、网关和 DNS 服务器。 .. only:: SOC_WIFI_SUPPORTED diff --git a/docs/zh_CN/api-reference/protocols/icmp_echo.rst b/docs/zh_CN/api-reference/protocols/icmp_echo.rst index 87dea76943..38bb987ac0 100644 --- a/docs/zh_CN/api-reference/protocols/icmp_echo.rst +++ b/docs/zh_CN/api-reference/protocols/icmp_echo.rst @@ -112,7 +112,7 @@ IoT 设备通常需要检查远程服务器是否可用。如果服务器离线 应用示例 ---------- -ICMP echo 示例: :example:`protocols/icmp_echo` +- :example:`protocols/icmp_echo` 演示了如何实现一个简单的 ping 命令行工具,使用 ICMP 回显请求数据包测试远程主机在 IP 网络上的可达性。 API 参考 -------------- diff --git a/docs/zh_CN/api-reference/protocols/modbus.rst b/docs/zh_CN/api-reference/protocols/modbus.rst index 3d88cbcfba..11234ae484 100644 --- a/docs/zh_CN/api-reference/protocols/modbus.rst +++ b/docs/zh_CN/api-reference/protocols/modbus.rst @@ -19,10 +19,13 @@ ESP-Modbus 以下示例分别介绍了 ESP-Modbus 库的串行端口、TCP 端口的从机和主机实现。 -- :example:`protocols/modbus/serial/mb_slave` -- :example:`protocols/modbus/serial/mb_master` -- :example:`protocols/modbus/tcp/mb_tcp_slave` -- :example:`protocols/modbus/tcp/mb_tcp_master` +- :example:`protocols/modbus/serial/mb_slave` 演示了如何使用 {IDF_TARGET_NAME} 作为 Modbus 串行从设备,通过 esp-modbus 栈,使外部 Modbus 主机能够使用 Modbus 协议读取和写入设备参数。 + +- :example:`protocols/modbus/serial/mb_master` 演示了如何在 {IDF_TARGET_NAME} 上使用 esp-modbus 栈端口作为 Modbus 串行主设备,读取和写入 Modbus 网络中从设备的值。 + +- :example:`protocols/modbus/tcp/mb_tcp_slave` 演示了 esp-modbus TCP 从设备栈端口,允许外部 Modbus 主机通过 Modbus 协议读取和写入设备参数。 + +- :example:`protocols/modbus/tcp/mb_tcp_master` 演示了如何在 {IDF_TARGET_NAME} 上使用 esp-modbus 栈端口作为 Modbus TCP 主设备,读取和写入 Modbus 网络中从设备的值。 详情请参阅具体示例的 ``README.md`` 。 diff --git a/docs/zh_CN/api-reference/protocols/mqtt.rst b/docs/zh_CN/api-reference/protocols/mqtt.rst index 9365dfe850..7ad56ec21e 100644 --- a/docs/zh_CN/api-reference/protocols/mqtt.rst +++ b/docs/zh_CN/api-reference/protocols/mqtt.rst @@ -21,14 +21,23 @@ ESP-MQTT 是 `MQTT `__ 协议客户端的实现,MQTT 是一 应用示例 ------------------- - * :example:`protocols/mqtt/tcp`:基于 TCP 的 MQTT,默认端口 1883 - * :example:`protocols/mqtt/ssl`:基于 TLS 的 MQTT,默认端口 8883 - * :example:`protocols/mqtt/ssl_ds`:基于 TLS 的 MQTT,使用数字签名外设进行身份验证,默认端口 8883 - * :example:`protocols/mqtt/ssl_mutual_auth`:基于 TLS 的 MQTT,使用证书进行身份验证,默认端口 8883 - * :example:`protocols/mqtt/ssl_psk`:基于 TLS 的 MQTT,使用预共享密钥进行身份验证,默认端口 8883 - * :example:`protocols/mqtt/ws`:基于 WebSocket 的 MQTT,默认端口 80 - * :example:`protocols/mqtt/wss`:基于 WebSocket Secure 的 MQTT,默认端口 443 - * :example:`protocols/mqtt5`: 使用 ESP-MQTT 库连接 MQTT v5.0 的服务器 + - :example:`protocols/mqtt/tcp` 演示了如何通过 TCP 实现 MQTT 通信(默认端口 1883)。 + + - :example:`protocols/mqtt/ssl` 演示了如何使用 SSL 传输来实现基于 TLS 的 MQTT 通信(默认端口 8883)。 + + - :example:`protocols/mqtt/ssl_ds` 演示了如何使用数字签名外设进行身份验证,以实现基于 TLS 的 MQTT 通信(默认端口 8883)。 + + - :example:`protocols/mqtt/ssl_mutual_auth` 演示了如何使用证书进行身份验证实现 MQTT 通信(默认端口 8883)。 + + - :example:`protocols/mqtt/ssl_psk` 演示了如何使用预共享密钥进行身份验证,以实现基于 TLS 的 MQTT 通信(默认端口 8883)。 + + - :example:`protocols/mqtt/ws` 演示了如何通过 WebSocket 实现 MQTT 通信(默认端口 80)。 + + - :example:`protocols/mqtt/wss` 演示了如何通过 WebSocket Secure 实现 MQTT 通信(默认端口 443)。 + + - :example:`protocols/mqtt5` 演示了如何使用 ESP-MQTT 库通过 MQTT v5.0 连接到代理。 + + - :example:`protocols/mqtt/custom_outbox` 演示了如何自定义 ESP-MQTT 库中的 outbox。 MQTT 消息重传 --------------------------