Multiprocotol Terminalprogram (BAT)
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.
MultiTerm/MultiTerm.Protocols/ICommunicationProtocol.cs

48 lines
1.4 KiB

namespace MultiTerm.Protocols;
/// <summary>
/// Interface to interact with a Communication protocol.
/// </summary>
public interface ICommunicationProtocol
{
/// <summary>
/// Contains settings that are required to connect using this communication protocol.
/// </summary>
ProtocolConnectionSettingsViewModel? ConnectionSettings { get; }
/// <summary>
/// Newline sequence to add on the end when sending a message using <see cref="SendBytes(byte[])"/>.
/// </summary>
string NewlineSequenceOnSend { get; }
/// <summary>
/// When this sequence is detected while reading, a new line is introduced.
/// </summary>
string NewlineOnReceivedSequence { get; }
/// <summary>
/// New data received from connected device.
/// </summary>
event EventHandler<ReceivedDataEventArgs>? ReceivedDataEvent;
/// <summary>
/// New data sent to the connected device.
/// </summary>
event EventHandler<SentDataEventArgs>? SentDataEvent;
/// <summary>
/// Connect to the device.
/// </summary>
void Connect();
/// <summary>
/// Disconnect from the device. Ends all internal activities.
/// </summary>
void Disconnect();
/// <summary>
/// Send data to the connected device.
/// </summary>
/// <param name="bytes">data to send, as an array of bytes</param>
void SendBytes(byte[] bytes);
}