Echelon OpenLDV User Manual Page 152

  • Download
  • Add to my manuals
  • Print
  • Page
    / 194
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 151
144 LNS Programming with xDriver
'local.
m_cOS.SingleUserMode = False 'Allow multiple applications to access
'the LNS Server.
m_cOS.Open 'Open the LNS Server.
m_cOS.BeginIncomingSessionEvents ("Default") 'Register the application
'for uplink session event handling.
'After this, each time the listener
'port assigned to default profile
'receives an uplink session request,
'the m_cOS_OnIncomingSessionEvent event
'will be fired.
m_gbInMP = False 'Set the monitor point update event
'flag to False until a monitor point
'update event is received.
m_gbInUplinkOpen = False 'Set the uplink open and uplink close
m_gbInUplinkClose = False 'flags to False until an uplink
'session begins.
Timer1.Interval = 100 'Set the interval for invocation of the
'timer control function to 100
'milliseconds, or an interval of your
'choice.
End Sub
'The m_cOS_OnIncomingSessionEvent function is invoked each time an uplink
'session request is received, as long as the application has registered for
'uplink session handling by invoking the BeginIncomingSessionEvents method.
'This function stores the name of the calling network in the variable
'm_szIncomingNetName and sets the uplink 'open flag to True.
Private Sub m_cOS_OnIncomingSessionEvent(ByVal XDriverProfileName As String, _
ByVal NetName As String, ByVal IntfName As String, ByVal Tag As Long)
If m_gbInUplinkOpen = False & XDriverProfileName = "Default" Then
Timer1.Enabled = False 'Disable the timer while processing the
'uplink. Start of critical section. The
'network cannot be opened from the
'event handler.
m_cOS.AcceptIncomingSession Tag, True, True 'Accept the uplink. The
'DoPostponeUpdates flag is set to True, which
'means that all monitor point updates for the
'network will be withheld until the
'ReleasePendingUpdates method is called.
m_szIncomingNetName = NetName 'Store the name of the network that has
'requested connection in the variable
'm_szIncomingNetName. This will be used to
'open the network later.
m_gbInUplinkOpen = True 'Set the uplink open flag to True. This will
'cause the Timer1_Timer() function to invoke
'the StartButton_Click() function after the
'next timer interval expires.
Timer1.Enabled = True 'Re-enable the timer. End of critical section.
Else
m_cOS.AcceptIncomingSession Tag, False, False 'Reject the uplink session
'if there is another uplink session open.
End If
End Sub
'The m_cOS_OnNvMonitorPointUpdateEvent function is called when a monitor
'point update for an open network has been received. This function saves all
'information associated with the update so that it can be displayed by the
'DisplayMP_Click() function.
Private Sub m_cOS_OnNvMonitorPointUpdateEvent(ByVal MonitorPoint As Object, _
Page view 151
1 2 ... 147 148 149 150 151 152 153 154 155 156 157 ... 193 194

Comments to this Manuals

No comments