167 lines
3.1 KiB
JSON
167 lines
3.1 KiB
JSON
|
登入界面JSON格式
|
|||
|
|
|||
|
(Web → 单片机)
|
|||
|
|
|||
|
{
|
|||
|
"command": "login",
|
|||
|
"parameters": {
|
|||
|
"username": "string",
|
|||
|
"password": "string"
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
(单片机 → Web)
|
|||
|
|
|||
|
{
|
|||
|
"command": "login_response",
|
|||
|
"parameters": {
|
|||
|
"status": 0, // 0: 成功, 1: 失败
|
|||
|
"message": "Login successful" // 成功或失败的提示信息
|
|||
|
}
|
|||
|
}
|
|||
|
(修改密码)
|
|||
|
(Web → 单片机)
|
|||
|
{
|
|||
|
"JSON_id": 2,
|
|||
|
"command": "change_password",
|
|||
|
"parameters": {
|
|||
|
"old_password": "",
|
|||
|
"new_password": ""
|
|||
|
}
|
|||
|
}
|
|||
|
(单片机 → Web)
|
|||
|
|
|||
|
{
|
|||
|
"command": "change_password_response",
|
|||
|
"parameters": {
|
|||
|
"status": 0, // 0: 成功, 1: 失败
|
|||
|
"message": "Psword changed successfully"
|
|||
|
}
|
|||
|
}
|
|||
|
时间设置JSON格式
|
|||
|
|
|||
|
(Web → 单片机)
|
|||
|
|
|||
|
{
|
|||
|
"command": "set_time",
|
|||
|
"parameters": {
|
|||
|
"timestamp": "2025-01-13T12:00:00Z"
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
(单片机 → Web)
|
|||
|
|
|||
|
{
|
|||
|
"command": "set_time_response",
|
|||
|
"parameters": {
|
|||
|
"status": 0, // 0: 成功, 1: 失败
|
|||
|
"message": "Time set successfully"
|
|||
|
}
|
|||
|
}
|
|||
|
模式设置
|
|||
|
(Web
|
|||
|
|
|||
|
{
|
|||
|
"command": "set_mode",
|
|||
|
"parameters": {
|
|||
|
"mode": 0, // 智能模式
|
|||
|
"data": {
|
|||
|
"param1": "value1",
|
|||
|
"param2": "value2",
|
|||
|
"param3": "value3"
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
(单片机 → Web)
|
|||
|
|
|||
|
{
|
|||
|
"command": "set_mode_response",
|
|||
|
"parameters": {
|
|||
|
"status": 0, // 0: 成功, 1: 失败
|
|||
|
"message": "Mode set successfully"
|
|||
|
}
|
|||
|
}
|
|||
|
方案设置
|
|||
|
|
|||
|
(Web → 单片机)
|
|||
|
{
|
|||
|
"command": "set_scheme",
|
|||
|
"parameters": {
|
|||
|
"scheme": [
|
|||
|
{
|
|||
|
"id": 1,
|
|||
|
"name": "方案1",
|
|||
|
"selectedMode": "1", // 1:直行,2:左转,3:右转,4:掉头
|
|||
|
"timeRange": {
|
|||
|
"start": "08:00",
|
|||
|
"end": "10:00"
|
|||
|
},
|
|||
|
"lanes": [
|
|||
|
"0",
|
|||
|
"1"
|
|||
|
]
|
|||
|
}
|
|||
|
]
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
(单片机 → Web)
|
|||
|
|
|||
|
{
|
|||
|
"command": "set_scheme_response",
|
|||
|
"parameters": {
|
|||
|
"status": 0, // 0: 成功, 1: 失败
|
|||
|
"message": "Add Plan successfully"
|
|||
|
}
|
|||
|
}
|
|||
|
基本信息
|
|||
|
|
|||
|
(Web → 单片机)
|
|||
|
{
|
|||
|
"command": "get_device_info",
|
|||
|
"parameters": {}
|
|||
|
}
|
|||
|
|
|||
|
(单片机 → Web)
|
|||
|
{
|
|||
|
"command": "get_device_info_response",
|
|||
|
"parameters": {
|
|||
|
"version": "1.0.3", // 版本号
|
|||
|
"compileTime": "2025-01-14T10:30:00Z"
|
|||
|
}
|
|||
|
}
|
|||
|
获取所有信息
|
|||
|
|
|||
|
(Web → 单片机)
|
|||
|
{
|
|||
|
"command": "get_all_info",
|
|||
|
"parameters": {}
|
|||
|
}
|
|||
|
|
|||
|
(单片机 → Web)
|
|||
|
{
|
|||
|
"command": "get_all_info_response",
|
|||
|
"parameters": {
|
|||
|
"set_mode": 0, // 智能模式
|
|||
|
"scheme": [
|
|||
|
{
|
|||
|
"id": 1,
|
|||
|
"name": "方案1",
|
|||
|
"selectedMode": "1", // 1:直行,2:左转,3:右转,4:掉头
|
|||
|
"timeRange": {
|
|||
|
"start": "08:00",
|
|||
|
"end": "10:00"
|
|||
|
},
|
|||
|
"lanes": [
|
|||
|
"0",
|
|||
|
"1"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"deviceInfo": {
|
|||
|
"version": "1.0.3",
|
|||
|
"compileTime": "2025-01-14 10:30:00"
|
|||
|
}
|
|||
|
}
|
|||
|
}
|