Class SlipDecoder
Reassembles whole SLIP frames from the chunks a serial port delivers.
public sealed class SlipDecoder : IDisposable
- Inheritance
-
SlipDecoder
- Implements
- Inherited Members
Examples
using var decoder = new SlipDecoder();
foreach (byte[] frame in decoder.Feed(chunk)) Handle(frame);
Remarks
A corrupt frame does not throw, because the frames around it are still good; it is dropped and counted on Discarded.
Constructors
SlipDecoder()
Creates an empty decoder, ready for the first chunk.
public SlipDecoder()
Exceptions
- PamojaException
The native decoder could not be created.
Properties
Discarded
How many corrupt frames this decoder has discarded.
public ulong Discarded { get; }
Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Feed(ReadOnlySpan<byte>)
Feeds a chunk of the stream.
public byte[][] Feed(ReadOnlySpan<byte> chunk)
Parameters
chunkReadOnlySpan<byte>The bytes just read from the port.
Returns
- byte[][]
Every frame this chunk completed, in order, which is often none.
Exceptions
- PamojaException
The native call failed.
Reset()
Discards any partly assembled frame.
public void Reset()