Interface IFrameCodec
Contract for framing and deframing messages over byte-stream transports (Serial, BLE, TCP).
Namespace: Wss.CoreModule
Assembly: WSS_Core_Interface.dll
Syntax
public interface IFrameCodec
Methods
Deframe(byte[])
Progressive deframer: feed any-size incoming chunks and get back zero or more
complete, unescaped frames. Each returned frame has the format
[sender][target][payload...][checksum] (END is consumed).
Declaration
IEnumerable<byte[]> Deframe(byte[] chunk)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | chunk | A raw byte chunk from the transport (may be partial or contain multiple frames). |
Returns
| Type | Description |
|---|---|
| IEnumerable<byte[]> | 0..N complete, unescaped frames (END removed). Checksum is not validated here. |
Frame(byte, byte, byte[])
Builds a wire-safe frame for transmission using SLIP-style escaping.
Output format (before escaping): [sender][target][payload...][checksum][END].
Declaration
byte[] Frame(byte sender, byte target, byte[] payload)
Parameters
| Type | Name | Description |
|---|---|---|
| byte | sender | Sender address byte. |
| byte | target | Target/receiver address byte (e.g., device address or broadcast). |
| byte[] | payload | The protocol payload (e.g., |
Returns
| Type | Description |
|---|---|
| byte[] | Escaped frame ready to send (always terminates with END). |