Echelon OpenLDV User Manual

Page 151

Advertising
background image

OpenLDV Programmer’s Guide

143

be called from the Timer1_Timer() function after the next timer control interval

expires. The StartButton_Click() function opens the network that requested

connection in independent mode, and enables monitoring of the network variable

monitor set for that network. It also calls the ReleasePendingUpdates method

to release the monitor-point update events that have been withheld since the

session began.
The application then receives the monitor-point update event that caused the

uplink session request (for example, an alarm). Upon receiving a monitor-point

update event, the m_cOS_OnNvMonitorPointUpdateEvent() function is

called automatically. This function saves all information associated with the

monitor-point update event publicly, and sets a flag to True to indicate that a

monitor-point update has been received. This flag causes the

DisplayMP_Click() function to be called from the Timer1_Timer() function

after the next timer control interval expires, eliminating the need for any calls

from within the event handler. The DisplayMP_Click() function displays all

information saved for the monitor-point update event. It also sets a flag to True

to end the current uplink session.
When this flag is True, the StopButton_Click() function is called from the

Timer1_Timer() function after the next timer control interval expires. The

StopButton_Click() function disables the monitor point and monitor set for the

open network, and the network is closed. The application continues to listen for

requests for connection, and handles them in this fashion, until the application is

closed.
Important: A network interface could reset after receiving an alarm event, but

before the event has been propagated to the LNS Server, causing the event to be

lost. To prevent this loss, your applications must resend each monitor-point

update at short intervals until receipt of that event is confirmed, especially for

alarm applications. This technique results in reliable performance, and ensures

that no monitor point update events are lost before they are processed by the

LNS application.
For more information about any of the LNS commands used in this programming

sample, see the LNS Programmer’s Guide.

Dim m_cCurNet As LcaNetwork

Dim m_cMyVni As LcaAppDevice

Dim m_cMS As LcaMonitorSet

Dim m_gDP As LcaDataPoint

Dim m_gbInMP As Boolean

'Use the monitor point update event

'flag to track whether a monitor point

'update event has been received.

Dim m_gbInUplinkOpen As Boolean

'Use the uplink open flag to track

'whether an uplink session is currently

'being handled by the application.

Dim m_gbInUplinkClose As Boolean

'Use the uplink close flag to track

'whether the most recent uplink session

'handled by the application has been

'closed.

Dim m_szIncomingNetName As String

'This variable will be used to store

'the network name of a network

'requesting connection to the LNS

'server.

Private Sub Form_Initialize()

ExitButton.Enabled = True

'Enable the Exit button.

m_cOS.RemoteFlag = False

'Set the application access mode to

Advertising