namespace IOModuleTestBlazor.Services;
public interface ISerialPortService
{
bool IsOpen { get; }
string PortName { get; }
/// Returns available COM port names.
IReadOnlyList GetPortNames();
/// Opens the specified port at the given baud rate.
void Open(string portName, int baudRate);
/// Closes the port if open.
void Close();
/// Sends a line to the port (appends \r\n).
void WriteLine(string command);
/// Returns buffered terminal lines (last 200, oldest first).
/// Each line is prefixed with "> " (sent) or "< " (received).
IReadOnlyList GetLines();
/// Clears the line buffer.
void ClearLines();
/// Fired on the SerialPort receive thread when new lines arrive.
event Action? DataReceived;
}