wangzhibo
2026-10-08 220e4fab27b7f419b3e89e2f2d28ae789aac09d7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from pathlib import Path
 
ROOT = Path(__file__).resolve().parents[1]
 
 
def read_text(path: str) -> str:
    return (ROOT / path).read_text(encoding="utf-8")
 
 
def require(condition: bool, message: str) -> None:
    if not condition:
        raise SystemExit(message)
 
 
def main() -> None:
    mqtt = read_text("main/boards/sening-xiaozhi-s3/mqtt.c")
    require(
        'sscanf(value, "%2d:%2d%c", hour, minute, &tail)' in mqtt,
        "MQTT SET_ALARM time must accept HH:MM and default seconds to 00",
    )
    require(
        'strcmp(command->valuestring, "delete") == 0' in mqtt,
        "MQTT SET_ALARM payload.action=delete must delete alarm by id",
    )
    require(
        'BoardMqtt_PublishJson(s_rpt_ack_topic, root, BOARD_MQTT_QOS);' in mqtt,
        "MQTT ACK must use the board default QoS",
    )
    require(
        'BoardMqtt_PublishProgress(req_id, 0, "media playlist accepted");' in mqtt,
        "MQTT PLAY_MEDIA must publish progress when playlist is accepted",
    )
 
 
if __name__ == "__main__":
    main()