General¶
The messaging protocol is based on protobuf messages. There is no signaling for switching between encrypted and unencrypted communication.
Frame Format 1¶
---
title: "Example Frame"
config:
packet:
bitsPerRow: 8
bitWidth: 128
---
packet-beta
0: "Preamble"
1: "Length"
2-7: "Data"
| Part | Bits | Description | Example |
|---|---|---|---|
| Preamble | 1 | Marker bit which states if unencrypted (0x00) or encrypted (0x01) |
0x00 |
| Length | 1-5 | Variable Message Length according to VarInt Specification (encrypted frames ignore the spec and always use 2 bytes) | 0x16 or 0xFFFFFFFFFF |
| Data | 0-34,359,738,367 | Encrypted or unencrypted Packet |
Attention: Unencrypted Frames Length is calculated without the Packet type byte!
Packet¶
---
title: "Example Packet"
---
packet-beta
0-1: "Type"
2-31: "Message"
| Part | Description | Example |
|---|---|---|
| Type | Internal number for identifying the proto message => Link to custom mapping | 0x01 (HelloMessage) |
| Message | Content |
Example Communication¶
sequenceDiagram
Client->>Api: HelloRequest
Api->>Client: HelloResponse
Client->>Api: DisconnectRequest
Client->>Api: ConnectRequest
Api->>Client: ConnectResponse
Client->>Api: DeviceInfoRequest
Api->>Client: DeviceInfoResponse
Client->>+Api: ListEntitiesRequest
Api->>Client: ListEntitiesSensorResponse
Api->>Client: ListEntitiesBinarySensorResponse
Api->>-Client: ListEntitiesDoneResponse
loop Keep Alive Messaging
Client->>Api: PingRequest
Api->>Client: PingResponse
end
Client->>Api: DisconnectRequest
Api->>Client: DisconnectResponse
Unencrypted to Encrypted Handover¶
sequenceDiagram
Client->>Api: HelloRequest (unencrypted)
Api->>Client: DisconnectResponse (encrypted)
Client->>Api: HelloRequest (encrypted)
Api->>Client: HelloResponse (encrypted)
%% ...