GrpcPrint/PrintS/protobuf/stream.proto

109 lines
3.0 KiB
Protocol Buffer
Raw Normal View History

2024-03-15 12:31:34 +08:00
//bytes替代string 防止乱码
syntax = "proto3";
2024-05-15 13:38:34 +08:00
import "google/protobuf/any.proto";
2024-03-15 12:31:34 +08:00
package stream;
2024-05-15 13:38:34 +08:00
2024-03-15 12:31:34 +08:00
//ption cc_generic_services = true;
option java_multiple_files = true;
option java_package = "io.grpc.examples.stream";
option java_outer_classname = "StreamProto";
option objc_class_prefix = "ST";
enum TYPE{
iBOOL = 0;
iSHORT = 1;
iUSHORT = 2;
iINT = 3;
iUINT = 4;
iFLOAT = 5;
iSTRING = 6;
}
2024-04-23 13:41:16 +08:00
/*==================begin 通用通信结构体====================*/
message ParamInfo{
bytes nameKey = 1; //参数key
bytes strValue = 2; //value
2024-04-12 15:51:41 +08:00
//bool isOutput = 2; //是否只读
TYPE valueType = 3; //数据类型
}
2024-03-15 12:31:34 +08:00
message RequestInfo {
2024-04-08 13:43:56 +08:00
uint32 dataType = 1; //信息类型
2024-03-15 12:31:34 +08:00
bytes nameKey = 2; //参数key
bytes strValue = 3; //value值
TYPE valueType = 4; //value数据类型
2024-03-15 12:31:34 +08:00
}
message ResponseInfo {
2024-04-08 13:43:56 +08:00
uint32 dataType = 1; //信息类型
bool result = 2; //执行成功与否
repeated ParamInfo item = 3; //参数值
2024-03-15 12:31:34 +08:00
}
2024-04-23 13:41:16 +08:00
/*==================end 通用通信结构体====================*/
2024-05-15 13:38:34 +08:00
message ResponseAny{
google.protobuf.Any data = 1;
}
2024-04-23 13:41:16 +08:00
/*==================begin h3d图层结构体===================*/
message LayerData{
float zCooldinate = 1; // Z 坐标 : Float 单位 mm
float powder = 2; // 供粉量: Float 单位 mm
float layerThickness = 3; //层厚
//LayerSummary layerSummary = 3; // 层统计区() : Struct
//uint32 layerBlock = 5; //层块数 决定多少个层块数据库
repeated LayerDataBlock layerDataBlock = 4; //层块数据区
bool result = 5; //是否ok
}
message LayerDataBlock
{
int32 elementId = 1; // 零件 ID : Int32
int32 elementParamId = 2; // 零件参数 ID : Int32
//DataBlockSummary dbSummary = 3; //块统计区 : Struct
//uint32 blockNum = 4; // 块数据数: Uint32 //决定有多少个块数据区
uint32 blockType = 3; // 块类型: Char //1 代表向量型数据块3 代表链型数据块
repeated VectorDataBlock vecBlocks= 4; //块数据区 向量型
repeated ChainDataBlock chainBlocks = 5; //块数据区 链型
uint32 order = 6;
}
message VectorDataBlock{
float startX = 1; // 始点 X 位置 : Float //单位 mm
float startY=2; // 始点 Y 位置 : Float //单位 mm
float endX = 3; // 终点 X 位置 : Float //单位 mm
float endY = 4; // 终点 Y 位置 : Float //单位 mm
}
message ChainDataBlock
{
uint32 dotNum = 1; // 点数:Uint32 //决定有多少个点区
repeated Point pointVec = 2; // 点区
}
message Point{
float xPos = 1; // X 位置 : Float //单位 mm
float yPos = 2; // Y 位置 : Float //单位 mm
}
2024-03-15 12:31:34 +08:00
service Stream {
2024-05-15 13:38:34 +08:00
rpc Simple(RequestInfo) returns (ResponseAny) {} // 简单模式
2024-03-15 12:31:34 +08:00
rpc ServerStream (RequestInfo) returns (stream ResponseInfo) {} // 服务端数据流模式
rpc ClientStream (stream RequestInfo) returns (ResponseInfo) {} // 客户端数据流模式
rpc AllStream (stream RequestInfo) returns (stream ResponseInfo) {} // 双向数据流模式
}