gOPCUAConnector.gRemoveMonitoredItems Method

Top  Previous  Next

Description

Deletes monitoring defined with monitorObjects.

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

 

VB syntax

gOPCUAConnector.gRemoveMonitoredItems(subscriptionID As StringByRef itemsToRemove() As gOPCUAMonitorObject)

 

C# syntax

gOPCUAConnector.gRemoveMonitoredItems(string subscriptionID, ref gOPCUAMonitorObject[] itemsToRemove)

 

Parameters

subscriptionID

Name for subscription that includes monitored OPC Nodes you want to delete.

 

itemsToRemove

An array of MonitorObjects that specify what NodeIDs will be  removed from monitoring subscription.

 

Return Type

gOPCUAStatusCode

 

C# code example

  try

            {

                //Step1: Create an array of monitor object with single item and assign NodeID you want to remove

                GelecekCommon.gOPCUAMonitorObject[] monitor_objects = new GelecekCommon.gOPCUAMonitorObject[] { 

                new GelecekCommon.gOPCUAMonitorObject() { NodeID = txtNodeID1.Text }};

 

 

                //Step2: Apply gRemoveMonitoredItems method

                GelecekCommon.gOPCUAStatusCode function_result = gOPCUAConnector1.gRemoveMonitoredItems(txtSubscriptionID.Text, ref monitor_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 = monitor_objects[0].StatusCode.ToString();

 

                }

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }