SwitchConnectDisconnect Function

Syntax

SwitchConnectDisconnect(String device, String connectRoutes, String disconnectRoutes, Number multiConnectMode = 1, Number operationOrder = 1, Number lifetime = 4, Boolean waitForDebounce = True)

Return Value

This function always returns 0.

Purpose

This function connects and disconnects paths for the specified routes in the device defined in the National Instruments Switch Executive.

Parameters

device as String

The virtual device on which to performs the switching action.

connectRoutes as String

The routes you are connecting. The expression must be a valid route specification string as defined by the National Instruments Switch Executive configuration for the virtual device name you are using. The string can be a combination of route group alias names, route names, and physical route paths. Example: 'MyRouteGroup & MyRoute & [Dev1/CH3->CH4,CH4->R0]'

disconnectRoutes as String

The routes you are disconnecting. The expression must be a valid route specification string as defined by the National Instruments Switch Executive configuration for the virtual device name you are using.

multiConnectMode as Number

(Optional) value that defines the behavior when more than one connection operation occurs on a specific route. The valid values are: 0 - No Multiconnect: A route can only be connected once. Any attempt to reconnect a route that is already connected results in an error. 1 - Multiconnect Routes (default): A route can be connected multiple times. The route must contain the same endpoints and path. National Instruments Switch Executive automatically reference counts the routes. If you issue multiple connect operations for a specific route, the route is not physically disconnected until an equal number of disconnect operations occur. You can either issue the Disconnect operation manually or use a lifetime setting for the route. The DisconnectAll function disconnects a route even if the route reference count is greater than one. -1 - Use Default Setting for Routes: Use the setting defined for the route in Switch Executive. (Only supported by Switch Executive version 2.0 or later.)

operationOrder as Number

(Optional) Specifies whether the Disconnect operation occurs before or after the Connect operation. The valid values are: 1 - Disconnect Before Connect (default): Disconnect the specified routes before connecting any routes. This is the typical mode of operation. 2 - Connect Before Disconnect: Connect the specified routes before disconnecting any routes. Use this mode of operation when you are switching electric current and want to ensure that a load is always connected to your source.

lifetime as Number

(Optional) value that specifies the lifetime that TestStand applies to the routes specified for connect operation. You can specify whether you want the routes to exist until manually disconnected later, or until the sequence, thread, or execution completes. If you use the Multiconnect Mode, a route can exist longer if another step specifies its own lifetime for the same route. Selecting a lifetime other than manual guarantees that the route stays connected as long as the step, sequence, thread, or execution in which you connect is still executing. If you manually disconnect a route that was previously connected using a non-manual lifetime setting, TestStand releases the reference to the route for the last step that performed a Connect operation for that route. The valid values are: 0 - Manual 1 - Execution 2 - Thread 3 - Sequence 4 - Step (default)

waitForDebounce as Boolean

(Optional) Specifies whether the operation waits for all switches to debounce before returning to TestStand. The wait for debounce occurs after both connect and disconnect operations are complete. The default value is True.