gOPCUAConnector.gRemoveConnectionItems Method

Top  Previous  Next

Description

Deletes connections defined with ConnectionObjects.

After this operation, if all connections are deleted in subscription, subscription is also deleted.

 

VB syntax

gOPCUAConnector.gRemoveConnectionItems(subscriptionID As StringByRef itemsToRemove() As gOPCUAConnectionObject)

 

C# syntax

gOPCUAConnector.gRemoveConnectionItems(string subscriptionID, ref gOPCUAConnectionObject[] itemsToRemove)

 

Parameters

subscriptionID

Name for subscription that includes connections you want to delete.

 

itemsToRemove        

An array of ConnectionObjects that specify what NodeIDs, properties and controls will be  removed.

 

Return Type

gOPCUAStatusCode

 

C# code example

  try

            {

                //Step1: Create an array of connection objects with single item and assign NodeID, control and property you want to remove

                GelecekCommon.gOPCUAConnectionObject[] connection_objects = new GelecekCommon.gOPCUAConnectionObject[1];

                connection_objects[0] = new GelecekCommon.gOPCUAConnectionObject();

                connection_objects[0].NodeID = txtNodeID1.Text;

                connection_objects[0].Control = txtValue1;

                connection_objects[0].PropertyName = "Text";

 

 

 

                //Step2: Apply gRemoveOneItemAndObjectFromConnectionGroup method

                GelecekCommon.gOPCUAStatusCode function_result = gOPCUAConnector1.gRemoveConnectionItems(txtSubscriptionID.Text, ref connection_objects);

 

                txtFunctionResult.Text = function_result.ToString();

 

                //Setp3: Check Result

                //For a successfull remove, function result should be "Good" and status code sould be "Good"

                if (function_result == GelecekCommon.gOPCUAStatusCode.Good)

                {

                    txtStatusCode1.Text = connection_objects[0].StatusCode.ToString();

                }

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }