niSwitch_GetPath

NI-SWITCH Functions

niSwitch_GetPath

IviSwtchBase Capability Group

C Function Prototype

ViStatus niSwitch_GetPath (ViSession vi, ViConstString channel1, ViConstString channel2, ViInt32 bufferSize, ViChar[] path);

Purpose

Returns a string that identifies the explicit path created with niSwitch_Connect. Pass this string to niSwitch_SetPath to establish the exact same path in future connections.

In some cases, multiple paths are available between two channels. When you call niSwitch_Connect, NI-SWITCH selects an available path; however, the driver may not always select the same path through the switch module.

niSwitch_GetPath only returns those paths explicitly created by niSwitch_Connect or niSwitch_SetPath. For example, if you connect channels CH1 and CH3, and then channels CH2 and CH3, an explicit path between channels CH1 and CH2 does not exist and an error is returned.

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

The default value is an empty string.

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

The default value is an empty string.

bufferSize ViInt32 Pass the number of bytes in the ViChar array you specify for the Path parameter. If the current value of the attribute, including the terminating NULL byte, contains more bytes that you indicate in this parameter, the function copies bufferSize–1 bytes into the buffer, places an ASCII NULL byte at the end of the buffer, and returns the buffer size you must pass to get the entire value. For example, if the value is "R1->C1" and bufferSize is 4, the function places "R1-" into the buffer and returns 7. If you pass 0, you can pass VI_NULL for path. This enables you to find out the path size and to allocate the buffer of the appropriate size before calling this function again.
path ViChar[] A string composed of comma-separated paths between channel1 and channel2. The first and last names in the path are the endpoints of the path. All other channels in the path are configuration channels.

Examples of returned paths:

ch0->com0, com0->ab0