Interface ISerialProtocol
Protocol interface for Brainboxes Ethernet-to-Serial devices (ES-series).
Provides encoding-aware send/receive methods for text-based serial communication.
Implements System.ICloneable so that each Brainboxes.IO.BBSerialPort on a
multi-port device gets its own protocol instance with independent state.
Assembly: Brainboxes.IO.dll
View Source
public interface ISerialProtocol : IProtocol, ICloneable
Properties
Encoding
The character encoding used to send and receive data. Default is UTF-8.
View Source
Encoding Encoding { get; }
DataAvailable
Indicates whether data is available to read. Returns 0 if no data, or a positive value indicating bytes are available.
View Source
int DataAvailable { get; }
Methods
Send(string)
Sends a message string through the serial port, encoded with Brainboxes.IO.ISerialProtocol.Encoding. The terminating characters are appended automatically.
View Source
void Send(string message)
Parameters
| Type | Name | Description |
|---|---|---|
System.String | message | The text message to send. |
Exceptions
System.InvalidOperationException
The device is not connected.
Receive()
Receives a message from the serial port, decoded with Brainboxes.IO.ISerialProtocol.Encoding. Blocks until the terminating characters are received or the timeout expires.
View Source
string Receive()
Returns
System.String: The received message string with terminating characters stripped.
Exceptions
System.InvalidOperationException
The device is not connected.
System.TimeoutException
No complete response received within the timeout period.