Skip to content

Commit

Permalink
Websocket data compression support
Browse files Browse the repository at this point in the history
Signed-off-by: Ulf Bjorkengren <[email protected]>
  • Loading branch information
UlfBj committed Dec 12, 2024
1 parent 72ba6d7 commit d45f4f4
Show file tree
Hide file tree
Showing 8 changed files with 226 additions and 52 deletions.
5 changes: 3 additions & 2 deletions client/client-1.0/Javascript/appclient_commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Get request:
{"action":"get","path":"Server.Support.Protocol","requestId":"133"}
{"action":"get","path":"Vehicle.Chassis.AxleCount","requestId":"321"}

Get Request with request local data compression:
{"action":"get","path":"Vehicle.Speed", "dc":"2+0","requestId":"232"}
Get Request with data compression:
{"action":"get","path":"Vehicle.Speed", "dc":"2+1","requestId":"232"}


Get request for historic data:
Expand Down Expand Up @@ -43,6 +43,7 @@ Subscribe request:
{"action":"subscribe","path":"Vehicle/Cabin/Door/Row1/PassengerSide/IsOpen","filter":{"variant":"range","parameter":[{"logic-op":"gt","boundary":"500"},{"logic-op":"lt","boundary":"510"}]},"requestId":"265"}
{"action":"subscribe","path":"Vehicle.Powertrain.Transmission.Speed","filter":{"variant":"curvelog","parameter":{"maxerr":"2","bufsize":"100"}},"requestId":"275"}
{"action":"subscribe","path":"Vehicle","filter":[{"variant":"paths","parameter":["CurrentLocation.Latitude", "CurrentLocation.Longitude"]}, {"variant":"curvelog","parameter":{"maxerr":"0.00001","bufsize":"100"}}],"requestId":"285"}
{"action":"subscribe","path":"Vehicle.CurrentLocation","filter":[{"variant":"paths","parameter":["Latitude", "Longitude"]}, {"variant":"timebased","parameter":{"period":"3000"}}], "dc":"2+1","requestId":"286"}

Unsubscribe request:
{"action":"unsubscribe","subscriptionId":"1","requestId":"240"}
Expand Down
9 changes: 6 additions & 3 deletions client/client-1.0/compress_client/requests.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{"request":[{"action":"get","path":"Vehicle/Cabin/Door/Row1/DriverSide/IsOpen","requestId":"232"},{"action":"get","path":"Vehicle.Acceleration.Longitudinal","requestId":"233"},
{"action":"get","path":"Vehicle/ADAS","filter":{"type":"paths","parameter":["ABS/*","CruiseControl/Error"]},"requestId":"237"},
{"action":"subscribe","path":"Vehicle/Cabin/Door/Row1/PassengerSide/IsOpen","filter":{"type":"timebased","parameter":{"period":"3"}},"requestId":"246"}]}
{"request":[
{"action":"get","path":"Vehicle/Cabin/Door/Row1/DriverSide/IsOpen","requestId":"232"},{"action":"get","path":"Vehicle.Acceleration.Longitudinal","requestId":"233"},
{"action":"get","path":"Vehicle/ADAS","filter":{"variant":"paths","parameter":["ABS/*","CruiseControl/Error"]},"requestId":"237"},
{"action":"subscribe","path":"Vehicle/Cabin/Door/Row1/PassengerSide/IsOpen","filter":{"variant":"timebased","parameter":{"period":"3"}},"requestId":"246"},
{"action":"subscribe","path":"Vehicle.CurrentLocation","filter":[{"variant":"paths","parameter":["Latitude", "Longitude"]}, {"variant":"timebased","parameter":{"period":"3000"}}], "dc":"2+1","requestId":"286"}
]}
5 changes: 3 additions & 2 deletions client/client-1.0/grpc_client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ To run:

./grpc_client

The gRPC client UI provides a choice of four different request that can be issued:
The gRPC client UI provides a choice of four different request that can be issued, e.g.:

```
{"action":"get","path":"Vehicle/Chassis/Accelerator/PedalPosition","requestId":"232"}
{"action":"subscribe","path":"Vehicle/Speed","filter":{"type":"timebased","parameter":{"period":"100"}},"requestId":"246"}
{"action":"subscribe","path":"Vehicle/Speed","filter":{"varian":"timebased","parameter":{"period":"100"}},"requestId":"246"}
{"action":"unsubscribe","subscriptionId":"1","requestId":"240"}
{"action":"set", "path":"Vehicle/Body/Lights/IsLeftIndicatorOn", "value":"999", "requestId":"245"}
```
The commands can be changed in the source code, in the parameter commandList, followed by rebuilding.

These can be issued multiple times, but there is a limitation in that the unsubscribe has a static subscriptionID that only applies to the first started subscription.
20 changes: 10 additions & 10 deletions client/client-1.0/grpc_client/grpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,20 @@ func initCommandList() {

commandList[0] = `{"action":"get","path":"Vehicle/Speed","requestId":"232"}`
commandList[1] = `{"action":"set", "path":"Vehicle/Body/Lights/IsLeftIndicatorOn", "value":"true", "requestId":"245"}`
commandList[2] = `{"action":"subscribe","path":"Vehicle.Speed","filter":{"type":"curvelog","parameter":{"maxerr":"2","bufsize":"15"}},"requestId":"285"}`
/* commandList[2] = `{"action":"subscribe","path":"Vehicle","filter":[{"type":"paths","parameter":["Speed", "Chassis.Accelerator.PedalPosition"]},{"type":"timebased","parameter": {"period":"5000"}}],"requestId":"246"}`*/
commandList[3] = `{"action":"unsubscribe","subscriptionId":"X","requestId":"240"}` // X is replaced according to input
commandList[2] = `{"action":"subscribe","path":"Vehicle.CurrentLocation","filter":[{"variant":"paths","parameter":["Latitude", "Longitude"]}, {"variant":"timebased","parameter":{"period":"3000"}}], "dc":"2+1","requestId":"286"}`
commandList[3] = `{"action":"unsubscribe","subscriptionId":"X","requestId":"240"}` // X is replaced according to input, e.g. 23 sets X=2

/* different variants
commandList[2] = `{"action":"subscribe","path":"Vehicle","filter":[{"type":"paths","parameter":["Speed","CurrentLocation.Latitude", "CurrentLocation.Longitude"]}, {"type":"timebased","parameter":{"period":"100"}}],"requestId":"285"}`
commandList[1] = `{"action":"subscribe","path":"Vehicle/Speed","filter":{"type":"timebased","parameter":{"period":"100"}},"requestId":"246"}`
commandList[2] = `{"action":"subscribe","path":"Vehicle.Speed","filter":{"variant":"curvelog","parameter":{"maxerr":"2","bufsize":"15"}},"requestId":"285"}`
commandList[2] = `{"action":"subscribe","path":"Vehicle","filter":[{"variant":"paths","parameter":["Speed","CurrentLocation.Latitude", "CurrentLocation.Longitude"]}, {"variant":"timebased","parameter":{"period":"100"}}],"requestId":"285"}`
commandList[1] = `{"action":"subscribe","path":"Vehicle/Speed","filter":{"variant":"timebased","parameter":{"period":"100"}},"requestId":"246"}`
commandList[0] = `{"action":"get","path":"Vehicle/Cabin/Door/Row1/Right/IsOpen","requestId":"232"}`
commandList[0] = `{"action":"get","path":"Vehicle/Cabin/Door","filter":{"type":"paths","parameter":"*.*.IsOpen"},"requestId":"235"}`
commandList[1] = `{"action":"subscribe","path":"Vehicle/Cabin/Door/Row1/Right/IsOpen","filter":{"type":"timebased","parameter":{"period":"3000"}},"requestId":"246"}`
commandList[1] = `{"action":"subscribe","path":"Vehicle","filter":{"type":"paths","parameter":["Speed", "Chassis.Accelerator.PedalPosition"]},"requestId":"246"}`
commandList[0] = `{"action":"get","path":"Vehicle/Cabin/Door","filter":{"variant":"paths","parameter":"*.*.IsOpen"},"requestId":"235"}`
commandList[1] = `{"action":"subscribe","path":"Vehicle/Cabin/Door/Row1/Right/IsOpen","filter":{"variant":"timebased","parameter":{"period":"3000"}},"requestId":"246"}`
commandList[1] = `{"action":"subscribe","path":"Vehicle","filter":{"variant":"paths","parameter":["Speed", "Chassis.Accelerator.PedalPosition"]},"requestId":"246"}`
commandList[1] = `{"action":"subscribe","path":"Vehicle/Speed","requestId":"258"}`
commandList[1] = `{"action":"subscribe","path":"Vehicle","filter":[{"type":"paths","parameter":["Body.Lights.IsLeftIndicatorOn", "Chassis.Accelerator.PedalPosition"]}, {"type":"change","parameter":{"logic-op":"ne", "diff": "0"}}],"requestId":"285"}`
commandList[1] = {"action":"subscribe","path":"Vehicle","filter":{"type":"paths","parameter":["Speed", "Chassis.Accelerator.PedalPosition"]},"requestId":"246"}`
commandList[1] = `{"action":"subscribe","path":"Vehicle","filter":[{"variant":"paths","parameter":["Body.Lights.IsLeftIndicatorOn", "Chassis.Accelerator.PedalPosition"]}, {"variant":"change","parameter":{"logic-op":"ne", "diff": "0"}}],"requestId":"285"}`
commandList[1] = {"action":"subscribe","path":"Vehicle","filter":{"variant":"paths","parameter":["Speed", "Chassis.Accelerator.PedalPosition"]},"requestId":"246"}`
*/
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,27 @@ Server.Support.Security:
Server.Support.Filter:
type: attribute
datatype: string[]
default: ["timebased", "change", "range", "curvelog", "paths"]
default: ["timebased", "change", "range", "curvelog", "paths", "metadata"]
description: List of supported filter features.

Server.Support.Encoding:
type: attribute
datatype: string[]
default: ["protobuf"]
description: List of supported payload encoding features.

Server.Support.Filetransfer:
type: attribute
datatype: string[]
default: ["upload", "download"]
description: List of supported file transfer features.

Server.Support.DataCompression:
type: attribute
datatype: string[]
default: ["2+1"]
description: List of supported data compression features.

Server.Config:
type: branch
description: Top branch declaring the configuration of server supported features.
Expand All @@ -64,6 +82,22 @@ Server.Config.Protocol.Websocket:
type: branch
description: Top branch for the server supported Websocket protocol.

Server.Config.Protocol.Websocket.FileTransfer:
type: branch
description: Websocket filetransfer.

Server.Config.Protocol.Websocket.FileTransfer.Mode:
type: attribute
datatype: string[]
default: ["upload", "download"]
description: Websocket protocol port number for the primary payload format.

Server.Config.Protocol.Websocket.FileTransfer.PortNum:
type: attribute
datatype: uint32
default: 8002
description: Websocket protocol port number for the primary payload format.

Server.Config.Protocol.Websocket.Primary:
type: branch
description: Websocket configuration for the primary payload format.
Expand All @@ -78,10 +112,11 @@ Server.Config.Protocol.Websocket.Protobuf:
type: branch
description: Websocket configuration for the protobuf encoded payload format.

Server.Config.Protocol.Websocket.Protobuf.PortNum:
Server.Config.Protocol.Websocket.Protobuf.SubProtocol:
type: attribute
datatype: uint32
description: Websocket protocol port number for the protobuf encoded payload format.
datatype: string
default: "VISS-protoenc"
description: Websocket sub-protocol for the protobuf encoded payload format.

Server.Config.Protocol.Mqtt:
type: branch
Expand Down Expand Up @@ -122,6 +157,7 @@ Server.Config.Protocol.Grpc.Protobuf:
Server.Config.Protocol.Grpc.Protobuf.PortNum:
type: attribute
datatype: uint32
default: 5443
description: gRPC port number for the protobuf encoded payload format.

Server.Config.AccessControl:
Expand Down
Binary file modified server/vissv2server/forest/server.binary
Binary file not shown.
Loading

0 comments on commit d45f4f4

Please sign in to comment.