This commit is contained in:
2025-09-29 23:54:09 +08:00
parent 503296e574
commit e2be93565d
2 changed files with 90 additions and 143 deletions

View File

@@ -10,25 +10,22 @@ option go_package = "internal/app/service/device/proto";
// 指令类型
enum MethodType {
SWITCH = 0; // 启停
COLLECT = 1; // 采集
INSTRUCTION = 0; // 下发指令
COLLECT = 1; // 批量采集
}
// 平台生成的原始485指令单片机直接发送到总线
message Raw485Command {
bytes command_bytes = 1; // 原始485指令的字节数组
}
// 指令 (所有空中数据都会被包装在这里面)
// data字段现在可以包含 Raw485Command表示平台生成的原始485指令。
message Instruction {
MethodType method = 1;
google.protobuf.Any data = 2;
google.protobuf.Any data = 2; // 可以是 Switch, Raw485Command 等
}
// Switch 指令的载荷
message Switch {
string device_action = 1; // 指令
int32 bus_number = 2; // 总线号
int32 bus_address = 3; // 总线地址
int32 relay_channel = 4; // 继电器通道号
}
// --- 批量采集相关结构 ---
// BatchCollectCommand
@@ -40,11 +37,9 @@ message BatchCollectCommand {
}
// CollectTask
// 定义了单个采集任务的“意图”。
// 定义了单个采集任务的“意图”。现在直接包含平台生成的原始485指令。
message CollectTask {
string device_action = 1; // 指令
int32 bus_number = 2; // 总线号
int32 bus_address = 3; // 总线地址
Raw485Command command = 1; // 平台生成的原始485指令
}
// CollectResult