ClassPrefix_init

CVI/LabWindows IVI Class Driver

ClassPrefix_init

IVI Inherent Function

To form the ClassPrefix_ of the function name, use the prefix of the class driver with which you are working. For example, if you are working with the IviDmm class driver, use the prefix IviDmm_ to create the correct function name, IviDmm_init.

C Function Prototype

ViStatus ClassPrefix_init (ViRsrc logicalName, ViBoolean IDQuery, ViBoolean resetDevice, ViSession*vi);

Purpose

This function performs the following initialization actions:

  • Creates a new IVI instrument driver session.
  • Opens a session to the specific driver using the logical name of the IVI driver session.
  • If the IDQuery parameter is set to VI_TRUE, this function queries the instrument ID and checks that it is valid for this instrument driver.
  • If the reset parameter is set to VI_TRUE, this function resets the instrument to a known state.
  • Send initialization commands to set the instrument to the state necessary for the operation of the instrument driver.
  • Returns a ViSession handle that you use to identify the instrument in all subsequent instrument driver function calls.
Note  This function creates a new session each time you invoke it. Although you can open more than one IVI session for the same resource, it is best not to do so. You can use the same session in multiple program threads. You can use the ClassPrefix_LockSession and ClassPrefix_UnlockSession functions to protect sections of code that require exclusive access to the resource.
Caution   All IVI names, such as logical names or virtual names, are case-sensitive. If you use logical names, driver session names, or virtual names in your program, you must make sure that the name you use matches the name in the IVI Configuration Store file exactly, without any variations in the case of the characters in the name.

Parameters

Inputs Type Description
logicalName ViRsrc Pass the logical name that identifies the particular driver session to use. The driver session, in turn, identifies a specific driver and device and specifies the initial settings for the session. You configure the logical name, driver session, specific driver, and device in MAX.

If you want to use your program with a different physical instrument, you change the configuration of the logical name to use the driver session for the new physical instrument. You can change the initial settings for the session by changing the configuration of the driver session.

Default Value: SampleClassPrefix

IDQuery ViBoolean Specify whether you want the instrument driver to perform an ID Query.

Valid Range: VI_TRUE (1)—Perform ID Query

Default Value: VI_FALSE (0)—Skip ID Query

When you set this parameter to VI_TRUE, the driver verifies that the instrument you initialize is a type that this driver supports.

Circumstances can arise where it is undesirable to send an ID Query command string to the instrument. When you set this parameter to VI_FALSE, the function initializes the instrument without performing an ID Query.

resetDevice ViBoolean Specify whether you want the to reset the instrument during the initialization procedure.

Valid Range: VI_TRUE (1)—Reset Device

Default Value: VI_FALSE (0)—Do Not Reset

     
Outputs Type Description
vi ViSession The instrument handle that you obtain from the ClassPrefix_init or ClassPrefix_InitWithOptions functions. The handle identifies a particular IVI session.

Return Values