FTSPCControl Class

This class contains the core functionality to access serial port.

Methods

Open/Close
CloseCloses previously opened communication port.
OpenOpens specified serial port and sets up its parameters.
SetSettingsFromStringSets serial port settings from the string.
Serial Ports Enumeration
EnumSerialPortsRefreshes information about serial ports and returns their number.
GetSerialPortRetrieves string value of serial port name.
GetSerialPortDescriptionRetrieves string description of serial port.
Read/Write
ReadReads specified number of bytes from serial port.
ReadArrayReads specified number of bytes from serial port to array.
ReadArrayOverlappedPerforms an asynchronous read operation (overlapped) into safe array of bytes.
ReadOverlappedPerforms an asynchronous read operation (overlapped).
WriteWrites specified number of bytes to serial port.
WriteArrayWrites specified number of bytes from array to serial port.
WriteArrayOverlappedPerforms an asynchronous write operation (overlapped) of safe array data.
WriteOverlappedPerforms an asynchronous write operation (overlapped).
Other Methods
CancelIOCancels all pending I/O operations.
FlushForces a write all buffered data for the FIFO and waits for completion.
PurgeQueuePurges input or/and output queue(s).
SetBreakSuspends/restores character transmission.

Properties

Port Configuration
BaudRateBaud rate serial port communication parameter.
DataBitsByte size serial port communications parameter. One of FTSPCDataBits values.
FlowControlHandshaking state. One of FTSPCFlowControl values.
ParitySpecifies if parity checking is enabled. If TRUE, parity checking is performed and errors are reported
PortNameName of the serial port.
StopBitsNumber of stop bits to be used. Stop bits separate each unit of data on an asynchronous serial connection. They are also sent continuously when no data is available for transmission. Refer to FTSPCStopBits.
Line Signals
CtsCTS (clear-to-send) signal state.
DcdRLSD (receive-line-signal-detect) signal state.
DsrDSR (data-set-ready) signal state.
DtrDTR (data-terminal-ready) signal state.
RingState of the RING line.
RtsRTS (request-to-send) signal state.
Timeouts
ReadIntervalTimeoutThe maximum time allowed to elapse between the arrival of two bytes on the communications line, in milliseconds. During a Read operation, the time period begins when the first byte is received. If the interval between the arrival of any two bytes exceeds this amount, the Read operation is completed and any buffered data is returned. A value of zero indicates that interval time-outs are not used.
ReadTotalTimeoutConstantA constant used to calculate the total time-out period for read operations, in milliseconds. For each read operation, this value is added to the product of the ReadTotalTimeoutMultiplier and the requested number of bytes.
ReadTotalTimeoutMultiplierThe multiplier used to calculate the total time-out period for read operations, in milliseconds. For each read operation, this value is multiplied by the requested number of bytes to be read.
WriteTotalTimeoutConstantA constant used to calculate the total time-out period for write operations, in milliseconds. For each write operation, this value is added to the product of the WriteTotalTimeoutMultiplier and the requested number of bytes.
WriteTotalTimeoutMultiplierThe multiplier used to calculate the total time-out period for write operations, in milliseconds. For each write operation, this value is multiplied by the number of bytes to be written.
Special Characters
EofCharSpecifies the value of the character used to signal the end of data.
ErrorCharSpecifies the value of the character used to replace bytes received with a parity error.
EventCharSpecifies the value of the character used to signal an event.
XoffCharValue of the XOFF character for both transmission and reception. XOFF is a software control to stop the transmission of data (whereas RTS and CTS are hardware controls). XON resumes the transmission.
XonCharValue of the XON character for both transmission and reception. XON is a software control to resume the transmission of data (whereas RTS and CTS are hardware controls). XOFF stops the transmission.
Other Properties
AutoOpenOpen COM port automatically, without calling Open method.
DiscardNullGets or sets a value indicating whether null bytes are ignored when transmitted between the port and the receive buffer.
InQUsedBytesThe current number of bytes in the input queue.
IsOpenedRetrieves whether serial port is open.
RxThresholdNumber of the bytes received from the COM port that fires OnReceive event. RxThreshold is set to 1 by default.

Events

OnBreakThis event is triggered when a break signal is detected in the received input.
OnCtsThis event is triggered when a change of the CTS signal is detected.
OnDcdThis event is triggered when a change of the DCD signal is detected.
OnDsrThis event is triggered when a change of the DSR signal is detected.
OnErrorThis event is triggered when a line-status error occurs.
OnEventCharThis event is triggered when the event character was received and placed in the input buffer. The event character is specified in EventChar property.
OnPortLostThis event is triggered when a COM port is removed while it is opened (e.g. using USB to Serial cable).
OnReceiveThis event occurs when data is received on the serial port.
OnRingThis event is triggered when a change of the RING signal is detected.
OnTransmitThis event is triggered when data has been sucessfully written to the serial port.