简易版代码

This commit is contained in:
2025-09-25 20:14:48 +08:00
parent 5519d43253
commit c117759ac3
4 changed files with 651 additions and 0 deletions

32
proto/client.proto Normal file
View File

@@ -0,0 +1,32 @@
syntax = "proto3";
package device;
import "google/protobuf/any.proto";
option go_package = "internal/app/service/device/proto";
// 指令类型
enum MethodType{
SWITCH = 0; // 启停
COLLECT = 1; // 采集
}
// 指令
message Instruction{
MethodType method = 1;
google.protobuf.Any data = 2;
}
message Switch{
string device_action = 1; // 指令
int32 bus_number = 2; // 总线号
int32 bus_address = 3; // 总线地址
int32 relay_channel = 4; // 继电器通道号
}
message Collect{
int32 bus_number = 1; // 总线号
int32 bus_address = 2; // 总线地址
float value = 3; // 采集值
}