Echelon OpenLDV User Manual Page 150

  • Download
  • Add to my manuals
  • Print
  • Page
    / 194
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 149
142 LNS Programming with xDriver
Private Sub CloseNetB_Click()
OpenNetB.Enabled = True
CloseNetB.Enabled = False
g_SystemB.Close
g_NetworkB.Close
End Sub
'Private Sub Form_Load() is called when the form Load event occurs.
Private Sub Form_Load()
g_cOS.RemoteFlag = False 'Set the application access mode to local.
g_cOS.SingleUserMode = False 'Allow multiple applications to access LNS
'server.
g_cOS.Open 'Open the Object Server.
CloseNetA.Enabled = False 'Disable the Close Network buttons, so that a
CloseNetB.Enabled = False 'cannot try to close a network before it has
'been opened.
End Sub
Private Sub Form_Unload(Cancel As Integer)
G_cOS.Close 'Close the object server.
End Sub
Uplink Sample Application
The following Visual Basic sample program is a listener application that
manages uplink sessions between the LNS Server and multiple RNIs. This
application first registers for uplink session event handling, and uses a timer
control to check when uplink session requests are received. When the timer
control discovers that a request for uplink session has been received, the
application opens the network that has requested the session. Thus, the
application can run without user interaction, other than starting and stopping
the application.
This sample program uses several events and methods within the LNS Server for
use with xDriver. For additional information, see Appendix B, LNS Methods and
Events for xDriver, on page 153.
In the Form_Initialize() function, the application registers for uplink session
event handling by calling the BeginIncomingSessionEvent function. The
OnIncomingSessionEvent event is fired each time an uplink session event is
received. This event handler is called m_cOS_OnIncomingSessionEvent in
this application, because the instance of the LNS Server for this application is
named m_cOS.
The uplink session is accepted or rejected by calling the
AcceptIncomingSession method from the
m_cOS_OnIncomingSessionEvent event handler. If the session is accepted,
the name of the network that requested the uplink session is stored in a global
variable. This variable is used to open the network. This application also sets
the DoPostponeUpdates flag to True when it calls the
AcceptIncomingSession method. All monitor-point updates are then withheld
until the ReleasePendingUpdates method is called. Your application can
receive the monitor-point update event that caused the uplink session request.
The network should not be opened from the event handler, so the
OnIncomingSession event sets a flag to True to indicate that an uplink session
request has been received. This flag causes the StartButton_Click() function to
Page view 149
1 2 ... 145 146 147 148 149 150 151 152 153 154 155 ... 193 194

Comments to this Manuals

No comments