Files
BQP/srcs/RobotNet10/RobotApp/Communication/Sick.ColaB/Commands/CommandBase.cs
2026-07-13 09:25:40 +07:00

32 lines
795 B
C#

using System.Text;
namespace Sick.ColaB.Commands;
/// <summary>
/// Base class for ColaB commands
/// </summary>
public abstract class CommandBase(string commandString)
{
private readonly string _commandString = commandString ?? throw new ArgumentNullException(nameof(commandString));
private bool _wasSuccessful;
public ReadOnlyMemory<byte> GetCommandData()
{
return Encoding.ASCII.GetBytes(_commandString);
}
public bool WasSuccessful
{
get => _wasSuccessful;
protected set => _wasSuccessful = value;
}
public abstract bool ProcessReply(ReadOnlyMemory<byte> replyData);
/// <summary>
/// Gets the command string
/// </summary>
protected string CommandString => _commandString;
}