namespace Sick.ColaB;
///
/// Abstract base class for SOPAS protocol sessions
/// Supports both ColaA (ASCII) and ColaB (Binary) protocols
///
public abstract class SopasSession : IDisposable
{
///
/// Gets whether the session is currently open
///
public abstract bool IsOpen { get; }
///
/// Gets the protocol type of this session
///
public abstract string ProtocolType { get; }
///
/// Opens the session (connects to scanner)
///
public abstract Task OpenAsync(int connectTimeoutMs, CancellationToken cancellationToken = default);
///
/// Closes the session (disconnects from scanner)
///
public abstract void Close();
///
/// Sends a SOPAS command and waits for reply
///
/// SOPAS command string (e.g., "sRN DeviceIdent", "sMN LMCstartmeas")
/// Command timeout in milliseconds
/// Cancellation token
/// Reply string from scanner
public abstract Task SendCommandAsync(string command, int timeoutMs, CancellationToken cancellationToken = default);
///
/// Receives a telegram from scanner (for event-based reception)
///
public abstract Task ReceiveTelegramAsync(int timeoutMs, CancellationToken cancellationToken = default);
///
/// Disposes the session
///
public abstract void Dispose();
}