Initial commit
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using Sick.SafetyScanners.DataStructures;
|
||||
using Sick.SafetyScanners.Helpers;
|
||||
|
||||
namespace Sick.SafetyScanners.DataProcessing;
|
||||
|
||||
/// <summary>
|
||||
/// Parser for DeviceStatus response from COLA2 variable command
|
||||
/// Thread-safe implementation
|
||||
/// </summary>
|
||||
public sealed class ParseDeviceStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// Parses the device status from a TCP sequence (COLA2 response)
|
||||
/// Matches: ParseDeviceStatusData::parseTCPSequence in C++
|
||||
/// </summary>
|
||||
public DeviceStatus ParseTcpSequence(PacketBuffer buffer)
|
||||
{
|
||||
var span = buffer.GetBufferSpan();
|
||||
return new DeviceStatus
|
||||
{
|
||||
Status = (SopasDeviceStatus)ReadDeviceStatus(span)
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Matches: ParseDeviceStatusData::readDeviceStatus in C++
|
||||
/// </summary>
|
||||
private byte ReadDeviceStatus(ReadOnlySpan<byte> span)
|
||||
{
|
||||
return ReadWriteHelper.ReadUint8(span, 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user