Echelon OpenLDV User Manual

Page 153

Advertising
background image

OpenLDV Programmer’s Guide

145

ByVal DataPoint As Object, ByVal srcaddr As Object)

Dim src_addr As LcaSourceAddress

Set src_addr = srcaddr 'Store the calling network address source in

'the variable src_addr.

X1 = src_addr.NodeId 'Store the node ID reporting the event in the

'variable X1.

X2 = src_addr.SubnetId 'Store the subnet ID in the variable X2.

Set m_gMP = MonitorPoint 'Store the monitor point for the event in

'variable m_gMP.

Set m_gDP = DataPoint 'Store the data point for the event in

'variable m_gDP.

TextStatus = TextStatus + vbCrLf + "OnNvMonitorPointUpdateEvent"

'The

'monitor point update event has been received

'and all data has been saved.

m_gbInMP = True 'Set the monitor point update event flag to

'True. This will cause the Timer1_Timer()

'function to invoke the DisplayMP_Click()

'function after the next timer interval,

'which will display the information saved for

'this monitor point update event.

End Sub

'The StartButton_Click() function is invoked by the Timer1_Timer() function

'when the uplink session open flag is true (this flag is set True by the

'm_cOS_OnIncomingSession function whenever an uplink session is started). 'This

function opens the network in independent mode, and enables the 'monitoring of

the network variable monitor set for the network.

Private Sub StartButton_Click()

On Error GoTo do_err1

Dim m_cNets As LcaNetworks

Set m_cNets = m_cOS.VNINetworks

Set m_cCurNet = m_cNets.Item(m_szIncomingNetName) 'Use m_cCurNet as the

'Network Object.

m_cCurNet.OpenIndependent

'Open the network in independent mode.

Set m_cMyVni = m_cCurNet.MyVNI

Dim m_cMSs As LcaMonitorSets

Set m_cMSs = m_cMyVni.MonitorSets

Set m_cMS = m_cMSs.Item(1) 'Enable the monitor set for the network.

m_cMS.Open True, True

m_cMyVni.ReleasePendingUpdates() 'Release all pending monitor point

'update events that occurred after the

'session began and before the monitor

'set was opened.

ExitButton.Enabled = False 'Disable the Exit button while the network and

'monitor set are open.

GoTo do_done

do_err1:

Debug.Print Err.Description

do_done:

End Sub

'The DisplayMP_Click() function is invoked by the Timer1_Timer() function 'when

the monitor point update event flag is true (this flag is set True by the

'm_cOS_OnNvMonitorPointUpdateEvent function whenever a monitor point update

'event is received). It displays some of the information saved for the monitor

'point update received in the text box of the form for this project.

Private Sub DisplayMP_Click()

TextStatus = TextStatus + vbCrLf + ":: '" + m_gMP.Name _

+ "'" + vbCrLf + ":: tag := " + CStr(m_gMP.Tag) + vbCrLf _

+ ":: " + m_gDP.FormattedValue 'The application used all of the

'data saved from the monitor point update

Advertising