BSL430.NET  1.2.1
Public Member Functions | Protected Member Functions | Properties | Events | List of all members
RJCP.IO.Ports.Native.UnixNativeSerial Class Reference

Windows implementation for a Native Serial connection. More...

Inheritance diagram for RJCP.IO.Ports.Native.UnixNativeSerial:
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...
 
void Dispose ()
 Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. More...
 

Protected Member Functions

virtual void OnDataReceived (object sender, SerialDataReceivedEventArgs args)
 
virtual void OnCommError (object sender, SerialErrorReceivedEventArgs args)
 
virtual void OnPinChanged (object sender, SerialPinChangedEventArgs args)
 
virtual void Dispose (bool disposing)
 Releases unmanaged and - optionally - managed resources. 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...
 
- Properties inherited from RJCP.IO.Ports.Native.INativeSerial
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< SerialDataReceivedEventArgsDataReceived
 Occurs when data is received, or the EOF character is detected by the driver. More...
 
EventHandler< SerialErrorReceivedEventArgsErrorReceived
 Occurs when an error condition is detected. More...
 
EventHandler< SerialPinChangedEventArgsPinChanged
 Occurs when modem pin changes are detected. More...
 
- Events inherited from RJCP.IO.Ports.Native.INativeSerial
EventHandler< SerialDataReceivedEventArgsDataReceived
 Occurs when data is received, or the EOF character is detected by the driver. More...
 
EventHandler< SerialErrorReceivedEventArgsErrorReceived
 Occurs when an error condition is detected. More...
 
EventHandler< SerialPinChangedEventArgsPinChanged
 Occurs when modem pin changes are detected. More...
 

Detailed Description

Windows implementation for a Native Serial connection.

See also
RJCP.IO.Ports.Native.INativeSerial

Member Function Documentation

◆ Close()

void RJCP.IO.Ports.Native.UnixNativeSerial.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

Implements RJCP.IO.Ports.Native.INativeSerial.

◆ CreateSerialBuffer()

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

Creates the serial buffer suitable for monitoring.

Parameters
readBufferThe read buffer size to allocate.
writeBufferThe write buffer size to allocate.
Returns
A serial buffer object that can be given to StartMonitor

Implements RJCP.IO.Ports.Native.INativeSerial.

◆ DiscardInBuffer()

void RJCP.IO.Ports.Native.UnixNativeSerial.DiscardInBuffer ( )

Discards the input queue buffer of the driver.

Implements RJCP.IO.Ports.Native.INativeSerial.

◆ DiscardOutBuffer()

void RJCP.IO.Ports.Native.UnixNativeSerial.DiscardOutBuffer ( )

Discards the output queue buffer of the driver.

Implements RJCP.IO.Ports.Native.INativeSerial.

◆ Dispose() [1/2]

void RJCP.IO.Ports.Native.UnixNativeSerial.Dispose ( )

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

◆ Dispose() [2/2]

virtual void RJCP.IO.Ports.Native.UnixNativeSerial.Dispose ( bool  disposing)
protectedvirtual

Releases unmanaged and - optionally - managed resources.

Parameters
disposingtrue to release both managed and unmanaged resources; false to release only unmanaged resources.

◆ GetPortDescriptions()

PortDescription [] RJCP.IO.Ports.Native.UnixNativeSerial.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.

Implements RJCP.IO.Ports.Native.INativeSerial.

◆ GetPortNames()

string [] RJCP.IO.Ports.Native.UnixNativeSerial.GetPortNames ( )

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

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

Implements RJCP.IO.Ports.Native.INativeSerial.

◆ GetPortSettings()

void RJCP.IO.Ports.Native.UnixNativeSerial.GetPortSettings ( )

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

Implements RJCP.IO.Ports.Native.INativeSerial.

◆ Open()

void RJCP.IO.Ports.Native.UnixNativeSerial.Open ( )

Opens the serial port specified by PortName.

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

Implements RJCP.IO.Ports.Native.INativeSerial.

◆ SetPortSettings()

void RJCP.IO.Ports.Native.UnixNativeSerial.SetPortSettings ( )

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

Implements RJCP.IO.Ports.Native.INativeSerial.

◆ StartMonitor()

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

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

Parameters
bufferThe buffer structure that should be used to read data into and write data from.
nameThe name of the thread to use.

Implements RJCP.IO.Ports.Native.INativeSerial.

Property Documentation

◆ BaudRate

int RJCP.IO.Ports.Native.UnixNativeSerial.BaudRate
getset

Gets or sets the baud rate.

The baud rate.

◆ BreakState

bool RJCP.IO.Ports.Native.UnixNativeSerial.BreakState
getset

Gets or sets the break state of the serial port.

true if in the break state; otherwise, false.

◆ BytesToRead

int RJCP.IO.Ports.Native.UnixNativeSerial.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.UnixNativeSerial.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.UnixNativeSerial.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.UnixNativeSerial.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.UnixNativeSerial.DataBits
getset

Gets or sets the data bits.

The data bits.

◆ DiscardNull

bool RJCP.IO.Ports.Native.UnixNativeSerial.DiscardNull
getset

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.UnixNativeSerial.DriverInQueue
getset

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.UnixNativeSerial.DriverOutQueue
getset

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.UnixNativeSerial.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.UnixNativeSerial.DtrEnable
getset

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.UnixNativeSerial.Handshake
getset

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.UnixNativeSerial.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.UnixNativeSerial.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.UnixNativeSerial.Parity
getset

Gets or sets the parity.

The parity.

◆ ParityReplace

byte RJCP.IO.Ports.Native.UnixNativeSerial.ParityReplace
getset

Gets or sets the parity replace byte.

The byte to use on parity errors.

◆ PortName

string RJCP.IO.Ports.Native.UnixNativeSerial.PortName
getset

Gets or sets the port device path.

The port device path.

◆ RingHolding

bool RJCP.IO.Ports.Native.UnixNativeSerial.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.UnixNativeSerial.RtsEnable
getset

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.UnixNativeSerial.StopBits
getset

Gets or sets the stop bits.

The stop bits.

◆ TxContinueOnXOff

bool RJCP.IO.Ports.Native.UnixNativeSerial.TxContinueOnXOff
getset

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.UnixNativeSerial.Version
get

Gets the version of the implementation in use.

The version of the implementation in use.

◆ XOffLimit

int RJCP.IO.Ports.Native.UnixNativeSerial.XOffLimit
getset

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

The XOff buffer limit.

◆ XOnLimit

int RJCP.IO.Ports.Native.UnixNativeSerial.XOnLimit
getset

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.UnixNativeSerial.DataReceived

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

◆ ErrorReceived

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

Occurs when an error condition is detected.

◆ PinChanged

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

Occurs when modem pin changes are detected.


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