Serial port helper.
Class instance accessor: SerialPort
More...
|
SerialPortHelper | WithName (string port) |
| Selects the serial port with the specified name.
|
|
bool | Connect () |
| Connects to the serial port (@115200bps).
|
|
bool | Connect (int baudRate, StopBits stopBits=StopBits.One, Parity parity=Parity.None) |
| Connects to the serial port at the specified speed.
|
|
SerialPortHelper | Disconnect () |
| Disconnects the serial port.
|
|
void | SendMessage (string message) |
| Sends a string message.
|
|
void | SendMessage (byte[] message) |
| Sends a raw data message.
|
|
SerialPortHelper | OnStringReceived (Action< string > receivedAction) |
| Sets the function to call when a new string message is received.
|
|
SerialPortHelper | OnMessageReceived (Action< byte[]> receivedAction) |
| Sets the function to call when a new raw message is received.
|
|
SerialPortHelper | OnStatusChanged (Action< bool > statusChangeAction) |
| Sets the function to call when the status of the serial connection changes.
|
|
|
bool | IsConnected [get] |
| Gets a value indicating whether the serial port is connected.
|
|
string | EndOfLine [get, set] |
| Gets or sets the end of line delimiter used in text messaging.
|
|
Serial port helper.
Class instance accessor: SerialPort
◆ WithName()
Selects the serial port with the specified name.
- Returns
- SerialPortHelper.
- Parameters
-
◆ Connect()
bool Connect |
( |
int |
baudRate, |
|
|
StopBits |
stopBits = StopBits::One , |
|
|
Parity |
parity = Parity::None |
|
) |
| |
Connects to the serial port at the specified speed.
- Parameters
-
baudRate | Baud rate. |
stopBits | Stop Bits. |
parity | Parity. |
◆ SendMessage() [1/2]
void SendMessage |
( |
string |
message | ) |
|
Sends a string message.
- Parameters
-
◆ SendMessage() [2/2]
void SendMessage |
( |
byte[] |
message | ) |
|
Sends a raw data message.
- Parameters
-
◆ OnStringReceived()
Sets the function to call when a new string message is received.
- Parameters
-
receivedAction | Function or inline delegate. |
◆ OnMessageReceived()
Sets the function to call when a new raw message is received.
- Parameters
-
receivedAction | Function or inline delegate. |
◆ OnStatusChanged()
Sets the function to call when the status of the serial connection changes.
- Parameters
-
statusChangeAction | Function or inline delegate. |
◆ IsConnected
Gets a value indicating whether the serial port is connected.
true
if connected; otherwise, false
.
◆ EndOfLine
Gets or sets the end of line delimiter used in text messaging.
The end of line.
The documentation for this class was generated from the following file: