BSL430.NET  1.2.1
Public Member Functions | Properties | List of all members
RJCP.IO.Ports.Native.Windows.CommState Class Reference

Abstracts the Win32 API GetCommState() and SetCommState(). More...

Public Member Functions

 CommState (SafeFileHandle handle)
 Constructor for a DCB, prefilled with data from the handle provided. More...
 
void GetCommState ()
 Call Win32API to get the DCB for the current serial port object. More...
 
void SetCommState ()
 Call Win32API to set the DCB based on the current properties of this object. More...
 

Properties

bool? Binary [get, set]
 
int BaudRate [get, set]
 
bool? ParityEnable [get, set]
 
bool? OutCtsFlow [get, set]
 
bool? OutDsrFlow [get, set]
 
DtrControl DtrControl [get, set]
 
bool? DsrSensitivity [get, set]
 
bool? TxContinueOnXOff [get, set]
 
bool? OutX [get, set]
 
bool? InX [get, set]
 
byte XOnChar [get, set]
 
byte XOffChar [get, set]
 
bool? ErrorCharEnabled [get, set]
 
byte ErrorChar [get, set]
 
byte EventChar [get, set]
 
byte EofChar [get, set]
 
bool? Null [get, set]
 
RtsControl RtsControl [get, set]
 
bool? AbortOnError [get, set]
 
int XonLim [get, set]
 
int XoffLim [get, set]
 
int ByteSize [get, set]
 
Parity Parity [get, set]
 
StopBits StopBits [get, set]
 

Detailed Description

Abstracts the Win32 API GetCommState() and SetCommState().

Constructor & Destructor Documentation

◆ CommState()

RJCP.IO.Ports.Native.Windows.CommState.CommState ( SafeFileHandle  handle)

Constructor for a DCB, prefilled with data from the handle provided.

This constructor allocates space for a DCB (Device Control Block) and gets the state of the serial port provided by the handle. You can then update the DCB with the properties of this class and set them with the SetCommState() method.

Parameters
handleValid handle to a serial port object.

Member Function Documentation

◆ GetCommState()

void RJCP.IO.Ports.Native.Windows.CommState.GetCommState ( )

Call Win32API to get the DCB for the current serial port object.

Calls the Win32 native API to get the DCB for the current serial port object. This assumes that the handle is valid. The Operating System will check the handle for validity. If there are problems, the IOException() exception will be raised.

Exceptions
IOExceptionThe DCB could not be obtained.

◆ SetCommState()

void RJCP.IO.Ports.Native.Windows.CommState.SetCommState ( )

Call Win32API to set the DCB based on the current properties of this object.

Calls the Win32 native API to get the DCB for the current serial port object. This assumes that the handle is valid. The Operating System will check the handle for validity. If there are problems, the IOException() exception will be raised.

Exceptions
IOExceptionThe DCB could not be set. The reasons why the DCB cannot be set may be dependent on an invalid handle, or an invalid combination of data in the DCB.

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