2.11
This commit is contained in:
parent
3eac2eed00
commit
1c87c36f81
@ -139,8 +139,10 @@
|
||||
<el-table :data="plans" empty-text="暂无数据" border style="width: 100%; margin-bottom: 20px;">
|
||||
<el-table-column type="index" label="序号" width="60" align="center"></el-table-column>
|
||||
<el-table-column prop="name" label="方案名称" min-width="15%" align="center"></el-table-column>
|
||||
<el-table-column prop="timeRange" label="时间段" min-width="15%" align="center"></el-table-column>
|
||||
<el-table-column prop="selectedMode" label="车道模式" min-width="15%" align="center"></el-table-column>
|
||||
<el-table-column prop="timeRange" label="时间段" min-width="15%"
|
||||
align="center"></el-table-column>
|
||||
<el-table-column prop="selectedMode" label="车道模式" min-width="15%"
|
||||
align="center"></el-table-column>
|
||||
<el-table-column prop="lanes" label="开放车道" min-width="15%" align="center">
|
||||
<template #default="scope">
|
||||
<span v-for="(lane, index) in scope.row.lanes" :key="index">
|
||||
@ -158,10 +160,8 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="使能" width="80" align="center">
|
||||
<template #default="scope">
|
||||
<el-switch
|
||||
v-model="scope.row.enabled"
|
||||
@change="(val) => handleStatusChange(val, scope.row)"
|
||||
></el-switch>
|
||||
<el-switch v-model="scope.row.enabled"
|
||||
@change="(val) => handleStatusChange(val, scope.row)"></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="120" align="center">
|
||||
@ -181,20 +181,14 @@
|
||||
|
||||
<el-form-item label="车道模式">
|
||||
<el-select v-model="newPlan.selectedMode" placeholder="请选择车道模式">
|
||||
<el-option label="左转 直行" value="0"></el-option>
|
||||
<el-option label="右转 直行" value="1"></el-option>
|
||||
<el-option label="左转 直行" :value="1"></el-option>
|
||||
<el-option label="右转 直行" :value="2"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="时间段设置">
|
||||
<el-time-picker
|
||||
v-model="newPlan.timeRange"
|
||||
is-range
|
||||
range-separator="至"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
style="width: 350px;"
|
||||
/>
|
||||
<el-time-picker v-model="newPlan.timeRange" is-range range-separator="至"
|
||||
start-placeholder="开始时间" end-placeholder="结束时间" style="width: 350px;" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="开放车道">
|
||||
@ -273,7 +267,7 @@ export default {
|
||||
endTime: '',
|
||||
lanes: [],
|
||||
timeRange: [], // 用于绑定时间段选择的数组
|
||||
selectedMode: '', // 用于绑定选择的值
|
||||
selectedMode: null, // 初始值设为 null
|
||||
repeatDays: [], // 添加重复日期数组
|
||||
},
|
||||
plans: [
|
||||
@ -281,16 +275,16 @@ export default {
|
||||
// id: 1,
|
||||
// name: '早高峰方案',
|
||||
// timeRange: '07:30 - 09:30',
|
||||
// selectedMode: '0', // 左转直行
|
||||
// selectedMode: 0, // 改为数字
|
||||
// lanes: ['车道1', '车道2'],
|
||||
// repeatDays: [0, 1, 2, 3, 4], // 周一到周五
|
||||
// repeatDays: [0, 1, 2, 3, 4],
|
||||
// enabled: true
|
||||
// },
|
||||
// {
|
||||
// id: 2,
|
||||
// name: '晚高峰方案',
|
||||
// timeRange: '17:00 - 19:00',
|
||||
// selectedMode: '1', // 右转直行
|
||||
// selectedMode: 1, // 改为数字
|
||||
// lanes: ['车道2', '车道3', '车道4'],
|
||||
// repeatDays: [0, 1, 2, 3, 4],
|
||||
// enabled: false
|
||||
@ -299,7 +293,7 @@ export default {
|
||||
// id: 3,
|
||||
// name: '周末方案',
|
||||
// timeRange: '09:00 - 18:00',
|
||||
// selectedMode: '0',
|
||||
// selectedMode: 0, // 改为数字
|
||||
// lanes: ['车道1', '车道2', '车道3'],
|
||||
// repeatDays: [5, 6], // 周六周日
|
||||
// enabled: true
|
||||
@ -341,7 +335,7 @@ export default {
|
||||
resetNewPlan() {
|
||||
this.newPlan = {
|
||||
name: '',
|
||||
selectedMode: '',
|
||||
selectedMode: null,
|
||||
timeRange: [],
|
||||
lanes: [],
|
||||
repeatDays: []
|
||||
@ -406,9 +400,18 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
// 方案添加
|
||||
// 添加方案
|
||||
async addPlan() {
|
||||
try {
|
||||
// 验证方案数量是否超过 30
|
||||
if (this.plans.length >= 30) {
|
||||
ElMessage({
|
||||
message: '无法添加新方案,方案数量已达到上限(30个)',
|
||||
type: 'error'
|
||||
});
|
||||
return; // 终止提交
|
||||
}
|
||||
|
||||
// 验证所有必填字段
|
||||
if (!this.newPlan.name) {
|
||||
ElMessage({
|
||||
@ -418,7 +421,7 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.newPlan.selectedMode) {
|
||||
if (this.newPlan.selectedMode === null) {
|
||||
ElMessage({
|
||||
message: '请选择车道模式',
|
||||
type: 'error'
|
||||
@ -435,29 +438,46 @@ export default {
|
||||
let startTime, endTime;
|
||||
if (Array.isArray(this.newPlan.timeRange)) {
|
||||
[startTime, endTime] = this.newPlan.timeRange;
|
||||
} else if (typeof this.newPlan.timeRange === 'string') {
|
||||
[startTime, endTime] = this.newPlan.timeRange.split(' - ');
|
||||
}
|
||||
|
||||
// 处理车道
|
||||
const lanes = (this.newPlan.lanes || []).map(lane => {
|
||||
return String(lane.replace('车道', '') - 1);
|
||||
// 处理车道 - 转换为二进制字符串
|
||||
const lanesBinary = [0, 0, 0, 0]; // 初始化为 0000
|
||||
(this.newPlan.lanes || []).forEach(lane => {
|
||||
const laneIndex = parseInt(lane.replace('车道', '')) - 1; // 获取车道索引
|
||||
if (laneIndex >= 0 && laneIndex < 4) {
|
||||
lanesBinary[laneIndex] = 1; // 设置为 1
|
||||
}
|
||||
});
|
||||
const lanesBinaryString = lanesBinary.join(''); // 转换为字符串
|
||||
|
||||
// 处理重复日期 - 转换为二进制字符串
|
||||
const repeatDaysBinary = Array(7).fill(0); // 初始化为 0000000
|
||||
(this.newPlan.repeatDays || []).forEach(day => {
|
||||
repeatDaysBinary[day] = 1; // 设置为 1
|
||||
});
|
||||
const repeatDaysBinaryString = repeatDaysBinary.join(''); // 转换为字符串
|
||||
|
||||
// 生成新的方案 ID
|
||||
const existingIds = this.plans.map(plan => plan.id);
|
||||
let newId = 0; // 从 0 开始
|
||||
while (existingIds.includes(newId)) {
|
||||
newId++; // 找到下一个未使用的 ID
|
||||
}
|
||||
|
||||
const planData = {
|
||||
JSON_id: getNextJsonId(),
|
||||
command: "set_scheme",
|
||||
command: "add_scheme",
|
||||
parameters: {
|
||||
scheme: [{
|
||||
id: this.isEdit ? this.currentEditId : (this.plans.length + 1),
|
||||
id: newId, // 使用生成的 ID
|
||||
name: this.newPlan.name,
|
||||
selectedMode: this.newPlan.selectedMode,
|
||||
timeRange: {
|
||||
start: formatTime(startTime),
|
||||
end: formatTime(endTime)
|
||||
},
|
||||
lanes: lanes,
|
||||
repeatDays: this.newPlan.repeatDays.map(day => Number(day))
|
||||
lanes: lanesBinaryString, // 使用二进制字符串
|
||||
repeatDays: repeatDaysBinaryString // 使用二进制字符串
|
||||
}]
|
||||
}
|
||||
};
|
||||
@ -474,7 +494,7 @@ export default {
|
||||
|
||||
if (response.data?.parameters?.status === 0) {
|
||||
const newPlanData = {
|
||||
id: planData.parameters.scheme[0].id,
|
||||
id: newId, // 使用生成的 ID
|
||||
name: this.newPlan.name,
|
||||
timeRange: `${formatTime(startTime)} - ${formatTime(endTime)}`,
|
||||
selectedMode: this.newPlan.selectedMode,
|
||||
@ -483,14 +503,7 @@ export default {
|
||||
enabled: true
|
||||
};
|
||||
|
||||
if (this.isEdit) {
|
||||
const index = this.plans.findIndex(p => p.id === this.currentEditId);
|
||||
if (index !== -1) {
|
||||
this.plans.splice(index, 1, newPlanData);
|
||||
}
|
||||
} else {
|
||||
this.plans.push(newPlanData);
|
||||
}
|
||||
this.plans.push(newPlanData); // 添加新方案到列表
|
||||
|
||||
this.planDialogVisible = false;
|
||||
this.resetNewPlan();
|
||||
@ -564,22 +577,34 @@ export default {
|
||||
|
||||
// 更新方案列表
|
||||
if (response.data.parameters.scheme) {
|
||||
this.plans = response.data.parameters.scheme.map(scheme => ({
|
||||
name: scheme.name,
|
||||
timeRange: `${scheme.timeRange.start} - ${scheme.timeRange.end}`,
|
||||
selectedMode: scheme.selectedMode,
|
||||
lanes: scheme.lanes.map(lane => `车道${parseInt(lane) + 1}`),
|
||||
repeatDays: scheme.repeatDays || [] // 添加重复日期
|
||||
}));
|
||||
this.plans = response.data.parameters.scheme.map(scheme => {
|
||||
// 解析 lanes 二进制字符串
|
||||
const lanesBinary = scheme.lanes.split('').map(Number); // 转换为数字数组
|
||||
const lanes = lanesBinary.map((lane, index) => lane === 1 ? `车道${index + 1}` : null).filter(Boolean); // 过滤出开放的车道
|
||||
|
||||
// 解析 repeatDays 二进制字符串
|
||||
const repeatDaysBinary = scheme.repeatDays.split('').map(Number); // 转换为数字数组
|
||||
const repeatDays = repeatDaysBinary.map((day, index) => day === 1 ? index : null).filter(Boolean); // 过滤出选中的日期
|
||||
|
||||
return {
|
||||
id: parseInt(scheme.id),
|
||||
name: scheme.name,
|
||||
timeRange: `${scheme.timeRange.start} - ${scheme.timeRange.end}`,
|
||||
selectedMode: parseInt(scheme.selectedMode),
|
||||
lanes: lanes, // 使用解析后的车道
|
||||
repeatDays: repeatDays, // 使用解析后的重复日期
|
||||
enabled: Boolean(scheme.en)
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
// 更新默认车道设置
|
||||
if (response.data.parameters.laneSetting) {
|
||||
this.laneDefaults = {
|
||||
lane1: response.data.parameters.laneSetting.lane1 || [],
|
||||
lane2: response.data.parameters.laneSetting.lane2 || [],
|
||||
lane3: response.data.parameters.laneSetting.lane3 || [],
|
||||
lane4: response.data.parameters.laneSetting.lane4 || []
|
||||
lane1: response.data.parameters.laneSetting.lane1 || 0,
|
||||
lane2: response.data.parameters.laneSetting.lane2 || 0,
|
||||
lane3: response.data.parameters.laneSetting.lane3 || 0,
|
||||
lane4: response.data.parameters.laneSetting.lane4 || 0
|
||||
};
|
||||
}
|
||||
|
||||
@ -766,14 +791,26 @@ export default {
|
||||
[startTime, endTime] = this.newPlan.timeRange;
|
||||
}
|
||||
|
||||
// 处理车道
|
||||
const lanes = (this.newPlan.lanes || []).map(lane => {
|
||||
return String(lane.replace('车道', '') - 1);
|
||||
// 处理车道 - 转换为二进制字符串
|
||||
const lanesBinary = [0, 0, 0, 0]; // 初始化为 0000
|
||||
(this.newPlan.lanes || []).forEach(lane => {
|
||||
const laneIndex = parseInt(lane.replace('车道', '')) - 1; // 获取车道索引
|
||||
if (laneIndex >= 0 && laneIndex < 4) {
|
||||
lanesBinary[laneIndex] = 1; // 设置为 1
|
||||
}
|
||||
});
|
||||
const lanesBinaryString = lanesBinary.join(''); // 转换为字符串
|
||||
|
||||
// 处理重复日期 - 转换为二进制字符串
|
||||
const repeatDaysBinary = Array(7).fill(0); // 初始化为 0000000
|
||||
(this.newPlan.repeatDays || []).forEach(day => {
|
||||
repeatDaysBinary[day] = 1; // 设置为 1
|
||||
});
|
||||
const repeatDaysBinaryString = repeatDaysBinary.join(''); // 转换为字符串
|
||||
|
||||
const editedPlan = {
|
||||
JSON_id: getNextJsonId(),
|
||||
command: "set_scheme",
|
||||
command: "add_scheme",
|
||||
parameters: {
|
||||
scheme: [{
|
||||
id: this.currentEditId,
|
||||
@ -783,8 +820,8 @@ export default {
|
||||
start: formatTime(startTime),
|
||||
end: formatTime(endTime)
|
||||
},
|
||||
lanes: lanes,
|
||||
repeatDays: this.newPlan.repeatDays.map(day => Number(day))
|
||||
lanes: lanesBinaryString, // 使用二进制字符串
|
||||
repeatDays: repeatDaysBinaryString // 使用二进制字符串
|
||||
}]
|
||||
}
|
||||
};
|
||||
@ -842,10 +879,10 @@ export default {
|
||||
JSON_id: getNextJsonId(),
|
||||
command: "default_lane_setting",
|
||||
parameters: {
|
||||
lane1: this.laneDefaults.lane1 || [],
|
||||
lane2: this.laneDefaults.lane2 || [],
|
||||
lane3: this.laneDefaults.lane3 || [],
|
||||
lane4: this.laneDefaults.lane4 || []
|
||||
lane1: parseInt(this.laneDefaults.lane1) || 0,
|
||||
lane2: parseInt(this.laneDefaults.lane2) || 0,
|
||||
lane3: parseInt(this.laneDefaults.lane3) || 0,
|
||||
lane4: parseInt(this.laneDefaults.lane4) || 0
|
||||
}
|
||||
};
|
||||
|
||||
@ -888,6 +925,15 @@ export default {
|
||||
|
||||
// 处理方案提交
|
||||
handlePlanSubmit() {
|
||||
// 验证车道模式是否选择
|
||||
if (this.newPlan.selectedMode === null) {
|
||||
ElMessage({
|
||||
message: '请选择车道模式',
|
||||
type: 'error'
|
||||
});
|
||||
return; // 终止提交
|
||||
}
|
||||
|
||||
if (this.isEdit) {
|
||||
this.saveEditPlan();
|
||||
} else {
|
||||
@ -900,7 +946,7 @@ export default {
|
||||
try {
|
||||
const statusData = {
|
||||
JSON_id: getNextJsonId(),
|
||||
command: "set_scheme_status",
|
||||
command: "add_scheme_status",
|
||||
parameters: {
|
||||
id: row.id,
|
||||
enabled: val
|
||||
@ -1062,7 +1108,7 @@ export default {
|
||||
}
|
||||
|
||||
/* 调整按钮间距 */
|
||||
.el-button + .el-button {
|
||||
.el-button+.el-button {
|
||||
margin-left: 8px;
|
||||
}
|
||||
</style>
|
||||
|
167
可变车道JSON协议.json
167
可变车道JSON协议.json
@ -1,70 +1,60 @@
|
||||
登入界面JSON格式
|
||||
|
||||
登录界面
|
||||
(Web → 单片机)
|
||||
|
||||
{
|
||||
json{
|
||||
"command": "login",
|
||||
"parameters": {
|
||||
"username": "string",
|
||||
"password": "string"
|
||||
}
|
||||
}
|
||||
|
||||
(单片机 → Web)
|
||||
|
||||
{
|
||||
json{
|
||||
"command": "login_response",
|
||||
"parameters": {
|
||||
"status": 0, // 0: 成功, 1: 失败
|
||||
"message": "Login successful" // 成功或失败的提示信息
|
||||
"status": 0, // 0: 成功, 1: 失败
|
||||
"message": "Login successful" // 成功或失败的提示信息
|
||||
}
|
||||
}
|
||||
(修改密码)
|
||||
修改密码
|
||||
(Web → 单片机)
|
||||
{
|
||||
json{
|
||||
"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"
|
||||
"old_password": "",
|
||||
"new_password": ""
|
||||
}
|
||||
}
|
||||
时间设置JSON格式
|
||||
|
||||
(单片机 → Web)
|
||||
json{
|
||||
"command": "change_password_response",
|
||||
"parameters": {
|
||||
"status": 0, // 0: 成功, 1: 失败
|
||||
"message": "Password changed successfully"
|
||||
}
|
||||
}
|
||||
时间设置
|
||||
(Web → 单片机)
|
||||
|
||||
{
|
||||
json{
|
||||
"command": "set_time",
|
||||
"parameters": {
|
||||
"timestamp": "2025-01-13T12:00:00Z"
|
||||
}
|
||||
}
|
||||
|
||||
(单片机 → Web)
|
||||
|
||||
{
|
||||
json{
|
||||
"command": "set_time_response",
|
||||
"parameters": {
|
||||
"status": 0, // 0: 成功, 1: 失败
|
||||
"status": 0, // 0: 成功, 1: 失败
|
||||
"message": "Time set successfully"
|
||||
}
|
||||
}
|
||||
模式设置
|
||||
(Web
|
||||
|
||||
{
|
||||
(Web → 单片机)
|
||||
json{
|
||||
"command": "set_mode",
|
||||
"parameters": {
|
||||
"mode": 0, // 智能模式
|
||||
"mode": 0, // 智能模式
|
||||
"data": {
|
||||
"param1": "value1",
|
||||
"param2": "value2",
|
||||
@ -72,167 +62,146 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(单片机 → Web)
|
||||
|
||||
{
|
||||
json{
|
||||
"command": "set_mode_response",
|
||||
"parameters": {
|
||||
"status": 0, // 0: 成功, 1: 失败
|
||||
"status": 0, // 0: 成功, 1: 失败
|
||||
"message": "Mode set successfully"
|
||||
}
|
||||
}
|
||||
方案设置
|
||||
|
||||
(Web → 单片机)
|
||||
{
|
||||
"command": "set_scheme",
|
||||
json{
|
||||
"command": "add_scheme",
|
||||
"parameters": {
|
||||
"scheme": [
|
||||
{
|
||||
"id": 1,
|
||||
"en": 1,
|
||||
"name": "方案1",
|
||||
"selectedMode": "1", // 1:直行,2:左转,3:右转,4:掉头
|
||||
"selectedMode": 1, // 1:直行,2:左转,3:右转,4:掉头
|
||||
"timeRange": {
|
||||
"start": "08:00",
|
||||
"end": "10:00"
|
||||
},
|
||||
"lanes": [
|
||||
"0",
|
||||
"1"
|
||||
],
|
||||
"repeatDays": [0, 1, 2, 3, 4, 5, 6] // 表示周一到周日每天都重复执行该方案
|
||||
"lanes": "0100", // 用二进制表示车道状态,这里表示第二车道开启
|
||||
"repeatDays": "0000001" // 用二进制表示重复日期,这里表示周日重复
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
(单片机 → Web)
|
||||
|
||||
{
|
||||
"command": "set_scheme_response",
|
||||
json{
|
||||
"command": "add_scheme_response",
|
||||
"parameters": {
|
||||
"status": 0, // 0: 成功, 1: 失败
|
||||
"status": 0, // 0: 成功, 1: 失败
|
||||
"message": "Add Plan successfully"
|
||||
}
|
||||
}
|
||||
基本信息
|
||||
|
||||
|
||||
基本信息
|
||||
(Web → 单片机)
|
||||
{
|
||||
json{
|
||||
"command": "get_device_info",
|
||||
"parameters": {}
|
||||
}
|
||||
|
||||
(单片机 → Web)
|
||||
{
|
||||
json{
|
||||
"command": "get_device_info_response",
|
||||
"parameters": {
|
||||
"version": "1.0.3", // 版本号
|
||||
"version": "1.0.3", // 版本号
|
||||
"compileTime": "2025-01-14T10:30:00Z"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
获取所有信息
|
||||
|
||||
(Web → 单片机)
|
||||
{
|
||||
json{
|
||||
"command": "get_all_info",
|
||||
"parameters": {}
|
||||
}
|
||||
|
||||
(单片机 → Web)
|
||||
{
|
||||
json{
|
||||
"command": "get_all_info_response",
|
||||
"parameters": {
|
||||
"set_mode": 0, // 智能模式
|
||||
"set_mode": 0, // 智能模式
|
||||
"scheme": [
|
||||
{
|
||||
"id": 1,
|
||||
"en": 1,
|
||||
"name": "方案1",
|
||||
"selectedMode": "1", // 1:直行,2:左转,3:右转,4:掉头
|
||||
"selectedMode": 1, // 1:直行,2:左转,3:右转,4:掉头
|
||||
"timeRange": {
|
||||
"start": "08:00",
|
||||
"end": "10:00"
|
||||
},
|
||||
"lanes": [
|
||||
"0",
|
||||
"1"
|
||||
],
|
||||
"repeatDays": [0, 1, 2, 3, 4, 5, 6] // 表示周一到周日每天都重复执行该方案
|
||||
"lanes": "0100", // 用二进制表示车道状态,这里表示第二车道开启
|
||||
"repeatDays": "0000001" // 用二进制表示重复日期,这里表示周日重复
|
||||
}
|
||||
],
|
||||
"laneSetting": {
|
||||
"lane1": "0", //0左转直行 1右转直行
|
||||
"lane2": "1",
|
||||
"lane3": "0",
|
||||
"lane4": "1"
|
||||
|
||||
"lane1": 0, //0左转直行 1右转直行
|
||||
"lane2": 1,
|
||||
"lane3": 0,
|
||||
"lane4": 1
|
||||
},
|
||||
"deviceInfo": {
|
||||
"version": "1.0.3",
|
||||
"compileTime": "2025-01-14 10:30:00"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
默认车道设置
|
||||
(Web → 单片机)
|
||||
|
||||
{
|
||||
json{
|
||||
"command": "default_lane_setting",
|
||||
"parameters": {
|
||||
"lane1": "0", //0左转直行 1右转直行
|
||||
"lane2": "1",
|
||||
"lane3": "2",
|
||||
"lane4": "3"
|
||||
|
||||
"lane1": 0, //0左转直行 1右转直行
|
||||
"lane2": 1,
|
||||
"lane3": 0,
|
||||
"lane4": 1
|
||||
}
|
||||
}
|
||||
(单片机 → Web)
|
||||
{
|
||||
"command": "default_lane_setting",
|
||||
json{
|
||||
"command": "default_lane_setting_response",
|
||||
"parameters": {
|
||||
"status": 0, // 0: 成功, 1: 失败
|
||||
"status": 0, // 0: 成功, 1: 失败
|
||||
"message": "Set successfully"
|
||||
}
|
||||
}
|
||||
|
||||
使能部分
|
||||
(Web → 单片机)
|
||||
{
|
||||
json{
|
||||
"JSON_id": 30,
|
||||
"command": "set_scheme_status",
|
||||
"parameters": {
|
||||
"id": 1,
|
||||
"enabled": false
|
||||
"id": 1,
|
||||
"enable": false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
(单片机 → Web)
|
||||
{
|
||||
json{
|
||||
"command": "set_scheme_status_response",
|
||||
"parameters": {
|
||||
"status": 0, // 0: 成功, 1: 失败
|
||||
"status": 0, // 0: 成功, 1: 失败
|
||||
"message": "Set successfully"
|
||||
}
|
||||
}
|
||||
|
||||
删除方案
|
||||
(Web → 单片机)
|
||||
{
|
||||
json{
|
||||
"command": "delete_scheme",
|
||||
"parameters": {
|
||||
"id": 1
|
||||
}
|
||||
}
|
||||
|
||||
(单片机 → Web)
|
||||
{
|
||||
json{
|
||||
"command": "delete_scheme_response",
|
||||
"parameters": {
|
||||
"status": 0, // 0: 成功, 1: 失败
|
||||
"status": 0, // 0: 成功, 1: 失败
|
||||
"message": "Delete successfully"
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user