using MultiTerm.Protocols.Types; namespace MultiTerm.Protocols; /// /// Interface to interact with a Communication protocol. /// public interface ICommunicationProtocol { /// /// Indicates the protocol type of the implementing class. /// ProtocolType ProtocolType { get; } /// /// Short identifier string that allows the user to distinguish different instances. /// string InstanceIdentifier { get; } /// /// New data received from connected device. /// event EventHandler? ReceivedDataEvent; /// /// New data sent to the connected device. /// event EventHandler? SentDataEvent; /// /// Thrown when the device disconnected. /// event EventHandler? DisconnectedEvent; /// /// Indicates wether the communication protocol is connected. /// True if connected and ready to receive data via , false if not. /// bool IsConnected { get; } /// /// Connect to the device. /// /// settings required to connect and use the protocol /// /// true if connected sucessfully or already connected, /// false if the provided settings are invalid or connection was unsuccessful /// bool Connect(IProtocolSettings settings); /// /// Disconnect from the device. Ends all internal activities. /// void Disconnect(); /// /// Send data to the connected device. /// /// data to send, as an array of bytes void SendBytes(byte[] bytes); }