35 lines
985 B
C#
35 lines
985 B
C#
namespace Sick.SafetyScanners.Cola2.Commands;
|
|
|
|
/// <summary>
|
|
/// Command to close a COLA2 session
|
|
/// </summary>
|
|
public sealed class CloseSessionCommand : CommandBase
|
|
{
|
|
public CloseSessionCommand()
|
|
: base(0x43, 0x58) // 'C' and 'X' in ASCII
|
|
{
|
|
}
|
|
|
|
public override bool CanBeExecutedWithoutSessionId => false;
|
|
|
|
protected override ReadOnlyMemory<byte> AddTelegramData()
|
|
{
|
|
// Close session command has no additional data
|
|
return ReadOnlyMemory<byte>.Empty;
|
|
}
|
|
|
|
protected override bool ProcessReplyInternal(ReadOnlyMemory<byte> replyData,
|
|
byte replyCommandType, byte replyCommandMode)
|
|
{
|
|
// Reply should be 'C' (0x43) and 'A' (0x41) for Acknowledge
|
|
if ((replyCommandType == 0x43 && replyCommandMode == 0x41) ||
|
|
(replyCommandType == 'C' && replyCommandMode == 'A'))
|
|
{
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|