Helper Class Reference  1.1
HomeGenie - Automation Programs' Engine SDK
Public Member Functions | Properties | List of all members
SerialPortHelper Class Reference

Serial port helper.
Class instance accessor: SerialPort More...

Public Member Functions

SerialPortHelper WithName (string port)
 Selects the serial port with the specified name. More...
 
bool Connect ()
 Connect the serial port (@115200bps). More...
 
bool Connect (int baudRate, StopBits stopBits=StopBits.One, Parity parity=Parity.None)
 Connect the serial port at the specified speed. More...
 
SerialPortHelper Disconnect ()
 Disconnects the serial port. More...
 
void SendMessage (string message)
 Sends a string message. More...
 
void SendMessage (byte[] message)
 Sends a raw data message. More...
 
SerialPortHelper OnStringReceived (Action< string > receivedAction)
 Sets the function to call when a new string message is received. More...
 
SerialPortHelper OnMessageReceived (Action< byte[]> receivedAction)
 Sets the function to call when a new raw message is received. More...
 
SerialPortHelper OnStatusChanged (Action< bool > statusChangeAction)
 Sets the function to call when the status of the serial connection changes. More...
 

Properties

bool IsConnected [get]
 Gets a value indicating whether the serial port is connected. More...
 
string EndOfLine [get, set]
 Gets or sets the end of line delimiter used in text messaging. More...
 

Detailed Description

Serial port helper.
Class instance accessor: SerialPort

Member Function Documentation

SerialPortHelper WithName ( string  port)

Selects the serial port with the specified name.

Returns
SerialPortHelper.
Parameters
portPort name.
bool Connect ( )

Connect the serial port (@115200bps).

bool Connect ( int  baudRate,
StopBits  stopBits = StopBits.One,
Parity  parity = Parity.None 
)

Connect the serial port at the specified speed.

Parameters
baudRateBaud rate.
stopBitsStop Bits.
parityParity.
SerialPortHelper Disconnect ( )

Disconnects the serial port.

void SendMessage ( string  message)

Sends a string message.

Parameters
messageMessage.
void SendMessage ( byte[]  message)

Sends a raw data message.

Parameters
messageMessage.
SerialPortHelper OnStringReceived ( Action< string >  receivedAction)

Sets the function to call when a new string message is received.

Parameters
receivedActionFunction or inline delegate.
SerialPortHelper OnMessageReceived ( Action< byte[]>  receivedAction)

Sets the function to call when a new raw message is received.

Parameters
receivedActionFunction or inline delegate.
SerialPortHelper OnStatusChanged ( Action< bool >  statusChangeAction)

Sets the function to call when the status of the serial connection changes.

Parameters
statusChangeActionFunction or inline delegate.

Property Documentation

bool IsConnected
get

Gets a value indicating whether the serial port is connected.

true if connected; otherwise, false.

string EndOfLine
getset

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: