GetChannelIndex

IVI Library

Ivi_GetChannelIndex

Usage

ViStatus Ivi_GetChannelIndex(ViSession vi, ViChar ChannelName[ ], ViInt32* Index);

Purpose

This function obtains the 1-based index of a channel name in the internal channel table for an IVI session.

If you pass VI_NULL or an empty string for the Channel Name parameter, this function sets the Index output parameter to 1.

If you pass a specific driver channel string for the Channel Name parameter, this function sets the Index output parameter to the 1-based index of the channel string in the internal channel table.

If you pass a virtual channel name that the end-user specifies in the configuration store, this function finds the specific driver channel string that the end-user assigns to the virtual channel name. The function then sets the Index output parameter to the 1-based index of the specific driver channel string in the internal channel table.

If you pass any other value for the Channel Name parameter, this function sets the Index output parameter to 0 and returns an error code.

Parameters

Name Type Description
vi ViSession

The ViSession handle that you obtain from Ivi_SpecificDriverNew. The handle identifies a particular IVI session.

ChannelName ViChar[ ]

Pass the channel name for which you want to obtain the index.

You can pass one of the following types of values:

  • VI_NULL or an empty string.
  • A specific driver channel string, which is one that the specific instrument driver specifies as valid using Ivi_BuildChannelTable or Ivi_AddToChannelTable.
  • A virtual channel name that the end-user specifies in the configuration store.
Index ViInt32*

A 1-based index into the channel table.

If you pass an invalid value for the Channel Name parameter, the function sets this output parameter to 0 and returns an error code.

Return Value

Contains the status code that the function call returns. IVI engine functions can return error and warning values from several sets of status codes. Some status codes are unique to the IVI engine. Other status codes are the same codes that VISA Library functions return. Still others are error or warning values that functions in specific instrument drivers return. Each set of status codes has its own numeric range.

Regardless of the source of the status code, 0 always indicates success, a positive value indicates a warning, and a negative value indicates an error.

Related Topic

IVI Status Codes