Click or drag to resize

Adding a Warning

Defining custom warnings in an IVI-C driver allows you to return a proper ViStatus return code and a properly formatted error message that can be displayed retrieved by the user via the GetError function. Internally, the errors and warnings defined for a particular IVI-C driver are managed #define macros that begin with PREFIX_ERROR_ or PREFIX_WARN_. Nimbus manages a mapping of error codes to error messages in the Errors.cpp file in the driver project. This map is used to retrieve the error message string and associate it with the driver session when the ReportError or ReportErrorEx utility functions are used in the driver implementation.

To add a warning to an IVI-C driver

  1. From Solution Explorer, double-click the Driver Designer node under the Nimbus node.

  2. The Driver Designer opens as a tabbed document window. Select the IVI-C tab.

  3. Right-click on the Warnings node and choose Add Warning.

  4. A new warning is added with a default name and the tree node enters edit mode.

  5. With the warning node still in edit mode, type the desired name of the warning and hit the Enter key.

    Note Note

    By convention, warning names start with PREFIX_WARN_. However, when typing a warning name in the tree view a shortened form of the name can be used. The PREFIX_WARN_ prefix prefix can be excluded. For example, if the desired warning is PREFIX_WARN_SWEEP_BUSY, then type only SWEEP_BUSY and the full warning name will be expanded when the Enter key is pressed.

    When choosing a warning name, the following naming rules apply:

    • The name must be unique within the driver.

    • The name must contain only alphanumeric characters and the underscore (_) character.

    • Spaces are not allowed.

    • The name must be uppercase.

  6. After the warning is added, the IVI-C Warning General Editor appears in the right portion of the IVI-C Designer. See the help topic for that Item Editor for details on defining the warning further.

See Also

Download a complete CHM version of this documentation here.