Blazor app with can interface
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
931 B

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