OPCAttach2

OPCAttach2 — sets up an OPC connection.

Syntax

(OPCAttach2 label machine_name interface_name server_pattern domain point_pattern
 deadband_msec flags pollmsec read_method write_method (filters...))
    

Arguments

label

The name for this connection, as displayed in the OPC option of the Properties window.

machine_name

The name or IP address of the computer running the DataHub.

interface_name

Is either: "OPC Data Access 2.0" or "OPC Data Access 3.0". Currently only "OPC Data Access 2.0" is supported.

server_pattern

The name or IP address of the server computer. Wildcard characters are allowed.

domain

The data domain name.

point_pattern

A point name filter. Wildcard characters are allowed. Only leaf items that match this pattern will be visible in the DataHub. Normally you should specify * as the pattern.

deadband_msec

The maximum rate at which the server should send data to the client. In asynchronous advise mode, deadband_msec is transmitted to the server. The server limits the data rate to no more often than the deadband_msec. In polling modes, deadband_msec determines the polling rate.

flags

Any combination of:

    0x00000001 - PROPERTIES - Attempt to load item properties as items.

    0x00000002 - ENABLED - This connection is enabled.

    0x00000004 - AUTOITEMS - Tells the OPC DataHub to read the entire data set from the server.

    0x00000008 - READ_ONLY - Marks the connection as read-only. Data will not be transmitted from the OPC DataHub to the server.

    0x00000010 - MANUAL_ITEMS - Tells the OPC DataHub to connect to any manually configured items from the server.

    0x00000020 - OVERRIDE_TIME - Force the time stamp on incoming data from the server to the local time on the OPC DataHub's computer.

pollmsec

The number of milliseconds between reconnection attempts when trying to connect to a server.

read_method

An integer that specifies the method to use to read data from the OPC server. This can be one of:

    1 - Asynchronous Advise (DA2.0)

    2 - Synchronous Cache Read (DA2.0)

    3 - Asynchronous Read (DA2.0)

    7 - Synchronous Device Read (DA2.0)

write_method

An integer that specifies the method to use to read data from the OPC server. This can be one of:

    1 - Synchronous Write (DA2.0)

    2 - Asynchronous Write (DA2.0)

(filters...)

A space-separated list of filters, each one as a string, such as are entered in the Define OPC Server dialog of the OPC option of the Properties window. For example, here is what you would enter if you have:

    zero filters: ()

    one filter: ("filter1")

    two filters: ("filter1" "filter2")

    etc.

Returns

A message indicating success or error. Please refer to Return Syntax for details.

Description

This command lets you set up an OPC connection. It corresponds roughly to the Define OPC Server dialog box that you get when you click the Add button in the OPC option of the Properties window.