gOPCUAConnector.gMonitoredItemValueChanged Event

Top  Previous  Next

Description

Occurs when value of a monitored OPC Node changes.

Note that this event occurs only for one OPC Node. If several value change happens at a time, separate event occurs for each value change.

 

VB syntax

Private Sub gOPCUAConnector_gMonitoredItemValueChanged(sender As Object, subscriptionID As String, monitorObject As gOPCUAMonitorObjectHandles gOPCUAConnector.gMonitoredItemValueChanged

 

C# syntax

private void gOPCUAConnector_gMonitoredItemValueChanged(object sender, string subscriptionID, gOPCUAMonitorObject monitorObjects)

 

Arguments

sender

OPC UA Connector that raising this event.

 

subscriptionID

ID of monitoring subscription that caused this event.

 

monitorObject

Object that holds new value of monitored OPC Node.

 

C# code example

 

     private void gOPCUAConnector1_gMonitoredItemValueChanged(object sender, string subscriptionID, GelecekCommon.gOPCUAMonitorObject monitorObject)

        {

            //With this event of Connector, only one new value comes at a time.

            //This behaviour is different in Classic Servers and Classic Connector.

 

            try

            {

                //First check subscription ID if it is requested subscription

                if (subscriptionID == txtSubscriptionID.Text)

                {

                    //Get value

                    if (monitorObject.NodeID == txtNodeID1.Text)

                    {

                        txtValue1.Text = monitorObject.Value.ToString(); //Be careful, Value should be able to convert to string..

                    }

                    else if (monitorObject.NodeID == txtNodeID2.Text)

                    {

                        txtValue2.Text = monitorObject.Value.ToString(); //Be careful, Value should be able to convert to string..

                    }

 

                }

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }

 

        }