Files
tbf/TBF/Rig/TestMethods/iPerlCommunication/communication/C4/wiredProtocol/TouchReadResponse.cs
T
2026-03-12 14:50:47 +01:00

34 lines
858 B
C#

using System;
namespace TBF.Rig.TestMethods.iPerlCommunication.communication.C4.wiredProtocol
{
public sealed class TouchReadResponse
{
public byte Control { get; }
public byte Status { get; }
public byte[] Payload { get; }
public bool IsOk => Status == 0x01;
public TouchReadResponse(byte control, byte status, byte[] payload)
{
Control = control;
Status = status;
Payload = payload ?? Array.Empty<byte>();
}
public string GetAsciiPayload()
{
if (Payload.Length == 0)
return null;
int length = Array.IndexOf(Payload, (byte)0x00);
if (length < 0)
length = Payload.Length;
return System.Text.Encoding.ASCII.GetString(Payload, 0, length);
}
}
}