BSL430.NET 1.2.1

Public Member Functions | Properties | Events | List of all members
RJCP.IO.Ports.Native.INativeSerial Interface Reference

Interface for accessing serial based streams. More...

Inheritance diagram for RJCP.IO.Ports.Native.INativeSerial:

## Public Member Functions
string [] | GetPortNames ()
| Gets an array of serial port names for the current computer. More...
PortDescription [] | GetPortDescriptions ()
| Gets an array of serial port names and descriptions for the current computer. More...
void | DiscardInBuffer ()
| Discards the input queue buffer of the driver. More...
void | DiscardOutBuffer ()
| Discards the output queue buffer of the driver. More...
void | GetPortSettings ()
| Gets the port settings and updates the properties of the object. More...
void | SetPortSettings ()
| Writes the settings of the serial port as set in this object. More...
void | Open ()
| Opens the serial port specified by PortName. More...
void | Close ()
| Closes the serial port. More...
SerialBuffer | CreateSerialBuffer (int readBuffer, int writeBuffer)
| Creates the serial buffer suitable for monitoring. More...
void | StartMonitor (SerialBuffer buffer, string name)
| Start the monitor thread, that will watch over the serial port. More...

## Properties
string | Version`[get]`
| Gets the version of the implementation in use. More...
string | PortName`[get, set]`
| Gets or sets the port device path. More...
int | BaudRate`[get, set]`
| Gets or sets the baud rate. More...
int | DataBits`[get, set]`
| Gets or sets the data bits. More...
Parity | Parity`[get, set]`
| Gets or sets the parity. More...
StopBits | StopBits`[get, set]`
| Gets or sets the stop bits. More...
bool | DiscardNull`[get, set]`
| Gets or sets a value if null bytes should be discarded or not. More...
byte | ParityReplace`[get, set]`
| Gets or sets the parity replace byte. More...
bool | TxContinueOnXOff`[get, set]`
| Gets or sets a value indicating whether transmission should still be sent when the input buffer is full and if the XOff character has been sent. More...
int | XOffLimit`[get, set]`
| Gets or sets the XOff limit input when the XOff character should be sent. More...
int | XOnLimit`[get, set]`
| Gets or sets the XOn limit when the input buffer is below when the XOn character should be sent. More...
bool | BreakState`[get, set]`
| Gets or sets the break state of the serial port. More...
int | DriverInQueue`[get, set]`
| Gets or sets the driver input queue size. More...
int | DriverOutQueue`[get, set]`
| Gets or sets the driver output queue size. More...
int | BytesToRead`[get]`
| Gets the number of bytes in the input queue of the driver not yet read (not any managed buffers). More...
int | BytesToWrite`[get]`
| Gets the number of bytes in the output buffer of the driver still to write (not any managed buffers). More...
bool | CDHolding`[get]`
| Gets the state of the Carrier Detect pin on the serial port. More...
bool | CtsHolding`[get]`
| Gets the state of the Clear To Send pin on the serial port. More...
bool | DsrHolding`[get]`
| Gets the state of the Data Set Ready pin on the serial port. More...
bool | RingHolding`[get]`
| Gets the state of the Ring Indicator pin on the serial port. More...
bool | DtrEnable`[get, set]`
| Gets or sets the Data Terminal Ready pin of the serial port. More...
bool | RtsEnable`[get, set]`
| Gets or sets the Request To Send pin of the serial port. More...
Handshake | Handshake`[get, set]`
| Gets or sets the handshake to use on the serial port. More...
bool | IsOpen`[get]`
| Gets a value indicating whether the serial port has been opened. More...
bool | IsRunning`[get]`
| Gets a value indicating whether the thread for monitoring the serial port is running. More...

## Events
EventHandler< SerialDataReceivedEventArgs > | DataReceived
| Occurs when data is received, or the EOF character is detected by the driver. More...
EventHandler< SerialErrorReceivedEventArgs > | ErrorReceived
| Occurs when an error condition is detected. More...
EventHandler< SerialPinChangedEventArgs > | PinChanged
| Occurs when modem pin changes are detected. More...

## Detailed Description

Interface for accessing serial based streams.

See also
  System.IDisposable

## Member Function Documentation

## ◆ Close()

void RJCP.IO.Ports.Native.INativeSerial.Close | ( |  | ) |

Closes the serial port.

Closing the serial port invalidates actions that can be done to the serial port, but it does not prevent the serial port from being reopened

Implemented in RJCP.IO.Ports.Native.WinNativeSerial, and RJCP.IO.Ports.Native.UnixNativeSerial.

## ◆ CreateSerialBuffer()

SerialBuffer RJCP.IO.Ports.Native.INativeSerial.CreateSerialBuffer | ( | int | readBuffer,
|  | int | writeBuffer
| ) |  |

Creates the serial buffer suitable for monitoring.

Parameters

  readBuffer | The read buffer size to allocate.
  writeBuffer | The write buffer size to allocate.

Returns
  A serial buffer object that can be given to StartMonitor

Implemented in RJCP.IO.Ports.Native.WinNativeSerial, and RJCP.IO.Ports.Native.UnixNativeSerial.

## ◆ DiscardInBuffer()

void RJCP.IO.Ports.Native.INativeSerial.DiscardInBuffer | ( |  | ) |

Discards the input queue buffer of the driver.

Implemented in RJCP.IO.Ports.Native.WinNativeSerial, and RJCP.IO.Ports.Native.UnixNativeSerial.

## ◆ DiscardOutBuffer()

void RJCP.IO.Ports.Native.INativeSerial.DiscardOutBuffer | ( |  | ) |

Discards the output queue buffer of the driver.

Implemented in RJCP.IO.Ports.Native.WinNativeSerial, and RJCP.IO.Ports.Native.UnixNativeSerial.

## ◆ GetPortDescriptions()

PortDescription [] RJCP.IO.Ports.Native.INativeSerial.GetPortDescriptions | ( |  | ) |

Gets an array of serial port names and descriptions for the current computer.

This method uses the Windows Management Interface to obtain its information. Therefore, the list may be different to the list obtained using the GetPortNames() method which uses other techniques.

On Windows 7, this method shows to return normal COM ports, but not those associated with a modem driver.

Returns
  An array of serial ports for the current computer.

Implemented in RJCP.IO.Ports.Native.UnixNativeSerial, and RJCP.IO.Ports.Native.WinNativeSerial.

## ◆ GetPortNames()

string [] RJCP.IO.Ports.Native.INativeSerial.GetPortNames | ( |  | ) |

Gets an array of serial port names for the current computer.

Returns
  An array of serial port names for the current computer.

Implemented in RJCP.IO.Ports.Native.UnixNativeSerial, and RJCP.IO.Ports.Native.WinNativeSerial.

## ◆ GetPortSettings()

void RJCP.IO.Ports.Native.INativeSerial.GetPortSettings | ( |  | ) |

Gets the port settings and updates the properties of the object.

Implemented in RJCP.IO.Ports.Native.WinNativeSerial, and RJCP.IO.Ports.Native.UnixNativeSerial.

## ◆ Open()

void RJCP.IO.Ports.Native.INativeSerial.Open | ( |  | ) |

Opens the serial port specified by PortName.

Opening the serial port does not set any settings (such as baud rate, etc.)

Implemented in RJCP.IO.Ports.Native.WinNativeSerial, and RJCP.IO.Ports.Native.UnixNativeSerial.

## ◆ SetPortSettings()

void RJCP.IO.Ports.Native.INativeSerial.SetPortSettings | ( |  | ) |

Writes the settings of the serial port as set in this object.

Implemented in RJCP.IO.Ports.Native.WinNativeSerial, and RJCP.IO.Ports.Native.UnixNativeSerial.

## ◆ StartMonitor()

void RJCP.IO.Ports.Native.INativeSerial.StartMonitor | ( | SerialBuffer | buffer,
|  | string | name
| ) |  |

Start the monitor thread, that will watch over the serial port.

Parameters

  buffer | The buffer structure that should be used to read data into and write data from.
  name | The name of the thread to use.

Implemented in RJCP.IO.Ports.Native.WinNativeSerial, and RJCP.IO.Ports.Native.UnixNativeSerial.

## Property Documentation

## ◆ BaudRate

int RJCP.IO.Ports.Native.INativeSerial.BaudRate
| get set

Gets or sets the baud rate.

The baud rate.

## ◆ BreakState

bool RJCP.IO.Ports.Native.INativeSerial.BreakState
| get set

Gets or sets the break state of the serial port.

`true` if in the break state; otherwise, `false`.

## ◆ BytesToRead

int RJCP.IO.Ports.Native.INativeSerial.BytesToRead
| get

Gets the number of bytes in the input queue of the driver not yet read (not any managed buffers).

The number of bytes in the driver queue for reading. If this value is not supported, zero is returned.

## ◆ BytesToWrite

int RJCP.IO.Ports.Native.INativeSerial.BytesToWrite
| get

Gets the number of bytes in the output buffer of the driver still to write (not any managed buffers).

The number of bytes in the driver queue for writing. If this value is not supported, zero is returned.

## ◆ CDHolding

bool RJCP.IO.Ports.Native.INativeSerial.CDHolding
| get

Gets the state of the Carrier Detect pin on the serial port.

`true` if carrier detect pin is active; otherwise, `false`.

## ◆ CtsHolding

bool RJCP.IO.Ports.Native.INativeSerial.CtsHolding
| get

Gets the state of the Clear To Send pin on the serial port.

`true` if the clear to send pin is active; otherwise, `false`.

## ◆ DataBits

int RJCP.IO.Ports.Native.INativeSerial.DataBits
| get set

Gets or sets the data bits.

The data bits.

## ◆ DiscardNull

bool RJCP.IO.Ports.Native.INativeSerial.DiscardNull
| get set

Gets or sets a value if null bytes should be discarded or not.

`true` if null bytes should be discarded; otherwise, `false`.

## ◆ DriverInQueue

int RJCP.IO.Ports.Native.INativeSerial.DriverInQueue
| get set

Gets or sets the driver input queue size.

The driver input queue size.

This method is typically available with Windows API only.

## ◆ DriverOutQueue

int RJCP.IO.Ports.Native.INativeSerial.DriverOutQueue
| get set

Gets or sets the driver output queue size.

The driver output queue size.

This method is typically available with Windows API only.

## ◆ DsrHolding

bool RJCP.IO.Ports.Native.INativeSerial.DsrHolding
| get

Gets the state of the Data Set Ready pin on the serial port.

`true` if data set ready pin is active; otherwise, `false`.

## ◆ DtrEnable

bool RJCP.IO.Ports.Native.INativeSerial.DtrEnable
| get set

Gets or sets the Data Terminal Ready pin of the serial port.

`true` if data terminal pin is active; otherwise, `false`.

This pin only has an effect if handshaking for DTR/DTS is disabled.

## ◆ Handshake

Handshake RJCP.IO.Ports.Native.INativeSerial.Handshake
| get set

Gets or sets the handshake to use on the serial port.

The handshake mode to use on the serial port.

## ◆ IsOpen

bool RJCP.IO.Ports.Native.INativeSerial.IsOpen
| get

Gets a value indicating whether the serial port has been opened.

`true` if this instance is open; otherwise, `false`.

This property only indicates if the port has been opened and that the internal handle is valid.

## ◆ IsRunning

bool RJCP.IO.Ports.Native.INativeSerial.IsRunning
| get

Gets a value indicating whether the thread for monitoring the serial port is running.

`true` if this instance is running; otherwise, `false`.

This property differs slightly from IsOpen, as this returns status if the monitoring thread for reading/writing data is actually running. If the thread is not running for whatever reason, we can expect no data updates in the buffer provided to StartMonitor(SerialBuffer, string).

## ◆ Parity

Parity RJCP.IO.Ports.Native.INativeSerial.Parity
| get set

Gets or sets the parity.

The parity.

## ◆ ParityReplace

byte RJCP.IO.Ports.Native.INativeSerial.ParityReplace
| get set

Gets or sets the parity replace byte.

The byte to use on parity errors.

## ◆ PortName

string RJCP.IO.Ports.Native.INativeSerial.PortName
| get set

Gets or sets the port device path.

The port device path.

## ◆ RingHolding

bool RJCP.IO.Ports.Native.INativeSerial.RingHolding
| get

Gets the state of the Ring Indicator pin on the serial port.

`true` if ring indicator state is active; otherwise, `false`.

## ◆ RtsEnable

bool RJCP.IO.Ports.Native.INativeSerial.RtsEnable
| get set

Gets or sets the Request To Send pin of the serial port.

`true` if [RTS enable]; otherwise, `false`.

This pin only has an effect if the handshaking for RTS/CTS is disabled.

## ◆ StopBits

StopBits RJCP.IO.Ports.Native.INativeSerial.StopBits
| get set

Gets or sets the stop bits.

The stop bits.

## ◆ TxContinueOnXOff

bool RJCP.IO.Ports.Native.INativeSerial.TxContinueOnXOff
| get set

Gets or sets a value indicating whether transmission should still be sent when the input buffer is full and if the XOff character has been sent.

`true` if transmission should continue after the input buffer is within XOffLimit bytes of being full and the driver has sent the XOff character; otherwise, `false` that transmission should stop and only continue when the input buffer is within XOnLimit bytes of being empty and the driver has sent the XOn character.

## ◆ Version

string RJCP.IO.Ports.Native.INativeSerial.Version
| get

Gets the version of the implementation in use.

The version of the implementation in use.

## ◆ XOffLimit

int RJCP.IO.Ports.Native.INativeSerial.XOffLimit
| get set

Gets or sets the XOff limit input when the XOff character should be sent.

The XOff buffer limit.

## ◆ XOnLimit

int RJCP.IO.Ports.Native.INativeSerial.XOnLimit
| get set

Gets or sets the XOn limit when the input buffer is below when the XOn character should be sent.

The XOn buffer limit.

## Event Documentation

## ◆ DataReceived

EventHandler<SerialDataReceivedEventArgs> RJCP.IO.Ports.Native.INativeSerial.DataReceived

Occurs when data is received, or the EOF character is detected by the driver.

## ◆ ErrorReceived

EventHandler<SerialErrorReceivedEventArgs> RJCP.IO.Ports.Native.INativeSerial.ErrorReceived

Occurs when an error condition is detected.

## ◆ PinChanged

EventHandler<SerialPinChangedEventArgs> RJCP.IO.Ports.Native.INativeSerial.PinChanged

Occurs when modem pin changes are detected.

The documentation for this interface was generated from the following file:

- C:/PROJECTS/C#/BSL430.NET/src/BSL430.NET/Library/serialportstream/2.1.4/src/Native/INativeSerial.cs