Skip to content

Commit

Permalink
Fix after Update
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-dmxc committed Feb 28, 2024
1 parent 0a0b9c7 commit e3a7270
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion ArtNetSharp/Messages/ArtPollReply.cs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ public ArtPollReply(in byte[] packet) : base(packet)
byte[] buffer = new byte[8];
for (int j = 0; j < 6; j++)
buffer[5 - j] = packet[218 + j];
DefaulRespUID = RDMUID.FromULong(BitConverter.ToUInt64(buffer, 0));
DefaulRespUID = new RDMUID(BitConverter.ToUInt64(buffer, 0));
}

if (length > 224) // 49 & 50 User
Expand Down
2 changes: 1 addition & 1 deletion ArtNetSharp/Messages/ArtRDMSub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public ArtRDMSub(in byte[] packet) : base(packet)
byte[] buffer = new byte[8];
for (int j = 0; j < 6; j++)
buffer[5 - j] = packet[14 + j];
UID = RDMUID.FromULong(BitConverter.ToUInt64(buffer, 0));
UID = new RDMUID(BitConverter.ToUInt64(buffer, 0));

CommandClass = packet[21];
ParameterId = (ushort)(packet[22] << 8 | packet[23]);
Expand Down
2 changes: 1 addition & 1 deletion ArtNetSharp/Messages/ArtTodData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public ArtTodData(in byte[] packet) : base(packet)
int index = 28 + (i * 6);
for (int j = 0; j < 6; j++)
buffer[5 - j] = packet[index + j];
RDMUID uid = RDMUID.FromULong(BitConverter.ToUInt64(buffer, 0));
RDMUID uid = new RDMUID(BitConverter.ToUInt64(buffer, 0));
uids.Add(uid);
}
this.Uids = uids.ToArray();
Expand Down
30 changes: 18 additions & 12 deletions ControlerRDMExample/RDMDeviceMock.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using ArtNetSharp;
using ArtNetSharp.Communication;
using RDMSharp;
using RDMSharp.ParameterWrapper;

namespace ControlerRDMExample
{
public abstract class AbstractRDMDeviceGeneratedMock : AbstractRDMDevice
public abstract class AbstractRDMDeviceGeneratedMock : AbstractGeneratedRDMDevice
{
internal static ControllerInstance Controller = ArtNet.Instance.Instances.OfType<ControllerInstance>().First();
public override bool IsGenerated => true;
public AbstractRDMDeviceGeneratedMock(RDMUID uid) : base(uid)
public AbstractRDMDeviceGeneratedMock(RDMUID uid, ERDM_Parameter[] parameters, string manufacturer = null) : base(uid, parameters, manufacturer)
{
Controller.ControllerRDMMessageReceived += Controller_ControllerRDMMessageReceived;
}
Expand All @@ -31,7 +31,7 @@ private async void Controller_ControllerRDMMessageReceived(object? sender, ArtNe
RDMMessage response = null;
try
{
response = await processRequestMessage(e.Request);
response = processRequestMessage(e.Request);
}
catch (Exception ex)
{
Expand All @@ -47,15 +47,21 @@ private async void Controller_ControllerRDMMessageReceived(object? sender, ArtNe
}
public class TestRDMDevice : AbstractRDMDeviceGeneratedMock
{
public TestRDMDevice(RDMUID uid) : base(uid)
public override EManufacturer ManufacturerID => (EManufacturer)0x9fff;
public override ushort DeviceModelID => 20;
public override ERDM_ProductCategoryCoarse ProductCategoryCoarse => ERDM_ProductCategoryCoarse.CONTROL;
public override ERDM_ProductCategoryFine ProductCategoryFine => ERDM_ProductCategoryFine.DATA_CONVERSION;
public override uint SoftwareVersionID => 0x1234;
public override string DeviceModelDescription => "Test Model Description";
public override bool SupportDMXAddress => true;

private static GeneratedPersonality[] PERSONALITYS = [new GeneratedPersonality(1, 5, "5CH RGB"), new GeneratedPersonality(2, 8, "8CH RGBAWY"), new GeneratedPersonality(3, 9, "9CH RGB 16-Bit")];
public override GeneratedPersonality[] Personalities => PERSONALITYS;
public TestRDMDevice(RDMUID uid) : base(uid, [ERDM_Parameter.IDENTIFY_DEVICE, ERDM_Parameter.BOOT_SOFTWARE_VERSION_LABEL], "Dummy Manufacturer 9FFF")
{
this.SetGeneratedParameterValue(ERDM_Parameter.DEVICE_INFO, new RDMDeviceInfo(dmx512StartAddress: 1, deviceModelId: 20, dmx512Footprint: 11, productCategoryCoarse: ERDM_ProductCategoryCoarse.CONTROL, productCategoryFine: ERDM_ProductCategoryFine.DATA_CONVERSION, softwareVersionId: 0x1234));
this.SetGeneratedParameterValue(ERDM_Parameter.IDENTIFY_DEVICE, false);
this.SetGeneratedParameterValue(ERDM_Parameter.DEVICE_MODEL_DESCRIPTION, "Test Model Description");
this.SetGeneratedParameterValue(ERDM_Parameter.DEVICE_LABEL, $"Test Device {uid}");
this.SetGeneratedParameterValue(ERDM_Parameter.MANUFACTURER_LABEL, $"Dummy Manufacturer");
this.SetGeneratedParameterValue(ERDM_Parameter.BOOT_SOFTWARE_VERSION_LABEL, $"Dummy Software");
this.SetGeneratedParameterValue(ERDM_Parameter.DMX_START_ADDRESS, (ushort)1);
this.DeviceLabel = "Dummy Device 1";
this.TrySetParameter(ERDM_Parameter.IDENTIFY_DEVICE, false);
this.TrySetParameter(ERDM_Parameter.BOOT_SOFTWARE_VERSION_LABEL, $"Dummy Software");
}
}
}

0 comments on commit e3a7270

Please sign in to comment.