OPC UA I/O Function Library

Introduction

The OPC UA I/O Dynamic Link Library for Microsoft Windows serves as a drop-in replacement for OPC Office Link’s RisOpcIO library for OPC DA Classic. Use the library in your own applications to very quickly communicate with OPC UA servers to read or write data. Follow these steps to use the OPC UA I/O library instead of the RisOpcIO library.

  1. Install Dataristix
    Run the Dataristix installer on the machine where you want to use the OPC UA I/O library and ensure that that the OPC UA Connector is included. The OPC UA I/O library is installed together with the OPC UA connector.
  2. Activate your license
    Follow the license activation steps to activate the Dataristix installation.
  3. Add OPC UA server(s)
    Use the Dataristix Desktop application to add OPC UA servers that you wish to communicate with. As usually required for OPC UA clients, you will need to create or import an Dataristix application certificate and ensure that the OPC UA server trusts the Dataristix certificate and vice versa. If your OPC UA server requires authentication then you will need to allow Dataristix to store credentials for use by the OPC UA I/O library.
  4. Map data points
    The RisOpcIO library addresses OPC DA servers by name (the ‘Program ID’) or by name, GUID (globally unique identifier) and host name if a remote OPC server is used; data points are identified by the OPC Item ID. In contrast, the OPC UA I/O library identifies OPC UA servers by the name given to the OPC UA server in the Dataristix Desktop application and the data points are identified by an expanded form of the OPC UA Node ID that includes the namespace URI (see the following sections for a further explanation). You need to identify the OPC UA data points that correspond to the OPC DA data points used in the RisOpcIO library and then replace OPC DA server names with OPC UA server names and OPC DA Item IDs with corresponding OPC UA Node IDs. This, of course, assumes that the same underlying data points are accessible by OPC UA servers.
  5. Reference the OPC UA I/O library
    The OPC UA I/O library is call-compatible with the RisOpcIO library and you can reference the ‘Rensen.Dataristix.OpcUa.IO.dll’ instead of the ‘RisOpcIo.dll’. Please also read: Referencing the library.

Note

Note that the OPC UA I/O library is available in 32-bit and 64-bit versions. Like the original RisOpcIO library the OPC UA library uses ANSI OPC server names, group names and single item IDs for compatibility. Please contact support@rensen.io for Unicode versions. Note also that the OPCCopy function is no longer supported.

Install location

The name of the OPC UA I/O library file is “Rensen.Dataristix.OpcUa.IO.dll”.

The default install location for the 32-bit library is:

C:\Program Files\Rensen\Dataristix\Services\modules\OPC UA Connector\service\x86

And the default install location for the 64-bit library is:

C:\Program Files\Rensen\Dataristix\Services\modules\OPC UA Connector\service\x64

Referencing the library

There are two options for referencing the library in applications:

  1. Copy library files
    Copy all files from the install location of the library into the folder of your application executable and call library functions without the need to call “OPCInitialize”.
  2. Reference install location
    When referencing the function library files in the install location then call “OPCInitialize” at least once before any other library function is called (this ensures that dependencies can be resolved). Failing to do so may result in the termination for the application.

In either case the OPC UA connector must be installed on the same computer.

If you are using Excel then you may want to reference the install location, include the full path in function declarations and add the library folder as a trusted location in Excel’s Trust Center. You need to call “OPCInitialize” at least once as the first library function call. “OPCInitialize” can be called multiple times and you may call “OPCInitialize” before each function call or call it once at a suitable time, for example, in the workbook’s “Open” event. If added as the workbook’s “Open” event then save and re-open the spreadsheet so that the event is triggered before developing other functionality. Example:

Option Explicit

Private Sub Workbook_Open()

    Dim r As Integer

    r = OPCLibInitialize()
    MsgBox "OPC Initialized"

End Sub

You can find Excel function declarations for Excel 32-bit and Excel 64-bit versions at the end of the section.

OPC UA I/O Functions

Function signatures

The following function signatures are suitable for use in, for example, Microsoft Excel VBA modules. Other programming languages that allow loading of an external DLL module may use the OPC UA I/O library by using their own language specific signatures. The function signatures in this sections omit the full path to the respective function library (see install location).

Function results

All functions return an Integer error code, the error codes are listed at the end of the chapter. An error code of zero means that the function call was successful. Many functions take the OPC UA server name as a parameter. This is the OPC UA server name that you see in the Dataristix Desktop application window.

Passing OPC UA Node IDs

OPC UA Servers identify individual nodes by a namespace URI and a further identifier. While an OPC Client has a session with an OPC server a namespace index can be used instead of the URI, however, between OPC server re-starts or between client sessions, the OPC server’s namespace indices may change and a persistent reference to an OPC UA node must therefore contain the namespace URI and not the namespace index. The OPC UA I/O library therefore expects definition of OPCNodeIds as a string in the form

nsu=namespaceUri;i=1234

The i element refers to a numeric identifier. Other valid OPC UA identifiers (i.e. s for string identifers, g for GUID identifiers and b for opaque identifers are also acceptable)

Tip

Use the OPCLockServer and OPCUnlockServer functions for any repeated read or write operations to avoid re-establishing OPC UA client sessions for each call.

OPC Library Initialization

OPCInitialize

This function needs to be called at least once if the library files are not stored in the same folder as the application executable. The first call to OPCInitialize must occur before any other library function is called. Failure to do so may result in the termination of the application.

Public Declare Function OPCInitialize Lib "Rensen.Dataristix.OpcUa.IO.dll" () As Integer

OPC Item Functions

OPCRead

This function reads the specified OPCNodeId from the specified OPC server. If the function succeeds, then the value read is stored in Value.

Public Declare Function OPCRead Lib "Rensen.Dataristix.OpcUa.IO.dll" (
    ByVal OPCServerName As String,
    ByVal OPCNodeId As String,
    ByRef Value As Variant
) As Integer

OPCWrite

The function writes Value to the specified OPCNodeId using the specified OPC server. To maintain backwards compatibility, data types of values to be written are automatically converted to the target type of the OPC UA item. Dataristix determines the target type by first reading the data type from the OPC UA server; these data types are then cached for future calls during the OPC server session. For repeated calls to “OPCWrite” it is therefore recommended to enclose write operations in “OPCLockServer” and “OPCUnlockServer” calls to keep the server session and the data type cache alive.

Public Declare Function OPCWrite Lib "Rensen.Dataristix.OpcUa.IO.dll" (
    ByVal OPCServerName As String,
    ByVal OPCNodeId As String,
    ByRef Value As Variant
) As Integer

OPCCopy

This function is not supported in the OPC UA I/O library and will always return an unspecified error.

Public Declare Function OPCCopy Lib "Rensen.Dataristix.OpcUa.IO.dll" (
    ByVal OPCServerName As String,
    ByVal OPCNodeId As String
) As Integer

OPC Server Functions

These functions manage OPC server connections. Call the OPCGetLastError function after a library function has returned an error code to obtain additional error information. Note that OPCLockServer simply keeps a connection to the OPC server alive; other OPC clients can still access the OPC server as usual.

OPCLockServer

If you intend to read and write a number of OPC items, call this function to keep an OPC server connection alive for faster execution. A call to OPCLockServer must be followed by OPCUnlockServer when the read/write operations are done.

Public Declare Function OPCLockServer Lib "Rensen.Dataristix.OpcUa.IO.dll" (
    ByVal OPCServerName As String
) As Integer

OPCUnlockServer

OPCUnlockServer releases an OPC server connection previously locked in memory by OPCLockServer.

Public Declare Function OPCUnlockServer Lib "Rensen.Dataristix.OpcUa.IO.dll" (
    ByVal OPCServerName As String
) As Integer

OPCLockRemoteServer

The function is maintained for backward compatibility. The GuidStr and RemoteHostName parameters are ignored and the function behaves like OPCLockServer.

Public Declare Function OPCLockRemoteServer Lib "Rensen.Dataristix.OpcUa.IO.dll" (
    ByVal OPCServerName As String,
    ByVal GuidStr As String,
    ByVal RemoteHostName As String
) As Integer

OPCUnlockRemoteServer

The function is maintained for backward compatibility and behaves like OPCUnlockServer.

Public Declare Function OPCUnlockRemoteServer Lib "Rensen.Dataristix.OpcUa.IO.dll" (
    ByVal OPCServerName As String
) As Integer

OPCGetLastError

Call this function in case any of the other functions has returned an error. This will retrieve additional error information (if available).

Public Declare Function OPCGetLastError Lib "Rensen.Dataristix.OpcUa.IO.dll" (
    ByVal OPCServerName As String,
    ByRef ErrorMsg As Variant
) As Integer

OPC Group Functions

OPC group functions allow efficient reading or writing of multiple items over a period of time.

OPCAddGroup

Use this function to create a group containing multiple items. Before you can add groups to the OPC server identified by OPCServerName, you must call OPCLockServer or OPCLockRemoteServer for the OPC server. The OPCGroupName can be any name of your choice; the name is used to identify the group in other functions. The OPCNodeIds must be passed as a variant containing an array of string-type variants (the string identifying the OPC item); this data type corresponds directly to the Excel Range value type.

Public Declare Function OPCAddGroup Lib "Rensen.Dataristix.OpcUa.IO.dll" (
    ByVal OPCServerName As String,
    ByVal OPCGroupName As String,
    ByRef OPCNodeIds As Variant
) As Integer

OPCReadGroup

Call this function to read values for all items within a group. You must have previously called OPCAddGroup with a group name of OPCGroupName. Values is a variant that contains an array of variants (OPC item values read are stored into these variants); this data type corresponds directly to the Excel Range value type.

Public Declare Function OPCReadGroup Lib "Rensen.Dataristix.OpcUa.IO.dll" (
    ByVal OPCGroupName As String,
    ByRef Values As Variant
) As Integer

OPCWriteGroup

Call this function to write values for all items within a group. You must have previously called OPCAddGroup with a group name of OPCGroupName. Values are passed as a variant that contains an array of variants (containing the values to write); this data type corresponds directly to the Excel Range value type.

To maintain backwards compatibility, data types of values to be written are automatically converted to the target type of the OPC UA item. Dataristix determines the target type by first reading data types from the OPC UA server; these data types are then cached for future calls during the OPC server session. For repeated calls to “OPCWriteGroup” it is therefore recommended to enclose write operations in “OPCLockServer” and “OPCUnlockServer” calls to keep the server session and the data type cache alive.

Public Declare Function OPCWriteGroup Lib "Rensen.Dataristix.OpcUa.IO.dll" (
    ByVal OPCGroupName As String,
    ByRef Values As Variant
) As Integer

OPCRemoveGroup

Call this function when the group is no longer needed, passing the group name as a parameter.

Public Declare Function OPCRemoveGroup Lib "Rensen.Dataristix.OpcUa.IO.dll" (
    ByVal OPCGroupName As String
) As Integer

OPCGroupEnableCacheReads

By default the OPCReadGroup function requests data synchronously from the OPC server. By calling OPCGroupEnableCacheReads the OPC server is asked to check for data updates in regular intervals (as given by CacheUpdateRateMilliSeconds) and then send data only when it changes. An internal cache is maintained to keep the latest data available for requests. Subsequently, calls to OPCReadGroup will read OPC item values from the internal cache instead of sending requests to the OPC server. Enabling cache reads can be very efficient if group values are read on a regular basis.

Public Declare Function OPCGroupEnableCacheReads Lib "Rensen.Dataristix.OpcUa.IO.dll" (
    ByVal OPCGroupName As String,
    ByVal CacheUpdateRateMilliSeconds As Integer
) As Integer

OPCGroupDisableCacheReads

This function disables cache reads for the group referenced by OPCGroupName and subsequent calls to OPCReadGroup will query the OPC Server synchronously.

Public Declare Function OPCGroupDisableCacheReads Lib "Rensen.Dataristix.OpcUa.IO.dll" (
    ByVal OPCGroupName As String
) As Integer

Extended Functions

OPCReadEx

Similar to OPCRead; this function additionally returns the quality and timestamp of the item. OPC UA status information is converted to a corresponding OPC DA quality value and results are therefore backward compatible with the “RisOpcIO” library.

Public Declare Function OPCReadEx Lib "Rensen.Dataristix.OpcUa.IO.dll" (
    ByVal OPCServerName As String,
    ByVal OPCNodeId As String,
    ByRef Value As Variant,
    ByRef Quality As Variant,
    ByRef Timestamp As Variant
) As Integer

OPCReadGroupEx

Similar to OPCReadEx, additionally read qualities and timestamps of all group items. You can pass empty variants.

Public Declare Function OPCReadGroupEx Lib "Rensen.Dataristix.OpcUa.IO.dll" (
    ByVal OPCGroupName As String,
    ByRef Values As Variant,
    ByRef Quality As Variant,
    ByRef Timestamp As Variant
) As Integer

OPCGetItemInfo

Reads type information and access rights of the item. Returned type numbers are number codes according to Microsoft’s VARIANT types; access rights are item access right number codes according to the OPC specification.

Public Declare Function OPCGetItemInfo Lib "Rensen.Dataristix.OpcUa.IO.dll" (
    ByVal OPCServerName As String,
    ByVal OPCNodeId As String,
    ByRef ItemType As Variant,
    ByRef ItemAccessRight As Variant
) As Integer

OPCGetGroupItemsInfo

Similar to OPCGetItemInfo; the function returns item IDs, types and access rights for all group items. You can pass empty variants.

Public Declare Function OPCGetGroupItemsInfo Lib "Rensen.Dataristix.OpcUa.IO.dll" (
    ByVal OPCGroupName As String,
    ByRef ItemIds As Variant,
    ByRef ItemTypes As Variant,
    ByRef ItemAccessRigths As Variant
) As Integer

Tip

The most efficient way to read or write multiple OPC items over a period of time is as follows:

  • Call OPCLockServer once for each OPC server.
  • Call OPCAddGroup once for each group.
  • Call OPCGroupEnableCacheReads once for each group.
  • Repeat calls to OPCReadGroup or OPCWriteGroup as desired
  • Call OPCRemoveGroup for reach group.
  • Finally, call OPCUnlockServer once for each OPC server.

Declarations for 32-bit Excel

Option Explicit

Public Declare Function OPCInitialize Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x86\\Rensen.Dataristix.OpcUa.IO.dll" () As Integer
Public Declare Function OPCRead Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x86\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCServerName As String, ByVal OPCItemId As String, ByRef Value As Variant) As Integer
Public Declare Function OPCWrite Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x86\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCServerName As String, ByVal OPCItemId As String, ByRef Value As Variant) As Integer
Public Declare Function OPCLockServer Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x86\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCServerName As String) As Integer
Public Declare Function OPCUnlockServer Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x86\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCServerName As String) As Integer
Public Declare Function OPCLockRemoteServer Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x86\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCServerName As String, ByVal GuidStr As String, ByVal RemoteHostName As String) As Integer
Public Declare Function OPCUnlockRemoteServer Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x86\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCServerName As String) As Integer
Public Declare Function OPCCopy Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x86\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCServerName As String, ByVal OPCItemId As String) As Integer
Public Declare Function OPCGetLastError Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x86\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCServerName As String, ByRef ErrorMsg As Variant) As Integer
Public Declare Function OPCAddGroup Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x86\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCServerName As String, ByVal OPCGroupName As String, ByRef OPCItemIds As Variant) As Integer
Public Declare Function OPCReadGroup Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x86\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCGroupName As String, ByRef values As Variant) As Integer
Public Declare Function OPCWriteGroup Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x86\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCGroupName As String, ByRef values As Variant) As Integer
Public Declare Function OPCRemoveGroup Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x86\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCGroupName As String) As Integer
Public Declare Function OPCGroupEnableCacheReads Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x86\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCGroupName As String, ByVal CacheUpdateRateMilliSeconds As Integer) As Integer
Public Declare Function OPCGroupDisableCacheReads Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x86\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCGroupName As String) As Integer
Public Declare Function OPCReadEx Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x86\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCServerName As String, ByVal OPCItemId As String, ByRef Value As Variant, ByRef Quality As Variant, ByRef timestamp As Variant) As Integer
Public Declare Function OPCReadGroupEx Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x86\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCGroupName As String, ByRef values As Variant, ByRef Quality As Variant, ByRef timestamp As Variant) As Integer
Public Declare Function OPCGetItemInfo Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x86\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCServerName As String, ByVal OPCItemId As String, ByRef itemType As Variant, ByRef itemAccessRight As Variant) As Integer
Public Declare Function OPCGetGroupItemsInfo Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x86\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCGroupName As String, ByRef itemIds As Variant, ByRef itemTypes As Variant, ByRef itemAccessRigths As Variant) As Integer

Declarations for 64-bit Excel

Option Explicit

Public Declare PtrSafe Function OPCInitialize Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x64\\Rensen.Dataristix.OpcUa.IO.dll" () As Integer
Public Declare PtrSafe Function OPCRead Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x64\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCServerName As String, ByVal OPCItemId As String, ByRef Value As Variant) As Integer
Public Declare PtrSafe Function OPCWrite Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x64\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCServerName As String, ByVal OPCItemId As String, ByRef Value As Variant) As Integer
Public Declare PtrSafe Function OPCLockServer Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x64\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCServerName As String) As Integer
Public Declare PtrSafe Function OPCUnlockServer Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x64\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCServerName As String) As Integer
Public Declare PtrSafe Function OPCLockRemoteServer Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x64\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCServerName As String, ByVal GuidStr As String, ByVal RemoteHostName As String) As Integer
Public Declare PtrSafe Function OPCUnlockRemoteServer Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x64\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCServerName As String) As Integer
Public Declare PtrSafe Function OPCCopy Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x64\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCServerName As String, ByVal OPCItemId As String) As Integer
Public Declare PtrSafe Function OPCGetLastError Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x64\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCServerName As String, ByRef ErrorMsg As Variant) As Integer
Public Declare PtrSafe Function OPCAddGroup Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x64\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCServerName As String, ByVal OPCGroupName As String, ByRef OPCItemIds As Variant) As Integer
Public Declare PtrSafe Function OPCReadGroup Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x64\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCGroupName As String, ByRef values As Variant) As Integer
Public Declare PtrSafe Function OPCWriteGroup Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x64\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCGroupName As String, ByRef values As Variant) As Integer
Public Declare PtrSafe Function OPCRemoveGroup Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x64\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCGroupName As String) As Integer
Public Declare PtrSafe Function OPCGroupEnableCacheReads Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x64\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCGroupName As String, ByVal CacheUpdateRateMilliSeconds As Integer) As Integer
Public Declare PtrSafe Function OPCGroupDisableCacheReads Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x64\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCGroupName As String) As Integer
Public Declare PtrSafe Function OPCReadEx Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x64\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCServerName As String, ByVal OPCItemId As String, ByRef Value As Variant, ByRef Quality As Variant, ByRef timestamp As Variant) As Integer
Public Declare PtrSafe Function OPCReadGroupEx Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x64\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCGroupName As String, ByRef values As Variant, ByRef Quality As Variant, ByRef timestamp As Variant) As Integer
Public Declare PtrSafe Function OPCGetItemInfo Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x64\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCServerName As String, ByVal OPCItemId As String, ByRef itemType As Variant, ByRef itemAccessRight As Variant) As Integer
Public Declare PtrSafe Function OPCGetGroupItemsInfo Lib "C:\\Program Files\\Rensen\\Dataristix\\Services\\modules\\OPC UA Connector\\service\\x64\\Rensen.Dataristix.OpcUa.IO.dll" (ByVal OPCGroupName As String, ByRef itemIds As Variant, ByRef itemTypes As Variant, ByRef itemAccessRigths As Variant) As Integer

Error Codes

All library functions return one of the following Integer error codes.

Code Error
0 No error
-1 Out of memory
-2 OPC server not found
-3 Failed to create OPC server
-4 Failed to create OPC group
-5 Failed to create OPC item
-6 Unused
-7 OPC item read error
-8 OPC item write error
-10 General Error
-11 Duplicate Group
-12 OPCLockServer or OPCLockRemoteServer not called
-13 Invalid parameter or parameter type
-14 Group not found
-15 Group item value count different from group item count
-16 OPC server does not support a required interface
-17 OPC server call failed