ClassPrefix_InitWithOptions

IVI Driver Help

Edition Date: August 2011

Part Number: 370430H-01

»View Product Info
Download Help (Windows Only)

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_InitWithOptions.

C Function Prototype

ViStatus ClassPrefix_InitWithOptions (ViRsrc logicalName, ViBoolean IDQuery,ViBoolean resetDevice,ViConstString optionString,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 funconfigurationthe 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.
  • Sends 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. This is useful if you have multiple physical instances of the same type of instrument. Avoid creating multiple concurrent sessions to the same physical instrument. Although you can create more than one IVI session for the same resource, it is best not to do so. You can use the same session in multiple execution threads. You can use the ClassPrefix_LockSession and the 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 to reset the instrument during the initialization procedure.

Valid Range:

VI_TRUE (1)—Reset Device (Default Value)

VI_FALSE (0)—Don't Reset

optionString ViString You can use this control to set the initial value of certain attributes for the session. The following table lists the attributes and the name you use in this parameter to identify the attribute.

Range Check
CLASSPREFIX_ATTR_RANGE_CHECK
QueryInstrStatus
CLASSPREFIX_ATTR_QUERY_INSTRUMENT_STATUS
Cache
CLASSPREFIX_ATTR_CACHE
Simulate
CLASSPREFIX_ATTR_SIMULATE
RecordCoercions
CLASSPREFIX_ATTR_RECORD_COERCIONS
InterchangeCheck
CLASSPREFIX_ATTR_INTERCHANGE_CHECK
UseSpecificSimulation
CLASSPREFIX_ATTR_USE_SPECIFIC_SIMULATION

The format of this string is "AttributeName=Value" where AttributeName is the name of the attribute and Values is the value to which the attribute is set. To set multiple attributes, separate their assignments with a comma.

If you pass NULL or an empty string for this parameter, the session uses the values that you configure in MAX. You can override the values from MAX by assigning a value explicitly in a string you pass for this parameter. You do not have to specify all of the attributes and may leave any of them out. If you do not specify one of the attributes, the driver uses the value stored in MAX.

The following are the valid values for ViBoolean attributes:

True:  1, TRUE, or VI_TRUE

False:  0, FALSE, or VI_FALSE

Default Value:"Simulate=0,RangeCheck=1,QueryInstrStatus=0,Cache=1,RecordCoercions=0,InterchangeCheck=0,UseSpecificSimulation=0"

     
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

Related Topic

Interchangeability Checking

WAS THIS ARTICLE HELPFUL?

Not Helpful