niSwitch_Connect

NI-SWITCH Functions

niSwitch_Connect

IviSwtchBase Capability Group

C Function Prototype

ViStatus niSwitch_Connect (ViSession vi, ViConstString channel1, ViConstString channel2);

Purpose

Creates a path between channel1 and channel2. NI-SWITCH calculates and uses the shortest path between the two channels. Refer to Immediate Operations for information about channel usage types.

If a path is not available, the function returns one of the following errors:

  • NISWITCH_ERROR_EXPLICIT_CONNECTION_EXISTS, if the two channels are already explicitly connected by calling either the
    niSwitch_Connect or niSwitch_SetPath function.
  • NISWITCH_ERROR_IS_CONFIGURATION_CHANNEL, if a channel is a configuration channel. Error elaboration contains information about which of the two channels is a configuration channel.
  • NISWITCH_ERROR_ATTEMPT_TO_CONNECT_SOURCES, if both channels are connected to a different source. Error elaboration contains information about sources channel1 and channel2 connect to.
  • NISWITCH_ERROR_CANNOT_CONNECT_TO_ITSELF, if channel1 and channel2 are one and the same channel.
  • NISWITCH_ERROR_PATH_NOT_FOUND, if the driver cannot find a path between the two channels.
Note  Paths are bidirectional. For example, if a path exists between channels CH1 and CH2, then the path also exists between channels CH2 and CH1.

Parameters

Name Type Description
vi ViSession A particular NI-SWITCH session established with niSwitch_InitWithTopology, niSwitch_InitWithOptions, or niSwitch_init and used for all subsequent NI-SWITCH calls.

channel1 ViConstString Input one of the channel names of the desired path. Pass the other channel name as channel2. Refer to Devices for valid channel names for the switch module.

Examples of valid channel names:

ch0, com0, ab0, r1, c2, cjtemp



channel2 ViConstString Input one of the channel names of the desired path. Pass the other channel name as channel1. Refer to Devices for valid channel names for the switch module.

Examples of valid channel names:

ch0, com0, ab0, r1, c2, cjtemp