using System.IO.Ports; namespace Server.Services { /// /// Interface for serial communication services /// public interface ISerialCommunicationService { /// /// Gets all available serial ports on the system /// /// Array of port names string[] GetAvailablePorts(); /// /// Opens and configures a serial port /// /// Name of the port to open /// Baud rate for communication /// Parity setting /// Stop bits setting /// Handshake setting /// True if port opened successfully Task OpenPortAsync(string portName, int baudRate, Parity parity, StopBits stopBits, Handshake handshake); /// /// Closes the currently opened port /// Task ClosePortAsync(); /// /// Sends a CAT command to the radio /// /// CAT command string to send /// Response from the radio, if any Task SendCommandAsync(string command); /// /// Gets the status of the current port connection /// /// True if port is open and connected bool IsPortOpen(); /// /// Gets the name of the currently opened port /// /// Port name or null if no port is open string? GetCurrentPortName(); } }