InitializeIdentification Method
Queries the instrument for its identification string and initializes the corresponding driver settings.
Syntax
Section titled “Syntax”virtual HRESULT InitializeIdentification();Return value
Section titled “Return value”Returns S_OK if successful, otherwise a failure HRESULT.
When to Override
Section titled “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:
<manufacturer>,<model>,<serialNumber>,<firmwareRevision>
Remarks
Section titled “Remarks”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 respond to “*IDN?” in the form shown above, then the InitializeIdentification function must be overridden to properly parse and store the instrument identification information.
Example
Section titled “Example”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; }
// ...}