130 lines
3.3 KiB
Protocol Buffer
130 lines
3.3 KiB
Protocol Buffer
//bytes替代string 防止乱码
|
||
syntax = "proto3";
|
||
|
||
|
||
import "google/protobuf/any.proto";
|
||
package stream;
|
||
|
||
|
||
//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;
|
||
iCHAR = 7;
|
||
iUCHAR = 8;
|
||
iWORD = 9;
|
||
iDOUBLE = 10;
|
||
iTIMET = 11;
|
||
}
|
||
|
||
enum DATAHANDLE {
|
||
UPDATE = 0;
|
||
ADD = 1;
|
||
DEL = 2;
|
||
}
|
||
|
||
/*==================begin 通用通信结构体====================*/
|
||
|
||
message ParamInfo{
|
||
bytes nameKey = 1; //参数key
|
||
bytes strValue = 2; //value
|
||
//bool isOutput = 2; //是否只读
|
||
TYPE valueType = 3; //数据类型
|
||
}
|
||
|
||
message RequestInfo {
|
||
uint32 dataType = 1; //信息类型
|
||
bytes nameKey = 2; //参数key
|
||
bytes strValue = 3; //value值
|
||
TYPE valueType = 4; //value数据类型
|
||
DATAHANDLE handleType = 5; //增删改
|
||
}
|
||
|
||
message ResponseInfo {
|
||
uint32 dataType = 1; //信息类型
|
||
bool result = 2; //执行成功与否
|
||
repeated ParamInfo item = 3; //参数值
|
||
}
|
||
|
||
/*==================end 通用通信结构体====================*/
|
||
|
||
|
||
message ResponseAny{
|
||
google.protobuf.Any data = 1;
|
||
}
|
||
|
||
/*==================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
|
||
}
|
||
|
||
//注册功能返回信息
|
||
message RegResponce{
|
||
int32 data = 1;
|
||
}
|
||
|
||
message ImgInfoResponce{
|
||
uint32 levelImage = 1;
|
||
int32 width = 2;
|
||
int32 height = 3;
|
||
}
|
||
|
||
service Stream {
|
||
rpc Simple(RequestInfo) returns (ResponseAny) {} // 简单模式
|
||
rpc ServerStream (RequestInfo) returns (stream ResponseInfo) {} // 服务端数据流模式
|
||
rpc ClientStream (stream RequestInfo) returns (ResponseInfo) {} // 客户端数据流模式
|
||
rpc AllStream (stream RequestInfo) returns (stream ResponseInfo) {} // 双向数据流模式
|
||
}
|