Files
pig-farm-controller/internal/app/service/device/proto/device.proto

37 lines
717 B
Protocol Buffer
Raw Normal View History

syntax = "proto3";
package device;
import "google/protobuf/any.proto";
option go_package = "internal/app/service/device/proto";
2025-09-15 23:45:15 +08:00
// 指令类型
enum MethodType{
2025-09-25 20:16:07 +08:00
SWITCH = 0; // 启停
COLLECT = 1; // 采集
}
2025-09-15 23:45:15 +08:00
// 指令
message Instruction{
MethodType method = 1;
google.protobuf.Any data = 2;
}
2025-09-15 23:45:15 +08:00
message Switch{
string device_action = 1; // 指令
int32 bus_number = 2; // 总线号
int32 bus_address = 3; // 总线地址
int32 relay_channel = 4; // 继电器通道号
2025-09-25 20:16:07 +08:00
}
message Collect{
int32 bus_number = 1; // 总线号
int32 bus_address = 2; // 总线地址
float value = 3; // 采集值
2025-09-26 15:26:21 +08:00
}
// 用于批量上报的顶层消息
message UplinkPayload {
repeated Collect readings = 1;
2025-09-15 23:45:15 +08:00
}