gOPCUAConnector.gAsyncReadOneItem Method

Top  Previous  Next

Description

Used to read value of a single OPC Node asynchronously.

This method does not freeze your application like a synchronous method.

And because this is an asynchronous method, result comes with an event: gAsyncReadOneItemCompleted

 

VB syntax

gOPCUAConnector.gAsyncReadOneItem(itemToRead As gOPCUAReadWriteObject, transactionID As String)

 

C# syntax

gOPCUAConnector.gAsyncReadOneItem(gOPCUAReadWriteObject itemToRead, string transactionID)

 

Parameters

itemToRead

ReadWriteObject that holds OPC NodeID that you want to read value of it.        

 

transactionID

Transaction id is ID of asynchronous operation, a unique string.

Used in   gAsyncReadOneItemCompleted  event or to cancel asynchronous operation.

 

Return Type

gOPCUAStatusCode

 

C# code example

  try

            {

                //Step1: Create a read-write object and assign NodeID

                GelecekCommon.gOPCUAReadWriteObject read_write_obj = new GelecekCommon.gOPCUAReadWriteObject();

                read_write_obj.NodeID = txtNodeID1.Text;

 

                //Step1: Run gAsyncReadOneItem method .  TransactionID also needed.          

                GelecekCommon.gOPCUAStatusCode function_result = gOPCUAConnector1.gAsyncReadOneItem(read_write_obj, txtTransactionID.Text);

 

                //Step2: Check function result and status code. For a successfull read, function result should be "Good",

                txtFunctionResult.Text = function_result.ToString();

 

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }