Click or drag to resize

InitializeIdentification Method

Queries the instrument for its identification string and initializes the corresponding driver settings.

virtual HRESULT InitializeIdentification();
Return Value

Returns S_OK if successful, otherwise a failure HRESULT.

When to Override

Override this function when you need to perform custom parsing of the instrument identification string. The default implementation of this function issues a "*IDN?" query and expects a response in the following format:



This function is used in the implementation of the IIviDriver::Initialize method. When the driver is initialized, the InitializeIdentification function sends a "*IDN?" query. The instrument responds by returning its identification string, which is parsed to retrieve the instrument manufacturer, the instrument model, the serial number, and the firmware revision. If the instrument does not response to "*IDN?" in the form shown above, then the InitializeIdentification function must be overridden to properly parse and store the instrument identification information.

Note Note

Within the implementation of InitializeIdentification, it is important to ultimately call the SetIdentificationInformation function to properly cache the information parsed from the indentification string. See the example below.

// CoAcme4321.h
class ATL_NO_VTABLE Acme4321 : 
   // ...

   virtual HRESULT InitializeIdentification()
      // Query the instrument for its ID string using the command "SYST:ID?"
      // The instrument returns an ID string in the following form:
      //   <manufacturer>;<serialNumber>;<firmwareRevision>;<model>

      CString strManufacturer, strModel, strSerialNumber, strFirmwareRevision;
      HRESULT hr = io.Queryf(_T("SYST:ID?", _T("%s,%s,%s,%s"), &strManufacturer, &strSerialNumber, &strFirmwareRevision, &strModel);
      if (SUCCEEDED(hr))
         // Cache the identification information in the driver
         SetIdentificationInfo(strIdentification, strManufacturer, strModel, strSerialNumber, strFirmwareRevision);

      return hr;

   // ...
See Also

Download a complete CHM version of this documentation here.