QuickOPC User's Guide and Reference
Write Method (_EasyUAClient)
Example 



View with Navigation Tools
OpcLabs.EasyOpcUA Assembly > OpcLabs.EasyOpc.UA.ComTypes Namespace > _EasyUAClient Interface : Write Method
Endpoint descriptor. Identifies the OPC-UA server.
Node descriptor. Identifies the node in OPC server's address space.
OpcLabs.EasyOpc.UA.UAAttributeData. Value of an attribute, together with status code and timestamps, to be written.
Writes data into a Value attribute of a node, using an endpoint descriptor and a node Id.
Syntax
'Declaration
 
Sub Write( _
   ByVal endpointDescriptorString As String, _
   ByVal nodeDescriptorString As String, _
   ByVal attributeData As Object _
) 
 
'Usage
 
Dim instance As _EasyUAClient
Dim endpointDescriptorString As String
Dim nodeDescriptorString As String
Dim attributeData As Object
 
instance.Write(endpointDescriptorString, nodeDescriptorString, attributeData)

Parameters

endpointDescriptorString
Endpoint descriptor. Identifies the OPC-UA server.
nodeDescriptorString
Node descriptor. Identifies the node in OPC server's address space.
attributeData
OpcLabs.EasyOpc.UA.UAAttributeData. Value of an attribute, together with status code and timestamps, to be written.
Remarks

You can obtain nodeDescriptorString e.g. by calling one of the browsing methods on OpcLabs.EasyOpc.UA.EasyUAClientCore object.

Example

COM

// This example shows how to write data (a value, timestamps and status code) into a single attribute of a node.

$GoodOrSuccess = 0;

// Instantiate the client object
$Client = new COM("OpcLabs.EasyOpc.UA.EasyUAClient");

// Modify data of a node's attribute
$StatusCode = new COM("OpcLabs.EasyOpc.UA.UAStatusCode");
$StatusCode->Severity = $GoodOrSuccess;
$AttributeData = new COM("OpcLabs.EasyOpc.UA.UAAttributeData");
$AttributeData->Value = 12345;
$AttributeData->StatusCode = $StatusCode;
$AttributeData->SourceTimestamp = (time() - 25569)/86400.0;

// Perform the operation
try
{
    $Client->Write(
        //"http://opcua.demo-this.com:51211/UA/SampleServer", 
        "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer", 
        "nsu=http://test.org/UA/Data/ ;i=10221", 
        $AttributeData);
    // The target server may not support this, and in such case a failure will occur.
}
catch (com_exception $e)
{
    printf("*** Failure: %s\n", $e->getMessage());
}
Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows

See Also