From c36411e61627b8a4866d64ad7c2aa29786ba0e50 Mon Sep 17 00:00:00 2001 From: huang <1724659546@qq.com> Date: Wed, 8 Oct 2025 15:55:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E7=9B=AE=E5=BD=95=E7=BB=93?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- {proto => main/proto}/client.proto | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) rename {proto => main/proto}/client.proto (67%) diff --git a/proto/client.proto b/main/proto/client.proto similarity index 67% rename from proto/client.proto rename to main/proto/client.proto index 666f68a..4bd51c4 100644 --- a/proto/client.proto +++ b/main/proto/client.proto @@ -10,8 +10,8 @@ option go_package = "internal/domain/device/proto"; // 平台生成的原始485指令,单片机直接发送到总线 message Raw485Command { - int32 bus_number = 1; // 总线号,用于指示单片机将指令发送到哪个总线 - bytes command_bytes = 2; // 原始485指令的字节数组 + int32 bus_number = 1; // 总线号,用于指示单片机将指令发送到哪个总线 + bytes command_bytes = 2; // 原始485指令的字节数组 } // BatchCollectCommand @@ -24,14 +24,14 @@ message BatchCollectCommand { // CollectTask // 定义了单个采集任务的“意图”。 message CollectTask { - Raw485Command command = 2; // 平台生成的原始485指令 + Raw485Command command = 2; // 平台生成的原始485指令 } // CollectResult // 这是设备响应的、极致精简的数据包。 message CollectResult { - string correlation_id = 1; // 从下行指令中原样返回的关联ID - repeated float values = 2; // 按预定顺序排列的采集值 + string correlation_id = 1; // 从下行指令中原样返回的关联ID + repeated float values = 2; // 按预定顺序排列的采集值 } @@ -41,11 +41,11 @@ message CollectResult { // 使用 oneof 来替代 google.protobuf.Any,这是嵌入式环境下的标准做法。 // 它高效、类型安全,且只解码一次。 message Instruction { - oneof payload { - Raw485Command raw_485_command = 1; - BatchCollectCommand batch_collect_command = 2; - CollectResult collect_result = 3; // ADDED:用于上行数据 + oneof payload { + Raw485Command raw_485_command = 1; + BatchCollectCommand batch_collect_command = 2; + CollectResult collect_result = 3; // ADDED:用于上行数据 // 如果未来有其他指令类型,比如开关控制,可以直接在这里添加 // SwitchCommand switch_command = 3; - } + } }