Initial commit
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user