Skip to content

Commit

Permalink
Add FiFo to ArtRDM-Package from Revision DL
Browse files Browse the repository at this point in the history
work in progress on new FiFo
  • Loading branch information
patrick-dmxc committed Aug 28, 2024
1 parent 1fba20a commit 2c18aff
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions ArtNetSharp/Messages/ArtRDM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,34 @@ public sealed class ArtRDM : AbstractArtPacketNetAddressCommand<EArtRDMCommand>
public UID Destination => RDMMessage.DestUID;
public byte Transaction => RDMMessage.TransactionCounter;

public readonly byte FifoAvailable;
public readonly byte FifoMax;
public readonly byte[] Data;
public readonly RDMMessage RDMMessage;
public readonly ERDMVersion RdmVersion;
public ArtRDM(in PortAddress portAddress,
in RDMMessage rdmMessage,
in EArtRDMCommand command = EArtRDMCommand.ArProcess,
in ERDMVersion rdmVersion = ERDMVersion.STANDARD_V1_0,
in ushort protocolVersion = Constants.PROTOCOL_VERSION) : this(portAddress.Net, portAddress.Address, rdmMessage, command, rdmVersion, protocolVersion)
in ushort protocolVersion = Constants.PROTOCOL_VERSION,
in byte fifoAvailable = 0,
in byte fifoMax = 0) : this(portAddress.Net, portAddress.Address, rdmMessage, command, rdmVersion, protocolVersion, fifoAvailable, fifoMax)
{
}
public ArtRDM(in Net net,
in Address address,
in RDMMessage rdmMessage,
in EArtRDMCommand command = EArtRDMCommand.ArProcess,
in ERDMVersion rdmVersion = ERDMVersion.STANDARD_V1_0,
in ushort protocolVersion = Constants.PROTOCOL_VERSION) : base(net, address, command, protocolVersion)
in ushort protocolVersion = Constants.PROTOCOL_VERSION,
in byte fifoAvailable = 0,
in byte fifoMax = 0) : base(net, address, command, protocolVersion)
{
if (rdmMessage == null)
throw new ArgumentNullException(nameof(rdmMessage));


FifoAvailable= fifoAvailable;
FifoMax= fifoMax;
RDMMessage = rdmMessage;
RdmVersion = rdmVersion;
Data = RDMMessage.BuildMessage();
Expand All @@ -49,6 +57,9 @@ public ArtRDM(in byte[] packet) : base(packet)
{
RdmVersion = (ERDMVersion)packet[12];

FifoAvailable = packet[19];
FifoMax = packet[20];

Data = new byte[(packet.Length - 24) + 1];
Data[0] = 0xcc;
Array.Copy(packet, 24, Data, 1, Data.Length - 1);
Expand All @@ -66,8 +77,8 @@ protected sealed override void fillPacket(ref byte[] p)
//p[16] = 0; // Spare 3
//p[17] = 0; // Spare 4
//p[18] = 0; // Spare 5
//p[19] = 0; // Spare 6
//p[20] = 0; // Spare 7
p[19] = FifoAvailable; // FifoAvail
p[20] = FifoMax; // FifoMax
//p[21] = 0; // Net (done by Abstract part)
//p[22] = 0; // Command (done by Abstract part)
//p[23] = 0; // Address (done by Abstract part)
Expand All @@ -78,6 +89,8 @@ public override bool Equals(object obj)
{
return base.Equals(obj)
&& obj is ArtRDM other
&& FifoAvailable == other.FifoAvailable
&& FifoMax == other.FifoMax
&& RdmVersion == other.RdmVersion
&& Data.SequenceEqual(other.Data);
}
Expand Down

0 comments on commit 2c18aff

Please sign in to comment.