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