Files
Aperio_Control_Centre/Aperio_Control_Centre.Aadp/Commands/DeviceStates/KeyCylinderStateResult.cs
Martijn Scheepers 5961276657 Restructure aadp
2025-08-13 15:13:22 +02:00

45 lines
1.4 KiB
C#

using Aperio_Control_Centre.Aadp.Types;
using Aperio_Control_Centre.Aadp.Types.ApplicationTypes;
using System.Text;
namespace Aperio_Control_Centre.Aadp.Commands.DeviceStates
{
public class KeyCylinderStateResult : CommandIdBase, IPduCommand
{
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.KeyCylinderStateResult;
public Enumerations.KeyCylinderState State { get; set; }
public KeyCylinderStateResult() { }
public void Deserialize(ref byte[] arr, ref int idx)
{
DeviceGroupId = new Id(ref arr, ref idx);
State = (Enumerations.KeyCylinderState)PrimitiveType.DeserializeEnum(ref arr, ref idx);
}
public void Serialize(ref List<byte> arr)
{
ArgumentNullException.ThrowIfNull(arr);
new VariableLengthQuantity((uint)PDUType).Serialize(ref arr);
DeviceGroupId.Serialize(ref arr);
arr.AddRange(PrimitiveType.SerializeEnum((short)State));
}
public string LogString()
{
StringBuilder sb = new();
DeviceGroupId.LogString(ref sb);
sb.Append(" State-'");
sb.Append(State.ToString());
sb.Append('\'');
return sb.ToString();
}
public override string ToString()
{
return PDUType.ToString();
}
}
}