OPCAttach2 — sets up an OPC connection.
(OPCAttach2 label machine_name interface_name server_pattern domain
point_pattern deadband_msec flags pollmsec read_method
write_method (filters...) [connect_wait ready_wait])
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 instance.
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 instance.
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 DataHub instance
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 DataHub
instance to the server.
0x00000010 -
MANUAL_ITEMS - Tells the DataHub
instance 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 DataHub instance's computer.
pollmsec
The number of milliseconds between reconnection attempts when trying to connect to a server. This parameter is currently ignored.
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.
connect_wait
Optional. The number of milliseconds to pause after the connection
is made before continuing with the connection sequence. This gives
the server time to start up and construct its data set. If
specified, the connect_wait time has to
transpire before the DataHub instance first queries the server's data
set.
ready_wait
Optional. The maximum number of milliseconds to wait for the
server to report a ready state after the
connect_wait has expired. If the server
reports that it is ready before the
ready_wait time expires, the DataHub
instance will move on immediately to the next step in the connection
sequence. If not, then the full ready_wait
time will transpire before the DataHub instance queries the server's
data set.
A message indicating success or error. Please refer to Return Syntax for details.
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 button in the OPC option of the Properties window.