C# Class CyrusBuilt.MonoPi.IO.Serial.Rs232SerialPort

Provides access to the RS232 UARTs (serial port) on the Raspberry Pi.
Inheritance: IDisposable
Show file Open project: cyrusbuilt/MonoPi Class Usage Examples

Public Methods

Method Description
Close ( ) : void

Close this instance.

Dispose ( ) : void

Releases all resource used by the CyrusBuilt.MonoPi.IO.Serial.Rs232SerialPort object.

Call Dispose when you are finished using the CyrusBuilt.MonoPi.IO.Serial.Rs232SerialPort. The Dispose method leaves the CyrusBuilt.MonoPi.IO.Serial.Rs232SerialPort in an unusable state. After calling Dispose, you must release all references to the CyrusBuilt.MonoPi.IO.Serial.Rs232SerialPort so the garbage collector can reclaim the memory that the CyrusBuilt.MonoPi.IO.Serial.Rs232SerialPort was occupying.

GetBytesAvailable ( ) : Int32

Gets the bytes available to be read.

GetCharacter ( ) : Char

Gets a single character from the serial device.

Open ( ) : void

Opens the serial port.

Open ( String device, BaudRates baud ) : void

Open the specified device with the specified BAUD rate.

PutChar ( Char c ) : void

Sends a single character to the port.

PutString ( String s ) : void

Sends a string to the port.

Rs232SerialPort ( ) : System

Initializes a new instance of the CyrusBuilt.MonoPi.IO.Serial.Rs232SerialPort class. This is the default constructor.

Rs232SerialPort ( BaudRates baud ) : System

Initializes a new instance of the CyrusBuilt.MonoPi.IO.Serial.Rs232SerialPort class with the BAUD rate to negotiate.

Rs232SerialPort ( String device ) : System

Initializes a new instance of the CyrusBuilt.MonoPi.IO.Serial.Rs232SerialPort class with the device to open.

Rs232SerialPort ( String device, BaudRates baud ) : System

Initializes a new instance of the CyrusBuilt.MonoPi.IO.Serial.Rs232SerialPort class with the device path and the BAUD rate to negotiate.

Write ( Byte val ) : void

Writes a single byte to the port.

Method Details

Close() public method

Close this instance.
public Close ( ) : void
return void

Dispose() public method

Releases all resource used by the CyrusBuilt.MonoPi.IO.Serial.Rs232SerialPort object.
Call Dispose when you are finished using the CyrusBuilt.MonoPi.IO.Serial.Rs232SerialPort. The Dispose method leaves the CyrusBuilt.MonoPi.IO.Serial.Rs232SerialPort in an unusable state. After calling Dispose, you must release all references to the CyrusBuilt.MonoPi.IO.Serial.Rs232SerialPort so the garbage collector can reclaim the memory that the CyrusBuilt.MonoPi.IO.Serial.Rs232SerialPort was occupying.
public Dispose ( ) : void
return void

GetBytesAvailable() public method

Gets the bytes available to be read.
/// This instance has been disposed and is no longer usable. ///
public GetBytesAvailable ( ) : Int32
return System.Int32

GetCharacter() public method

Gets a single character from the serial device.
/// This instance has been disposed and is no longer usable. /// /// The port is not open. ///
public GetCharacter ( ) : Char
return Char

Open() public method

Opens the serial port.
/// This instance has been disposed and is no longer usable. /// /// The port is already open. ///
public Open ( ) : void
return void

Open() public method

Open the specified device with the specified BAUD rate.
/// This instance has been disposed and is no longer usable. /// /// The serial port is already open. ///
public Open ( String device, BaudRates baud ) : void
device String /// The path to the serial port device to open. ///
baud BaudRates /// The BAUD rate to negotiate. ///
return void

PutChar() public method

Sends a single character to the port.
/// This instance has been disposed and is no longer usable. /// /// The port is closed. ///
public PutChar ( Char c ) : void
c Char /// The character to send to the port. ///
return void

PutString() public method

Sends a string to the port.
/// This instance has been disposed and is no longer usable. /// /// The port is closed. ///
public PutString ( String s ) : void
s String /// The string to send to the port. ///
return void

Rs232SerialPort() public method

Initializes a new instance of the CyrusBuilt.MonoPi.IO.Serial.Rs232SerialPort class. This is the default constructor.
public Rs232SerialPort ( ) : System
return System

Rs232SerialPort() public method

Initializes a new instance of the CyrusBuilt.MonoPi.IO.Serial.Rs232SerialPort class with the BAUD rate to negotiate.
public Rs232SerialPort ( BaudRates baud ) : System
baud BaudRates /// The BAUD rate to negotiate (default is , /// which is 9600 BAUD). ///
return System

Rs232SerialPort() public method

Initializes a new instance of the CyrusBuilt.MonoPi.IO.Serial.Rs232SerialPort class with the device to open.
public Rs232SerialPort ( String device ) : System
device String /// The device path to open (default is "/dev/ttyAMA0"). ///
return System

Rs232SerialPort() public method

Initializes a new instance of the CyrusBuilt.MonoPi.IO.Serial.Rs232SerialPort class with the device path and the BAUD rate to negotiate.
public Rs232SerialPort ( String device, BaudRates baud ) : System
device String /// The device path to open (default is "/dev/ttyAMA0"). ///
baud BaudRates /// The BAUD rate to negotiate (default is , /// which is 9600 BAUD). ///
return System

Write() public method

Writes a single byte to the port.
/// This instance has been disposed and is no longer usable. /// /// The port is closed. ///
public Write ( Byte val ) : void
val Byte /// The byte to write. ///
return void