niSwitch_init

NI-SWITCH Functions

niSwitch_init

Specific Function

C Function Prototype

ViStatus niSwitch_init (ViRsrc resourceName, ViBoolean idQuery, ViBoolean resetDevice, ViSession* vi);

Purpose

Returns a session handle used to identify the switch module in all subsequent instrument driver calls.

niSwitch_init creates a new IVI instrument driver session for the switch module specified in the resourceName parameter. If multiple topologies are valid for that device, NI-SWITCH uses the default topology specified in MAX.

By default, the switch module is reset to a known state.

An error is returned if a session to the specified resource exists in another process. The same session is returned if niSwitch_init is called twice in the same process for the same resource with the same topology.

Parameters

Name Type Description
resourceName ViRsrc

Resource name of the switch module to initialize.

Syntax:

MAX Configured under Valid Syntax
NI-DAQmx Devices DAQmxDeviceName
Traditional NI-DAQ (Legacy) Devices SCXI[chassis ID]::slot number
PXI System PXI[bus number]::device number

Optional fields are shown in square brackets ([]). The default values for optional fields are as follows:

chassis ID = 1
bus number = 0

Tip  IVI logical names are also valid for the resource name.

Example resource names:

Name Description
SC1Mod3 NI-DAQmx module in chassis "SC1" Slot 3
MySwitch NI-DAQmx module renamed to "MySwitch"
SCXI1::3 Traditional NI-DAQ (Legacy) module in chassis 1, Slot 3
SCXI::3 Traditional NI-DAQ (Legacy) module in chassis 1, Slot 3
PXI0::16 PXI bus 0, device number 16
PXI::16 PXI bus 0, device number 16
idQuery ViBoolean This parameter is ignored.

Because NI-SWITCH supports multiple switch modules, it always queries the switch to determine which device is installed. For this reason, this VI may return NISWITCH_ERROR_FAIL_ID_QUERY even if this parameter is set to VI_FALSE.

Value Description
VI_TRUE (default) Queries the switch to determine which device is installed.
VI_FALSE Currently unsupported.
resetDevice ViBoolean Specifies whether to reset the switch module during the initialization process.
Value Description
VI_TRUE (default) Resets the device.
VI_FALSE Currently unsupported. The device will not reset.
vi ViSession A particular NI-SWITCH session established with niSwitch_InitWithTopology, niSwitch_InitWithOptions, or niSwitch_init and used for all subsequent NI-SWITCH calls.