Class DataPacketMessage
- Namespace
- NominalSystems.Messages
- Assembly
- NominalSystems.Messages.dll
Message that stores information about a particular packet within a sequence of packets. This packet will contain some data in a form of raw bytes and will also have a header information including the name of the object that was decoded, the packet number and the index of the next packet. If there are no next packets, this will be recorded as an invalid index. The packet also includes a checksum that can be used to evaluate if any errors exist before the decoding is made.
public class DataPacketMessage : Message<DataPacketPayload>
- Inheritance
-
Message<DataPacketPayload>DataPacketMessage
- Inherited Members
-
Message<DataPacketPayload>.PayloadMessage<DataPacketPayload>.ToString()Message<DataPacketPayload>.PayloadTypeMessage<DataPacketPayload>.PayloadObject
Constructors
DataPacketMessage()
Default constructor for the Data Packet message. By default, the size is 1KB.
public DataPacketMessage()
DataPacketMessage(int)
Creates a new data packet message of a fixed size and initialises all of the bytes in the array to zero.
public DataPacketMessage(int size)
Parameters
size
intThe number of bytes in the packet
Properties
Checksum
The checksum specifies the number of 1s that exist within the data message and can be used to ensure the data has not been altered due to bit-flipping error models.
[Units("-")]
public int Checksum { get; set; }
Property Value
Data
The raw data of the packet, stored in bytes. The first byte in the data array is the first byte used for the packet.
[Units("-")]
public byte[] Data { get; set; }
Property Value
- byte[]
DataSize
The size of the data that exists in the packet in number of bytes. This has a minimum value of 8 bytes.
[Units("B")]
public int DataSize { get; }
Property Value
LastByte
The index of the last byte of the data. If -1, then the last valid byte is the end of the byte array.
[Units("B")]
public int LastByte { get; set; }
Property Value
Name
The name of the object that was created to ensure that the packets of the objects line up. This is calculated using the Type.GetType().Name parameter and does not include the namespace FullName property.
[Units("-")]
public string Name { get; set; }
Property Value
NextPacket
The index of the next packet that is connected. If less than 0, this is the final packet of the sequence.
[Units("-")]
public int NextPacket { get; set; }
Property Value
PacketNumber
The current index of the packet number that is in this sequence. This must be unique within the sequence.
[Units("-")]
public int PacketNumber { get; set; }