🏠 home › concepts › mqtt-device-protocol
tags
[IoT, MQTT, 协议, 嵌入式]
created
2026-04-12
updated
2026-04-24
sources
[raw/snippets/iot-docs/ref-mqtt.md, raw/snippets/iot-docs/guide-device.md, raw/snippets/iot-docs/architecture.md, raw/snippets/bk7258-build/iot-architecture-onboarding.md]

定义

Sentino IoT 平台中设备与云端的信令通信协议,基于 MQTT 5.0。负责设备认证、绑定、状态上报、指令下发和获取 RTC 参数,不承载音频流。

关键要点

业务链路示例(设备 ↔ 云完整调用链)

三条核心链路展示 MQTT 协议如何穿过 embedded-firmware-layering 业务/适配/SDK 三层:

链路 ①:APP 改音量 → 喇叭变音量(云 → 设备)

APP → HTTP → 云平台 → MQTT publish: {"code":"property_set","value":{"volume_set":7}}
→ rino_iot_sdk/rino_mqtt 解码 → 丢消息队列 → cmd_parse
→ Cmd_Property_Set_Parse_Cb (注入的 callback)
→ rino_interface/rino_mqtt_import_interface.c:161 Rino_Mqtt_Cmd_Property_Set_Parse_Import_Callback(dp)
→ projects/{产品}/main/rino_iot_process.c:262 case DPID_VOLUME_SET: Volume_Set_Abs(7,0); DP_Volume_Set_Report(7);
→ MQTT publish: $thing/.../property_report → 云平台更新 shadow → APP 看到音量已变

链路 ②:开机自动上报状态

rino_mqtt_app.c:108 Rino_Mqtt_Connected_Callback() → Rino_Mqtt_App_Ready_Cb()
→ 适配层启动时注入的 Device_Power_On_Report_Info()
→ DP_Bright_Value_Report(...) / DP_Switch_Status_Report(...)

→ SDK 暴露抽象 hook,业务函数叫什么名字 SDK 不知。

链路 ③:长按按键 → AI 对话启动(设备 → 云)

按键事件 → Rino_Device_Access_Export_Interface() → Mqtt_Event_Agora_Agent_Device_Access_Report(1)
→ rino_iot_sdk/ MQTT publish event payload
→ 云平台调 AI Agent → 申请 Agora RTC token → 应答推回设备
→ rino_mqtt_import_interface.c:95 Rino_Mqtt_Event_Respone_Agora_Agent_Device_Access_Parse_Import_Callback
   ├─ result==0 → set_agora_config(rtcToken, channelName, appId, uid)
   └─ result!=0 → app_event_send_msg(APP_EVT_ASR_WAKEUP_FAIL, 0)
→ app_agora_session_process.c 加入声网频道 → 开音视频对话

→ 完整链路展示了 MQTT 信令通道(agora_agent_device_access event)如何与 agora-rtc-voice 音频通道协作:MQTT 出 RTC 凭证,RTC 出音频流。

相关概念