Class LorawanDefragmenter
A fragmentation session being put back together, TS004-2.0.0 appendix A.2.
public sealed class LorawanDefragmenter : IDisposable
- Inheritance
-
LorawanDefragmenter
- Implements
- Inherited Members
Remarks
The uncoded fragments go straight into the block. A coded fragment is reduced against everything already known and kept only if it says something new, so the working memory is sized by the losses rather than by the block.
Constructors
LorawanDefragmenter(ushort, byte, ushort)
Opens a session for a block of nbFrag fragments.
public LorawanDefragmenter(ushort nbFrag, byte fragSize, ushort maxLost)
Parameters
nbFragushortHow many uncoded fragments the block was cut into.
fragSizebyteHow many bytes each fragment carries.
maxLostushortThe most uncoded fragments to be able to solve for, which decides how much working memory the session takes.
Exceptions
- PamojaException
The session is not one this build runs.
Properties
Done
Whether the whole block is there.
public bool Done { get; }
Property Value
Missing
How many uncoded fragments are still missing.
public ushort Missing { get; }
Property Value
Received
How many fragments arrived, coded, uncoded and repeated.
public ushort Received { get; }
Property Value
Methods
Block()
The block, as far as it has been put back together, padding and all.
public byte[] Block()
Returns
- byte[]
The block.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Fragment(ushort, ReadOnlySpan<byte>)
Takes one fragment of the session, counting from one.
public bool Fragment(ushort n, ReadOnlySpan<byte> data)
Parameters
nushortWhich fragment.
dataReadOnlySpan<byte>Its bytes.
Returns
- bool
trueonce the block is whole.
Exceptions
- PamojaException
The fragment is not one of this session, or the session ran out of memory to solve with.
MatrixLength(ushort, ushort)
The working memory a session of this shape takes, in bytes.
public static int MatrixLength(ushort nbFrag, ushort maxLost)
Parameters
nbFragushortHow many uncoded fragments the block was cut into.
maxLostushortHow many of them the session can solve for.
Returns
- int
The byte count the session allocates for itself.