TCnSerialPort Class

Represents a serial port resource.

Namespace: CNClrLib.Component.SerialPort
TComponent
  CNClrLib.Control.Base.TClrBaseComponent
    CNClrLib.Component.SerialPort.TCnSerialPort
type
 TCnSerialPort = class(TClrBaseComponent)
 end;

The TCnSerialPort type exposes the following members.

Show:
 NameDescription
Create(TComponent)

Creates and initializes a TCnSerialPort instance. (Overrides TClrBaseComponent.Create(TComponent).)

Destroy

Frees the resources allocated with a TCnSerialPort instance. (Overrides TClrBaseComponent.Destroy.)

Top
Show:
 NameDescription
BaseStream

Gets the underlying Stream object for a SerialPort object.

BaudRate

Gets or sets the serial baud rate.

BreakState

Gets or sets the break signal state.

BytesToRead

Gets the number of bytes of data in the receive buffer.

BytesToWrite

Gets the number of bytes of data in the send buffer.

CDHolding

Gets the state of the Carrier Detect line for the port.

CtsHolding

Gets the state of the Clear-to-Send line.

DataBits

Gets or sets the standard length of data bits per byte.

DefaultClrObject

Get the common language runtime object interface for this component. (Inherited from TClrBaseComponent.)

DiscardNull

Gets or sets a value indicating whether null bytes are ignored when transmitted between the port and the receive buffer.

DsrHolding

Gets the state of the Data Set Ready (DSR) signal.

DtrEnable

Gets or sets a value that enables the Data Terminal Ready (DTR) signal during serial communication.

Encoding

Gets or sets the byte encoding for pre- and post-transmission conversion of text.

Handshake

Gets or sets the handshaking protocol for serial port transmission of data using a value from Handshake.

IsOpen

Gets a value indicating the open or closed status of the SerialPort object.

NewLine

Gets or sets the value used to interpret the end of a call to the ReadLine() and WriteLine(String) methods.

Parity

Gets or sets the parity-checking protocol.

ParityReplace

Gets or sets the byte that replaces invalid bytes in a data stream when a parity error occurs.

PortName

Gets or sets the port for communications, including but not limited to all available COM ports.

ReadBufferSize

Gets or sets the size of the SerialPort input buffer.

ReadTimeout

Gets or sets the number of milliseconds before a time-out occurs when a read operation does not finish.

ReceivedBytesThreshold

Gets or sets the number of bytes in the internal input buffer before a OnDataReceived event occurs.

RtsEnable

Gets or sets a value indicating whether the Request to Send (RTS) signal is enabled during serial communication.

StopBits

Gets or sets the standard number of stopbits per byte.

WriteBufferSize

Gets or sets the size of the serial port output buffer.

WriteTimeout

Gets or sets the number of milliseconds before a time-out occurs when a write operation does not finish.

Top
Show:
 NameDescription
Close

Closes the port connection, sets the IsOpen property to false, and disposes of the internal Stream object.

DiscardInBuffer

Discards data from the serial driver's receive buffer.

DiscardOutBuffer

Discards data from the serial driver's transmit buffer.

Dispose

Releases the resources used by the Component. (Inherited from TClrBaseComponent.)

DoGetDefaultClrObject

Represents method DoGetDefaultClrObject. (Inherited from TClrBaseComponent.)

DoGetDotNetBaseComponent

Represents method DoGetDotNetBaseComponent. (Overrides TClrBaseComponent.DoGetDotNetBaseComponent.)

GetClrObject

Represents method GetClrObject. (Inherited from TClrBaseComponent.)

GetInfiniteTimeout

Indicates that no time-out should occur.

GetPortNames

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

Open

Opens a new serial port connection.

Read(TArray,Integer,Integer)

Overloaded. Reads a number of characters from the SerialPort input buffer and writes them into an array of characters at a given offset.

Read(TArray,Integer,Integer)

Overloaded. Reads a number of bytes from the SerialPort input buffer and writes those bytes into a byte array at the specified offset.

Read(_ByteArray,Integer,Integer)

Overloaded. Reads a number of bytes from the SerialPort input buffer and writes those bytes into a byte array at the specified offset.

Read(_CharArray,Integer,Integer)

Overloaded. Reads a number of characters from the SerialPort input buffer and writes them into an array of characters at a given offset.

ReadByte

Synchronously reads one byte from the SerialPort input buffer.

ReadChar

Synchronously reads one character from the SerialPort input buffer.

ReadExisting

Reads all immediately available bytes, based on the encoding, in both the stream and the input buffer of the SerialPort object.

ReadLine

Reads up to the NewLine value in the input buffer.

ReadTo(String)

Reads a string up to the specified value in the input buffer.

RegisterEventCallBack(ClrWString,Pointer)

Add an event to the instance using the specified event name and function pointer which is the event handler. The RegisterEventCallBack method does not directly add the event handler to the event. A hooking mechanism is used such that if the event is fired, the hook event is also fired which in turn calls the function pointer. (Inherited from TClrBaseComponent.)

RegisterEventSource

Register the Delphi object which will raise the .Net event handler. (Inherited from TClrBaseComponent.)

UnRegisterEventCallBack(ClrWString,Pointer)

Remove an event from the instance using the specified event name and function pointer which is the event handler. (Inherited from TClrBaseComponent.)

UnRegisterEventSource

Unregister the Delphi object which raised the .Net event handler. (Inherited from TClrBaseComponent.)

Write(String)

Overloaded. Writes the specified string to the serial port.

Write(TArray,Integer,Integer)

Overloaded. Writes a specified number of bytes to the serial port using data from a buffer.

Write(TArray,Integer,Integer)

Overloaded. Writes a specified number of characters to the serial port using data from a buffer.

Write(_ByteArray,Integer,Integer)

Overloaded. Writes a specified number of bytes to the serial port using data from a buffer.

Write(_CharArray,Integer,Integer)

Overloaded. Writes a specified number of characters to the serial port using data from a buffer.

WriteLine(String)

Writes the specified string and the NewLine value to the output buffer.

Top
Show:
 NameDescription
OnDataReceived

Indicates that data has been received through a port represented by the SerialPort object.

OnErrorReceived

Indicates that an error has occurred with a port represented by a SerialPort object.

OnPinChanged

Indicates that a non-data signal event has occurred on the port represented by the SerialPort object.

Top

See C:\Users\Public\Documents\CrystalNet Technologies\.Net VCL for Delphi Demo Folder after installation for examples of how to use this component.