Click or drag to resize

Indexer General Editor

Name

Name of the indexer. Indexer names are fixed according to the programming language, and cannot be renamed.

Type

Data type of the indexer.

Generic types are supported. For information on how to use generic types, refer to Generics (C# Programming Guide)

If an array is desired, append opening and closing square brakets ([]) to the type name. For example, to have the indexer return an array of double, enter Double[].

Access

Indicates if the indexer is read-write, read-only, or write-only.

Repeated capability

The repeated capability with which the indexer is associated.

Implementation

Choosing the Manual option requires the driver developer to provide the implementation for the indexer getter and setter. This choice is often used for indexers that rely upon non-message-based device communications, such as register-based devices or drivers that rely upon a support DLL.

Choosing the Instrument command option instructs Nimbus to automatically generate all of the implementation code needed to send the specified commands and to read a response for the indexer getter, if the Response text box is non-empty.

Choosing the Manual with instrument command option is the same as Manual except that the command and response textboxes are enabled and used to populate the Instrument Command section of the driver help page for the indexer. This is useful for indexers that require manual implementation but that ultimately rely upon an instrument command in their manually added code.

Setter command

Specifies the command to send to the device when the value of the indexer is set (i.e. the indexer setter executes). This control is not enabled for read-only indexers. Nimbus supports a rich command and response formatting syntax, which can include the parameters, repeated capabilities, and more. Please see the topic Working With Instrument Commands for a detailed discussion of automatic command formatting.

Getter command

Specifies the query to send to the device when the value of the indexer value is read (i.e. the indexer getter executes). This control is not enabled for write-only indexers. Nimbus supports a rich command and response formatting syntax, which can include the parameters, repeated capabilities, and more. Please see the topic Working With Instrument Commands for a detailed discussion of automatic command formatting.

Getter response

Specifies the format of the response to read back from the device when the indexer value is read. This control is not enabled for write-only indexers.

Allow null

By default, the Nimbus Code Weaver will automatically validation code that raises a NullReferenceException if a reference-type indexer is set to null. Checking this box causes Nimbus to decorate this indexer with a NullAllowed attribute, which suppresses the standard null reference check for this indexer.

Model-Specific Programming with the Models Window

The Indexer General Editor contains a collapsible Models Window in the right portion of the editor. This window is used for two purposes:

  • Specifying that a model or group of models does not support the method.

  • Customizing settings on a per-model or per-family basis.

Note Note

The Models Window cannot be used to define new models for the driver. The list of models supported by the driver is specified on the Models Page of the Driver Settings Editor.

The root node of the Models Window is labeled "All Models". This node can be thought of as the "default behavior" for the indexer. By default, all instrument models are supported for the indexer and all share the same command and response. Thus, the editor controls are initially only enabled when "All Models" is selected in the Models Window. This changes when model-specific behavior is specified, as explained below.

When you use the Models Window to specify that a indexer is not supported for a model, Nimbus will generate the necessary code to raise the IVI-defined OperationNotSupportedException exception.

To specify that a particular model is not supported

  1. From the Models Window, right-click on the desired model or family.

  2. Choose Remove model support.

  3. The selected model name appears with a strikethrough font.

    Note that if a family was selected, all models in the family appear with a strikethrough font, indicating that the OperationNotSupportedException exception will be raised for those models as well.

  4. To re-enable support for a model, right-click the model and choose Add model support.

When customizing behavior on a per-model or per-family basis, Nimbus generates code that will send different setter commands, getter commands, and/or read a differently formatted getter response, based upon the actual model detected at runtime. See the discussion of the InitializeIdentification method to understand how Nimbus determines the connected model at runtime.

Only the getter and setter commands and getter response can be customized on a per-model basis. The return data type, indexer access, repeated capability, and implementation style are all static characteristics of the indexer and cannot be changed dynamically based on the connected instrument model.

To customize the command or response for a model

  1. From the Models Window, right-click on the desired model or family.

  2. Choose Customize settings

  3. The Setter command, Getter command, and Getter reponse text boxes are enabled for the selected model, allowing model-specific values to be set. The model appears in bold font for the customized model.

    Note that if a family was selected, all models in the family appear in bold font, indicating that they will all share a custom command and/or resposne.

  4. To have a indexer return to using the default commands and response for a model, right-click the model and choose Remove custom settings. The model appears in normal font and the editor controls are once again disabled when the model is selected, indicating that the model is controlled via the default settings specified when the "All Models" node is selected.

See Also

Download a complete CHM version of this documentation here.