![]() |
THM1176InstrumentDriver
1.0
C++ API for Metrolab THM1176
|
THM1176 instrument class. More...
#include <THM1176.h>
Public Member Functions | |
CTHM1176Instrument (RsrcMgrType &rResourceManager, tResourceName ResourceName) | |
Constructor. More... | |
virtual | ~CTHM1176Instrument () |
Destructor. More... | |
const CErrorList & | CurrentErrorList () |
Fetch current error list. More... | |
void | ClearErrorList () |
Clear the error list. More... | |
bool | Connect (U32 InitialTimeout, bool Exclusive=true) |
Open the connection to the instrument. More... | |
void | Disconnect () |
Close the connection to the instrument. More... | |
bool | ParmAveragingSet (const sAveraging< uParm > &rAvg) |
Set the averaging parameter. More... | |
bool | ParmAveragingGet (sAveraging< uParm > &rAvg) |
Fetch the currently selected averaging parameter. More... | |
bool | ParmAveragingGet (sAveraging< sBoundedParm > &rAvg) |
Fetch current averaging parameter, incl. min/max/default. More... | |
bool | ParmSleepSet (bool Sleep) |
Set parameter whether to sleep after each acquisition. More... | |
bool | ParmSleepGet (bool &rSleep) |
Fetch parameter whether to sleep after each acquisition. More... | |
bool | ParmTriggerInputSet (const sInputTrigger< uParm > &rInputTrig) |
Set trigger input parameters. More... | |
bool | ParmTriggerInputGet (sInputTrigger< uParm > &rInputTrig) |
Fetch current trigger input parameters. More... | |
bool | ParmTriggerInputGet (sInputTrigger< sBoundedParm > &rInputTrig) |
Fetch current trigger input parameters, incl. min/max/default. More... | |
bool | ParmUnitsSet (eUnits Units) |
Set measurement units. More... | |
bool | ParmUnitsGet (eUnits &rUnits) |
Fetch currently selected measurement units. More... | |
bool | ParmUseCalibrationSet (bool UseCal) |
Set whether to return calibrated results. More... | |
bool | ParmUseCalibrationGet (bool &rUseCal) |
Fetch parameter whether to return calibrated results. More... | |
bool | ParmRangeSet (const sRange< uParm > &rRange) |
Set measurement range. More... | |
bool | ParmRangeGet (sRange< uParm > &rRange) |
Fetch currently selected measurement range. More... | |
bool | ParmRangeGet (sRange< sBoundedParm > &rRange) |
Fetch currently selected measurement range, incl. min/max/default. More... | |
bool | ReadFileDirectory (U32 &rUsedBytes, U32 &rAvailableBytes, tFileList &rFileList) |
Read the instrument's file directory information. More... | |
bool | ReadFile (std::string Path, std::string &rContent) |
Read a file from the instrument's file system. More... | |
bool | Initiate (bool Continuous=false) |
Initiate measurements. More... | |
bool | Abort (void) |
Abort a measurement in progress. More... | |
bool | SendBusTrigger () |
Send a USB bus trigger. More... | |
bool | MeasurementsGet (U32 NoMeasurements, CFluxList &rBx, CFluxList &rBy, CFluxList &rBz, eUnits &rUnits, U16 &rTemp, CTimestampList &rTimestampList, sMeasurementConditions *pMeasurementConditions=NULL) |
Retrieve measurements: short form. More... | |
bool | MeasurementsGet (sArbitraryMeasurements ArbSelect, CFluxList &rBx, CFluxList &rBy, CFluxList &rBz, eUnits &rUnits, U16 &rTemp, CTimestampList &rTimestampList, sMeasurementConditions *pMeasurementConditions=NULL) |
Retrieve measurements: long form. More... | |
bool | SetFormat (eCommunicationFormat Format) |
Select whether data is returned as text or binary. More... | |
bool | GetFormat (eCommunicationFormat &Format) |
Retrieve whether data is returned as text or binary. More... | |
bool | Measure (tFlux &rBx, tFlux &rBy, tFlux &rBz, bool DefaultParms=true, eUnits Units=kT, tFlux ExpectedField=0., unsigned int NoDigits=0) |
High-level measurement: single measurement. More... | |
bool | Measure (CFluxList &rBx, CFluxList &rBy, CFluxList &rBz, unsigned int NoMeasurements=1, bool DefaultParms=true, eUnits Units=kT, tFlux ExpectedField=0., unsigned int NoDigits=0) |
High-level measurement: multiple measurements. More... | |
bool | StatusPreset () |
Reset OPERation and QUEStionable enable registers. More... | |
bool | StatusGet (sStatusRegister Reg, U16 &rStatus) |
Fetch current value of a single status register. More... | |
bool | StatusGet (RegisterList Regs, StatusValues &rStatus) |
Fetch current values of a list of status registers. More... | |
bool | StatusSetEnableRegister (eStatusRegisterSet Set, U16 DisableMask, U16 EnableMask) |
Disable and enable bits in the given enable register. More... | |
bool | WriteAndRead (const std::string &rWriteStr, CSCPIBuffer &rReadBuffer) |
Write an arbitrary command and read the result. More... | |
bool | GetIdentification (std::string &rIdentification) |
Fetch the intrument's identification string. More... | |
bool | GetIdentification (sIdentifier &rIdentification) |
Fetch the intrument's parsed identification string. More... | |
bool | GetAllRanges (CFluxList &rRanges) |
Fetch all the intrument's ranges. More... | |
bool | ConvertTimestamp (const U64 RawTimestamp, CAbsoluteTimestamp &rTimestamp) |
Convert a raw timestamp to UNIX Epoch time and nanoseconds. More... | |
bool | GetAllUnits (CUnitsList &rUnits) |
Fetch all units supported by instrument. More... | |
bool | GetDivisor (eUnits Units, U32 &rDivisor) |
Fetch divisor to convert instrument's base units to given units. More... | |
bool | GetRotationMatrix (Matrix3f &Matrix) |
Fetch the intrument's rotation matrix, to correct angular error. More... | |
bool | GetImmediateMeasurementPeriod (const sAveraging< uParm > &rAvg, F64 &rPeriod) |
Compute measurement interval for Immediate Trigger, for a given averaging parameter. More... | |
bool | CalibrateZeroOffset (bool ForceCalibration=false) |
Perform the Zero Offset calibration procedure. More... | |
bool | RestoreZeroOffset () |
Restore the factory values for the Zero Offset. More... | |
bool | Reset () |
Reset the instrument to power-on configuration. More... | |
bool | SwitchToDFUMode () |
Enter the Device Firmware Upgrade mode. More... | |
bool | ReadInformationDates (std::string &rSManufacturingDate, std::time_t &rManufacturingDate, std::string &rSCalibrationDate, std::time_t &rCalibrationDate) |
Fetch the intrument's date information. More... | |
bool | AbortRead () |
Abort a read operation. More... | |
THM1176 instrument class.
Abstraction of a Metrolab THM1176 Three-axis Hall Magnetometer or TFM1186 Three-axis Fluxgate Magnetometer.
InstrType | Instrument class to use for communication, e.g. CVISAInstrument or CUSBTMCInstrument |
RsrcMgrType | Associated Resource Manager, e.g. CVISAResourceManager or CUSBTMCResourceManager |
CTHM1176Instrument::CTHM1176Instrument | ( | RsrcMgrType & | rResourceManager, |
tResourceName | ResourceName | ||
) |
Constructor.
[in] | rResourceManager | Resource Manager. |
[in] | ResourceName | Resource name. |
Definition at line 774 of file THM1176.cpp.
|
virtual |
Destructor.
Definition at line 781 of file THM1176.cpp.
bool CTHM1176Instrument::Abort | ( | void | ) |
Abort a measurement in progress.
Definition at line 1416 of file THM1176.cpp.
bool CTHM1176Instrument::AbortRead |
Abort a read operation.
Note: This operation is nonoperational for instruments with firmware version 3.1 or below. It will cause your instrument to lock up.
Definition at line 2219 of file THM1176.cpp.
bool CTHM1176Instrument::CalibrateZeroOffset | ( | bool | ForceCalibration = false | ) |
Perform the Zero Offset calibration procedure.
[in] | ForceCalibration | Override warnings about models that should not be calibrated |
Notes:
Definition at line 2015 of file THM1176.cpp.
void CTHM1176Instrument::ClearErrorList |
Clear the error list.
Definition at line 800 of file THM1176.cpp.
bool CTHM1176Instrument::Connect | ( | U32 | InitialTimeout, |
bool | Exclusive = true |
||
) |
Open the connection to the instrument.
[in] | Exclusive | Whether or not to request an exclusive lock. |
Definition at line 812 of file THM1176.cpp.
|
inline |
const CErrorList & CTHM1176Instrument::CurrentErrorList |
void CTHM1176Instrument::Disconnect |
Close the connection to the instrument.
Definition at line 879 of file THM1176.cpp.
bool CTHM1176Instrument::GetAllRanges | ( | CFluxList & | rRanges | ) |
Fetch all the intrument's ranges.
[out] | rRanges | List of ranges. |
Definition at line 1950 of file THM1176.cpp.
bool CTHM1176Instrument::GetAllUnits | ( | CUnitsList & | rUnits | ) |
Fetch all units supported by instrument.
[out] | rUnits | List of units. |
Definition at line 1962 of file THM1176.cpp.
bool CTHM1176Instrument::GetDivisor | ( | eUnits | Units, |
U32 & | rDivisor | ||
) |
Fetch divisor to convert instrument's base units to given units.
[in] | Units | Units for which we want the divisor. |
[out] | rDivisor | The returned divisor; zero if error. |
Definition at line 1974 of file THM1176.cpp.
bool CTHM1176Instrument::GetFormat | ( | eCommunicationFormat & | Format | ) |
Retrieve whether data is returned as text or binary.
[out] | Format | Text or binary. |
Definition at line 1662 of file THM1176.cpp.
bool CTHM1176Instrument::GetIdentification | ( | sIdentifier & | rIdentification | ) |
Fetch the intrument's parsed identification string.
[out] | rIdentification | Returned identification string. |
Definition at line 1940 of file THM1176.cpp.
bool CTHM1176Instrument::GetIdentification | ( | std::string & | rIdentification | ) |
Fetch the intrument's identification string.
[out] | rIdentification | Returned identification string. |
Definition at line 1930 of file THM1176.cpp.
bool CTHM1176Instrument::GetImmediateMeasurementPeriod | ( | const sAveraging< uParm > & | rAvg, |
F64 & | rPeriod | ||
) |
Compute measurement interval for Immediate Trigger, for a given averaging parameter.
[in] | rAvg | Averaging setting. |
[out] | rPeriod | Corresponding measurement period, in s. |
Definition at line 2000 of file THM1176.cpp.
bool CTHM1176Instrument::GetRotationMatrix | ( | Matrix3f & | Matrix | ) |
Fetch the intrument's rotation matrix, to correct angular error.
[out] | Matrix | The returned rotation matrix. |
Definition at line 1993 of file THM1176.cpp.
bool CTHM1176Instrument::Initiate | ( | bool | Continuous = false | ) |
Initiate measurements.
[in] | Continuous | Whether to measure continuously. |
Definition at line 1400 of file THM1176.cpp.
bool CTHM1176Instrument::Measure | ( | CFluxList & | rBx, |
CFluxList & | rBy, | ||
CFluxList & | rBz, | ||
unsigned int | NoMeasurements = 1 , |
||
bool | DefaultParms = true , |
||
eUnits | Units = kT , |
||
tFlux | ExpectedField = 0. , |
||
unsigned int | NoDigits = 0 |
||
) |
High-level measurement: multiple measurements.
[out] | rBx | Measured Bx values. |
[out] | rBy | Measured By values. |
[out] | rBz | Measured Bz values. |
[in] | NoMeasurements | Number of measurements. |
[in] | DefaultParms | Use default or currently selected parameters. |
[in] | Units | Measurement units. |
[in] | ExpectedField | Select range for this expected field. |
[in] | NoDigits | Number of digits to return. |
Definition at line 1755 of file THM1176.cpp.
bool CTHM1176Instrument::Measure | ( | tFlux & | rBx, |
tFlux & | rBy, | ||
tFlux & | rBz, | ||
bool | DefaultParms = true , |
||
eUnits | Units = kT , |
||
tFlux | ExpectedField = 0. , |
||
unsigned int | NoDigits = 0 |
||
) |
High-level measurement: single measurement.
[out] | rBx | Measured Bx value. |
[out] | rBy | Measured By value. |
[out] | rBz | Measured Bz value. |
[in] | DefaultParms | Use default or currently selected parameters. |
[in] | Units | Measurement units. |
[in] | ExpectedField | Select range for this expected field. |
[in] | NoDigits | Number of digits to return. |
Definition at line 1698 of file THM1176.cpp.
bool CTHM1176Instrument::MeasurementsGet | ( | sArbitraryMeasurements | ArbSelect, |
CFluxList & | rBx, | ||
CFluxList & | rBy, | ||
CFluxList & | rBz, | ||
eUnits & | rUnits, | ||
U16 & | rTemp, | ||
CTimestampList & | rTimestampList, | ||
sMeasurementConditions * | pMeasurementConditions = NULL |
||
) |
Retrieve measurements: long form.
[in] | ArbSelect | Select which data to return, and how much. |
[out] | rBx | Measured Bx values; empty if not selected. |
[out] | rBy | Measured By values; empty if not selected. |
[out] | rBz | Measured Bz values; empty if not selected. |
[out] | rUnits | Units in which data is returned. |
[out] | rTemp | Returned temperature; zero if not selected. |
[out] | rTimestampList | Timestamp for each measurement; empty if not selected. |
[out] | pMeasurementConditions | Averaging, trigger and calibration parameters. |
Note: If pMeasurementConditions is NULL (the default), the measurement parameters are not returned.
Definition at line 1464 of file THM1176.cpp.
bool CTHM1176Instrument::MeasurementsGet | ( | U32 | NoMeasurements, |
CFluxList & | rBx, | ||
CFluxList & | rBy, | ||
CFluxList & | rBz, | ||
eUnits & | rUnits, | ||
U16 & | rTemp, | ||
CTimestampList & | rTimestampList, | ||
sMeasurementConditions * | pMeasurementConditions = NULL |
||
) |
Retrieve measurements: short form.
[in] | NoMeasurements | Number of measurements. |
[out] | rBx | Measured Bx values. |
[out] | rBy | Measured By values. |
[out] | rBz | Measured Bz values. |
[out] | rUnits | Units in which data is returned. |
[out] | rTemp | Returned temperature. |
[out] | rTimestampList | Timestamp for each measurement. |
[out] | pMeasurementConditions | Averaging, trigger and calibration parameters. |
Note: If pMeasurementConditions is NULL (the default), the measurement parameters are not returned.
Definition at line 1444 of file THM1176.cpp.
bool CTHM1176Instrument::ParmAveragingGet | ( | sAveraging< sBoundedParm > & | rAvg | ) |
Fetch current averaging parameter, incl. min/max/default.
[out] | rAvg | Averaging parameters, incl. min/max/default. |
Definition at line 925 of file THM1176.cpp.
bool CTHM1176Instrument::ParmAveragingGet | ( | sAveraging< uParm > & | rAvg | ) |
Fetch the currently selected averaging parameter.
[out] | rAvg | Current averaging parameters. |
Definition at line 904 of file THM1176.cpp.
bool CTHM1176Instrument::ParmAveragingSet | ( | const sAveraging< uParm > & | rAvg | ) |
Set the averaging parameter.
[in] | rAvg | Desired averaging setting. |
Definition at line 892 of file THM1176.cpp.
bool CTHM1176Instrument::ParmRangeGet | ( | sRange< sBoundedParm > & | rRange | ) |
Fetch currently selected measurement range, incl. min/max/default.
[out] | rRange | Measurement range, incl. min/max/default. |
Definition at line 1241 of file THM1176.cpp.
bool CTHM1176Instrument::ParmRangeGet | ( | sRange< uParm > & | rRange | ) |
Fetch currently selected measurement range.
[out] | rRange | Measurement range. |
Definition at line 1204 of file THM1176.cpp.
bool CTHM1176Instrument::ParmRangeSet | ( | const sRange< uParm > & | rRange | ) |
Set measurement range.
[in] | rRange | Desired measurement range. |
Definition at line 1178 of file THM1176.cpp.
bool CTHM1176Instrument::ParmSleepGet | ( | bool & | rSleep | ) |
Fetch parameter whether to sleep after each acquisition.
[out] | rSleep | Whether or not to sleep. |
Definition at line 964 of file THM1176.cpp.
bool CTHM1176Instrument::ParmSleepSet | ( | bool | Sleep | ) |
Set parameter whether to sleep after each acquisition.
[in] | Sleep | Whether or not to sleep. |
Definition at line 954 of file THM1176.cpp.
bool CTHM1176Instrument::ParmTriggerInputGet | ( | sInputTrigger< sBoundedParm > & | rInputTrig | ) |
Fetch current trigger input parameters, incl. min/max/default.
[out] | rInputTrig | Trigger input parameters, incl. min/max/default. |
Definition at line 1056 of file THM1176.cpp.
bool CTHM1176Instrument::ParmTriggerInputGet | ( | sInputTrigger< uParm > & | rInputTrig | ) |
Fetch current trigger input parameters.
[out] | rInputTrig | Trigger input parameters. |
Definition at line 1012 of file THM1176.cpp.
bool CTHM1176Instrument::ParmTriggerInputSet | ( | const sInputTrigger< uParm > & | rInputTrig | ) |
Set trigger input parameters.
[in] | rInputTrig | Trigger input parameters. |
Definition at line 974 of file THM1176.cpp.
bool CTHM1176Instrument::ParmUnitsGet | ( | eUnits & | rUnits | ) |
Fetch currently selected measurement units.
[out] | rUnits | Measurement units. |
Definition at line 1128 of file THM1176.cpp.
bool CTHM1176Instrument::ParmUnitsSet | ( | eUnits | Units | ) |
Set measurement units.
[in] | Units | Measurement units. |
Definition at line 1106 of file THM1176.cpp.
bool CTHM1176Instrument::ParmUseCalibrationGet | ( | bool & | rUseCal | ) |
Fetch parameter whether to return calibrated results.
[out] | rUseCal | Whether to return calibrated results. |
Definition at line 1168 of file THM1176.cpp.
bool CTHM1176Instrument::ParmUseCalibrationSet | ( | bool | UseCal | ) |
Set whether to return calibrated results.
[in] | UseCal | Whether to return calibrated results. |
Definition at line 1151 of file THM1176.cpp.
bool CTHM1176Instrument::ReadFile | ( | std::string | Path, |
std::string & | rContent | ||
) |
Read a file from the instrument's file system.
[in] | Path | Path of file to be read. |
[out] | rContent | Contents of file. |
Definition at line 1357 of file THM1176.cpp.
bool CTHM1176Instrument::ReadFileDirectory | ( | U32 & | rUsedBytes, |
U32 & | rAvailableBytes, | ||
tFileList & | rFileList | ||
) |
Read the instrument's file directory information.
[out] | rUsedBytes | Number of bytes occupied by files. |
[out] | rAvailableBytes | Number of bytes still available. |
[out] | rFileList | List of files. |
Definition at line 1293 of file THM1176.cpp.
bool CTHM1176Instrument::ReadInformationDates | ( | std::string & | rSManufacturingDate, |
std::time_t & | rManufacturingDate, | ||
std::string & | rSCalibrationDate, | ||
std::time_t & | rCalibrationDate | ||
) |
Fetch the intrument's date information.
[out] | rSManufacturingDate | Manufacturing date as string. |
[out] | rManufacturingDate | Manufacturing date as time structure. |
[out] | rSCalibrationDate | Calibration date as string. |
[out] | rCalibrationDate | Calibration date as time structure. |
Definition at line 2166 of file THM1176.cpp.
bool CTHM1176Instrument::Reset |
Reset the instrument to power-on configuration.
Definition at line 2104 of file THM1176.cpp.
bool CTHM1176Instrument::RestoreZeroOffset |
Restore the factory values for the Zero Offset.
Definition at line 2074 of file THM1176.cpp.
bool CTHM1176Instrument::SendBusTrigger |
bool CTHM1176Instrument::SetFormat | ( | eCommunicationFormat | Format | ) |
Select whether data is returned as text or binary.
[in] | Format | Select text or binary. |
Definition at line 1625 of file THM1176.cpp.
bool CTHM1176Instrument::StatusGet | ( | RegisterList | Regs, |
StatusValues & | rStatus | ||
) |
Fetch current values of a list of status registers.
[in] | Regs | Registers to fetch. |
[out] | rStatus | Register values; zero if error. |
Definition at line 1851 of file THM1176.cpp.
bool CTHM1176Instrument::StatusGet | ( | sStatusRegister | Reg, |
U16 & | rStatus | ||
) |
Fetch current value of a single status register.
[in] | Reg | Register to fetch. |
[out] | rStatus | Register value; zero if error. |
Definition at line 1822 of file THM1176.cpp.
bool CTHM1176Instrument::StatusPreset |
Reset OPERation and QUEStionable enable registers.
Definition at line 1813 of file THM1176.cpp.
bool CTHM1176Instrument::StatusSetEnableRegister | ( | eStatusRegisterSet | Set, |
U16 | DisableMask, | ||
U16 | EnableMask | ||
) |
Disable and enable bits in the given enable register.
[in] | Set | Register set whose enable register is to be modified. |
[in] | DisableMask | Bits to be disabled. |
[in] | EnableMask | Bits to be enabled. |
Note: The DisableMask is applied before the EnableMask, so the EnableMask takes precedence.
Definition at line 1895 of file THM1176.cpp.
bool CTHM1176Instrument::SwitchToDFUMode |
Enter the Device Firmware Upgrade mode.
Note: This function is intended for use by the manufacturer only. It can cause your instrument to become nonoperational.
Definition at line 2156 of file THM1176.cpp.
bool CTHM1176Instrument::WriteAndRead | ( | const std::string & | rWriteStr, |
CSCPIBuffer & | rReadBuffer | ||
) |
Write an arbitrary command and read the result.
[in] | rWriteStr | Command to write. |
[out] | rReadBuffer | Returned result. |
Definition at line 296 of file THM1176.cpp.