Echelon OpenLDV User Manual

Page 149

Advertising
background image

OpenLDV Programmer’s Guide

141

Set curRNI = NIs.Item("X.Default.RNI-0001")

'Set the variable curRNI as the

'network interface you want to open. Note the

'use of the xDriver naming convention here:

'X.[Profile Name].[Downlink Lookup Key].

Dim SysList As LcaSystems 'Set Syslist as the System objects collection.

Set SysList = g_NetworkA.Systems 'Set g_SystemA as the System object for

Set g_SystemA = SysList(1)

'the network to be opened.

Dim SysNSD As LcaNetworkServiceDevice

Set SysNSD = g_SystemA.NetworkServiceDevice

Set SysNSD.NetworkInterface = curRNI

g_SystemA.Open

End Sub

'Private Sub CloseNetA_Click() is called when the user clicks the Close Network

'A button. In order for this to happen, the Network object and the System

'object for Network A must be closed. This function also re-enables the Open

'Network A button, so that Network A can be re-opened, and disables the Close

'Network A button, so that the application will not attempt to close a network

'that is not already closed.

Private Sub CloseNetA_Click()

OpenNetA.Enabled = True 'Re-enable the Open Network A button.

CloseNetA.Enabled = False 'Disable the Close Network A button.

g_SystemA.Close 'Close the System object for network A.

g_NetworkA.Close 'Close the Network object for network A.

End Sub

'Private Sub OpenNetB_Click() is called when the user clicks the Open Network B

'button. This function first disables the Open Network B button, so that a

'user cannot try to open Network B while it is already open. It also enables

'the Close Network B button, so that the user can close the open network.

'Following this, the function opens the System and Network object for Network

'B. Please see the OpenNetA_Click()function for comments that describe each

'line of code in this function.

Private Sub OpenNetB_Click()

OpenNetB.Enabled = False

CloseNetB.Enabled = True

Dim netList As LcaNetworks

Set netList = g_cOS.Networks

Set g_NetworkB = netList(2)

g_NetworkB.Open

Dim NIs As LcaNetworkInterfaces

Set NIs = g_cOS.NetworkInterfaces

Dim curRNI As LcaNetworkInterface

Set curRNI = NIs.Item("X.Default.RNI-0002")

Dim SysList As LcaSystems

Set SysList = g_NetworkB.Systems

Set g_SystemB = SysList(1)

Dim SysNSD As LcaNetworkServiceDevice

Set SysNSD = g_SystemB.NetworkServiceDevice

Set SysNSD.NetworkInterface = curRNI

g_SystemB.Open

End Sub

'Private Sub CloseNetB_Click() is called when the user clicks the Close

'Network B button. In order for this to happen, the Network object and the

'System object for Network B must be closed. This function also re-enables

'the Open Network B button, so that Network B can be re-opened, and disables

'the Close Network B button, so that the application will not attempt to close

'a network that is already closed. Please see the CloseNetA_Click()

'function for comments that describe each line of code in this section.

Advertising