ConnectToComPort

async function ConnectToComPort(ctx: any, vendorId?: number, productId?: number)

The asynchronous function ConnectToComPort is used to establish a connection between the browser and a serial interface. The query can be pre-filtered using the vendor and product ID. When the function is executed, a query window opens in which a port can be chosen. If successful, the connected port is returned.

ConnectToComPort 1:

If the port is already connected, this is indicated in the pop-up by the message "Paired".

ConnectToComPort 2:

Browser compatibility

The function is only compatible with Google Chrome and Microsoft Edge.

Parameter

Name

Type

Description

ctx

any, Context

Asynchronous context object

vendorId

number

Optional: The vendor ID is used to filter the choice of ports according to specific vendors.

productId

number

Optional: The product ID is used to filter the selection of ports according to specific products.

Return value

Type

Description

Navigator.Serial.SerialPort

Port object from the Serial class.

NuGet package: Beckhoff.TwinCAT.HMI.Plastic.RFID

Available: from version 12.14.0

Usage: TC3 Plastic Application HMI projects