Skip to content

Commit

Permalink
Merge pull request #14 from UlfBj/main
Browse files Browse the repository at this point in the history
Protobuf schema added.
  • Loading branch information
UlfBj authored Jul 2, 2024
2 parents f40985c + 8dc9b4f commit 1bd9d14
Showing 1 changed file with 199 additions and 4 deletions.
203 changes: 199 additions & 4 deletions spec/VISSv2.x_PayloadEncoding.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,212 @@ <h2>Protobuf encoding</h2>
</p>
<section id="protobuf-Schema-definition">
<h2>Protobuf Schema Definition</h2>
<p>xxxxx<br>
<p>
The following protobuf source code describes the VISS message payloads.
Stored in a file e.g. named "viss.proto" the protbuf compiler (protoc) can be used to create helper functions that can be called to encode and decode
between the JSON format and the protobuf format.
The protobuf source code below also contains a "service" clause that the protoc compiler uses to create a gRPC based communication framework.
<pre><code>
syntax = "proto3";
package grpcProtobufMessages;

enum ResponseStatus {
SUCCESS = 0;
ERROR = 1;
}

enum SubscribeResponseType {
RESPONSE = 0;
EVENT = 1;
}

service VISS {
rpc GetRequest (GetRequestMessage) returns (GetResponseMessage);

rpc SetRequest (SetRequestMessage) returns (SetResponseMessage);

rpc SubscribeRequest (SubscribeRequestMessage) returns (stream SubscribeStreamMessage);

rpc UnsubscribeRequest (UnsubscribeRequestMessage) returns (UnsubscribeResponseMessage);
}

message ErrorResponseMessage {
string Number = 1;
optional string Reason = 2;
optional string Message = 3;
}

message FilterExpressions {
message FilterExpression {
enum FilterType {
PATHS = 0;
TIMEBASED = 1;
RANGE = 2;
CHANGE = 3;
CURVELOG = 4;
HISTORY = 5;
STATIC_METADATA = 6;
DYNAMIC_METADATA = 7;
}
FilterType FType = 1;

message FilterValue {
message PathsValue {
repeated string RelativePath = 1;
}
optional PathsValue ValuePaths = 1;

message TimebasedValue {
string Period = 1;
}
optional TimebasedValue ValueTimebased = 2;

message RangeValue {
string LogicOperator = 1;
string Boundary = 2;
}
repeated RangeValue ValueRange = 3;

message ChangeValue {
string LogicOperator = 1;
string Diff = 2;
}
optional ChangeValue ValueChange = 4;

message CurvelogValue {
string MaxErr = 1;
string BufSize = 2;
}
optional CurvelogValue ValueCurvelog = 5;

message HistoryValue {
string TimePeriod = 1; //ISO8601 period expression
}
optional HistoryValue ValueHistory = 6;

message StaticMetadataValue {
string Tree = 1;
}
optional StaticMetadataValue ValueStaticMetadata = 7;

message DynamicMetadataValue {
string MetadataDomain = 1;
}
optional DynamicMetadataValue ValueDynamicMetadata = 8;
}
FilterValue Value = 2;
}
repeated FilterExpression FilterExp = 1;
}

message DataPackages {
message DataPackage {
string Path = 1;

message DataPoint {
string Value = 1;
string Ts = 2;
}
repeated DataPoint Dp = 2;
}
repeated DataPackage Data = 1;
}

message GetRequestMessage {
string Path = 1;
optional FilterExpressions Filter = 2;
optional string Authorization = 3;
optional string RequestId = 4;
}

message GetResponseMessage {
ResponseStatus Status = 1;
message SuccessResponseMessage {
optional DataPackages DataPack = 1;
optional string Metadata = 2; // replaces DataPack in static metadata and one dynamic metadata variant
}
optional SuccessResponseMessage SuccessResponse = 2;
optional ErrorResponseMessage ErrorResponse = 3;
optional string RequestId = 4;
string Ts = 5;
optional string Authorization = 6;
}

message SetRequestMessage {
string Path = 1;
string Value = 2;
optional string Authorization = 3;
optional string RequestId = 4;
}

message SetResponseMessage {
ResponseStatus Status = 1;
optional ErrorResponseMessage ErrorResponse = 2;
optional string RequestId = 3;
string Ts = 4;
optional string Authorization = 5;
}

message SubscribeRequestMessage {
string Path = 1;
optional FilterExpressions Filter = 2;
optional string Authorization = 3;
string RequestId = 4;
}

message SubscribeStreamMessage {
SubscribeResponseType MType = 1;
ResponseStatus Status = 2;

message SubscribeResponseMessage {
optional ErrorResponseMessage ErrorResponse = 1;
optional string SubscriptionId = 2;
string RequestId = 3;
string Ts = 4;
optional string Authorization = 5;
}
optional SubscribeResponseMessage Response = 3;

message SubscribeEventMessage {
string SubscriptionId = 1;
message SuccessResponseMessage {
DataPackages DataPack = 1;
}
optional SuccessResponseMessage SuccessResponse = 2;
optional ErrorResponseMessage ErrorResponse = 3;
string Ts = 4;
}
optional SubscribeEventMessage Event = 4;
}

message UnsubscribeRequestMessage {
string SubscriptionId = 1;
optional string RequestId = 2;
}

message UnsubscribeResponseMessage {
string SubscriptionId = 1;
ResponseStatus Status = 2;
optional ErrorResponseMessage ErrorResponse = 3;
optional string RequestId = 4;
string Ts = 5;
}
</code></pre>
</p>
</section>

<section id="encoding-and-decoding-with-protobuf">
<h2>Encoding and Decoding with Protobuf</h2>
<p>xxxxx<br>
<p>
The protobuf compiler uses the protobuf source code to generate an API to helper functions that can be used to implement the encoding and decoding
between JSON and the protobuf format for the various VISS messages.
The implementation of the encoding and the decoding is out-of-scope in this specification.
</p>
</section>

</section>
</section>


<section id="json-def">
<h2>JSON Schema Definitions</h2>
<p>
Expand Down

0 comments on commit 1bd9d14

Please sign in to comment.