![]() | DriverSession::GetIdentificationInfo |
Sets the instrument model, manufacturer, serial number, and firmware revision used in implementing various driver functions.
virtual ViStatus GetIdentificationInfo(std::string& strManufacturer, std::string& strModel, std::string& strSerialNumber, std::string& strFirmwareRevision);
[out] The instrument manufacturer for the connected device.
[out] The model of the connected device.
[out] The serial number of the connected device.
[out] The firmware revision of the connected device.
Returns a VI_SUCCESS if the operation was successful or a failure ViStatus otherwise.
This function is automatically called as part of driver initialization and is used to set important instrument identification data stored in the driver session. By default, this function will use the VISA library to send a *IDN? query and it will expect a standard IEEE 488.2 response.
![]() |
---|
This function must be overridden for drivers that need to something other than a VISA-based *IDN? query for identifying the connected instrument. |
The following code demonstrates how to override the GetIdentificationInfo function:
// DriverSession.h class Acme4321DriverSession : public DriverSession { public: Acme4321DriverSession(ViSession handle) : DriverSession(handle, 2000, 2000, 2000, false, 1000) { } virtual ViStatus GetIdentificationInfo(std::string& strManufacturer, std::string& strModel, std::string& strSerialNumber, std::string& strFirmwareRevision) override { ViStatus status = VI_SUCCESS; // 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> // char szManufacturer[256], szSerial[256], szFirmware[256], szModel[256]; status = viQueryf(GetVisaSession(), "SYST:ID?\n", "%256[^,],%256[^,],%256[^,],%256[^,]", szManufacturer, szSerial, szFirmware, szModel); ReturnOnError(status); strManufacturer = szManufacturer; strSerial = szSerial; strFirmware = szFirmware; strModel = szModel; return status; } };