Click or drag to resize

Automatic Command Formatting

By far, the simplest way to deal with instrument communication when implementing methods and properties is to rely upon the built-in command formatting features provided by Nimbus. Nimbus generates all of the required method implementation coe when using automatic command formatting.

Using Automatic Command Formatting

To use automatic command formatting, you must first associate an instrument command with the method or property by choosing the Instrument Command implementation type in the Method General Editor. Nimbus will generate code in the ForwardingShims.nimbus.cpp file to format the command and store it an internally managed command buffer. Within the method implementation, Nimbus will generate a call to a function such as InstrPrintCommand or InstrQueryResponse. These functions send the command stored in the command buffer to the instrument and possibly retrieve results from the instrument. This makes the actual implementation code appearing in the implementation file very simple. The code below is an example of the complete implementation of a method that uses automatic command formatting.

C++
// CoAcme4321.cpp
STDMETHODIMP Acme4321::IAcme4321_Configure()
{
    HRESULT hr = S_OK;

    // Send command that is formatted by the auto-geneated code in the ForwardingShims.nimbus.cpp file.
    hr = InstrPrintCommand();

    return hr;
}

Download a complete CHM version of this documentation here.