How espressif/esp-aliyun works
This is an embedded Alibaba Cloud IoT SDK, presented for ESP devices. Its primary workflow is device Wi-Fi provisioning, device authentication/registration, then a TLS-protected MQTT connection for cloud messaging through the device model. The SDK also includes OTA, HTTP/HTTP2, CoAP/ALCS, gateway, reset, and device-binding capabilities. The README documents the MQTT workflow; source-index references establish some module dependencies, but many runtime call paths are not shown, so those links are omitted or marked unverified.
Main entry points: iotx_mqtt_client.c MQTT client · dm_manager.c Device model · infra Runtime infrastructure · dev_sign_mqtt.c Device signing
Components 23
Device onboarding
- Wi-Fi provisioning
iotkit-embedded/wifi_provision - Connection manager
conn_mgr/conn_mgr.c - Device signing
iotkit-embedded/dev_sign/dev_sign_mqtt.c - Dynamic registration
iotkit-embedded/dynamic_register/dynreg.c - Device binding
iotkit-embedded/dev_bind/impl/awss_bind.c - Device reset
iotkit-embedded/dev_reset/dev_reset.c
Cloud connectivity
- MQTT client
iotkit-embedded/mqtt/iotx_mqtt_client.c - MQTT packets
iotkit-embedded/mqtt/MQTTPacket.c - Cloud CoAP
iotkit-embedded/coap_cloud/iotx_coap_api.c - CoAP server
iotkit-embedded/coap_server/server/CoAPServer.c - HTTP client
iotkit-embedded/http/iotx_http_api.c - HTTP/2 streams
iotkit-embedded/http2/http2_api.c
Device services
- Device model
iotkit-embedded/dev_model/dm_manager.c - Device client
iotkit-embedded/dev_model/dm_client.c - Device shadow
iotkit-embedded/dev_model/dm_shadow.c - Firmware OTA
iotkit-embedded/ota/iotx_ota.c - OTA fetching
iotkit-embedded/ota/ota_fetch.c - Local ALCS
iotkit-embedded/dev_model/alcs_client.c
Shared platform
- Runtime infrastructure
iotkit-embedded/infra - HTTP/2 engine
wrappers/external_libs/nghttp2/nghttp2_session.c - Root certificates
iotkit-embedded/certs/root_ca.c
Other components
- Device owner
- Alibaba IoT Hub
Connections 23
- Device owner → Wi-Fi provisioning: provides network
- Wi-Fi provisioning → Connection manager: enables connectivity
conn_mgr/conn_mgr.c - Connection manager → Device model: starts services
conn_mgr/conn_mgr.c - Device signing → Alibaba IoT Hub: authenticates
- Dynamic registration → Alibaba IoT Hub: registers device
- Device model → Device client: delegates requests
- Device client → MQTT client: sends cloud messages
- MQTT client → MQTT packets: encodes packets
- MQTT client → Alibaba IoT Hub: publishes and subscribes
- Alibaba IoT Hub → MQTT client: delivers messages
- Device model → Device shadow: manages state
- Device model → Firmware OTA: coordinates updates
- Firmware OTA → OTA fetching: fetches firmware
iotkit-embedded/ota/iotx_ota.c - Device binding → Alibaba IoT Hub: binds device
- Device reset → MQTT client: uses messaging
iotkit-embedded/dev_reset/dev_reset.c - Cloud CoAP → Alibaba IoT Hub: communicates by CoAP
- CoAP server → Local ALCS: serves local resources
iotkit-embedded/dev_model/alcs_client.c - HTTP client → Alibaba IoT Hub: sends HTTP requests
- HTTP/2 streams → HTTP/2 engine: uses protocol engine
- Device signing → Runtime infrastructure: uses hashing
iotkit-embedded/dev_sign/dev_sign_mqtt.c - HTTP client → Runtime infrastructure: uses HTTP transport
iotkit-embedded/http/iotx_http_api.c - HTTP/2 streams → Runtime infrastructure: uses transport
iotkit-embedded/http2/http2_api.c - Alibaba IoT Hub → Root certificates: TLS trust anchor