 |
THM1176InstrumentManager
1.0
Qt Object abstraction for Metrolab THM1176
|
Go to the documentation of this file.
150 #if (THM1176_INSTRUMENT_TYPE_IS_VISA)
152 #define THM1176_RSRC_MGR_CLS CVISAResourceManager
153 #define THM1176_INSTR_CLS CVISAInstrument
154 #define THM1176_RSRC_FILTER "USB[0-9]*::0x1BFA::0x0498::[0-9]+::INSTR"
156 #elif (THM1176_INSTRUMENT_TYPE_IS_USBTMC)
158 #define THM1176_RSRC_MGR_CLS CUSBTMCResourceManager
159 #define THM1176_INSTR_CLS CUSBTMCInstrument
160 #define THM1176_RSRC_FILTER "7162:1176"
163 #error "One of THM1176_INSTRUMENT_TYPE_IS_VISA or ..._USBTMC must be defined"
166 #include <QtCore/QThread>
167 #include <QtCore/QTimer>
168 #include <QtCore/QString>
169 #include <QtCore/QDateTime>
214 Q_DECLARE_METATYPE(THM1176_INSTR_CLS *)
215 Q_DECLARE_METATYPE(THM1176_RSRC_MGR_CLS *)
241 THM1176_RSRC_MGR_CLS * m_pResourceManager;
246 void timerEvent (QTimerEvent * Event)
override;
247 void HandleError (QString Description,
256 m_pResourceManager(nullptr)
268 void Start (THM1176_RSRC_MGR_CLS * pResourceManager);
301 static constexpr
F32 MU0 = 1.256637061436E-6f;
307 THM1176_RSRC_MGR_CLS * m_pResourceManager;
335 bool m_CalibrationOverride;
340 void HandleError (QString Description,
342 void ClearInstrumentInfo (
void);
343 void GetInstrumentInfo (std::string Context);
344 void GetInstrumentParameters (std::string Context);
345 void MakeUnitsList (std::string Context);
346 void GetCurrentUnits (std::string Context);
349 void PublishInstrumentInfo (
void);
350 void PublishInstrumentParameters (
void);
351 void timerEvent (QTimerEvent * Event)
override;
359 m_pResourceManager(nullptr),
367 m_CalibrationOverride(false)
369 m_AveragingParmBounds.
clear();
370 m_TriggerParmBounds.
clear();
371 m_RangeParmBounds.
clear();
373 m_AveragingParms.
clear();
374 m_TriggerParms.
clear();
375 m_OutputSelect.
clear();
376 m_RangeParms.
clear();
390 void Start (THM1176_RSRC_MGR_CLS * pResourceManager);
410 void SendTrigger (
void);
427 void SetSleepParm (
bool SleepParm);
444 void SetCalibrationOverride (
bool Override);
547 Q_PROPERTY(
CResourceList InstrumentList READ GetInstrumentList NOTIFY NotifyInstrumentList)
549 Q_PROPERTY(
tResourceName CurrentInstrument READ GetCurrentInstrument WRITE SetCurrentInstrument NOTIFY NotifyCurrentInstrument)
551 Q_PROPERTY(
eTHM1176OperatingMode OperatingMode READ GetOperatingMode WRITE SetOperatingMode NOTIFY NotifyOperatingMode)
553 Q_PROPERTY(
CMeasurement Measurement READ GetMeasurement NOTIFY NotifyMeasurement)
555 Q_PROPERTY(
CErrorList ErrorList READ GetErrorList NOTIFY NotifyErrorList)
559 Q_PROPERTY(
sIdentifier Identification READ GetIdentification NOTIFY NotifyIdentification)
561 Q_PROPERTY(
CFluxList RangeList READ GetRangeList NOTIFY NotifyRangeList)
565 Q_PROPERTY(
CDivisorList DivisorList READ GetDivisorList NOTIFY NotifyDivisorList)
567 Q_PROPERTY(
sAveraging<sBoundedParm> AveragingParmBounds READ GetAveragingParmBounds NOTIFY NotifyAveragingParmBounds)
571 Q_PROPERTY(
sRange<sBoundedParm> RangeParmBounds READ GetRangeParmBounds NOTIFY NotifyRangeParmBounds)
575 Q_PROPERTY(
sAveraging<uParm> AveragingParms READ GetAveragingParms WRITE SetAveragingParms NOTIFY NotifyAveragingParms)
577 Q_PROPERTY(
sInputTrigger<uParm> TriggerParms READ GetTriggerParms WRITE SetTriggerParms NOTIFY NotifyTriggerParms)
579 Q_PROPERTY(
sArbitraryMeasurements OutputSelect READ GetOutputSelect WRITE SetOutputSelect NOTIFY NotifyOutputSelect)
581 Q_PROPERTY(
bool SleepParm READ GetSleepParm WRITE SetSleepParm NOTIFY NotifySleepParm)
583 Q_PROPERTY(
eTHM1176Units Units READ GetUnits WRITE SetUnits NOTIFY NotifyUnits)
585 Q_PROPERTY(
sRange<uParm> RangeParms READ GetRangeParms WRITE SetRangeParms NOTIFY NotifyRangeParms)
587 Q_PROPERTY(
eCommunicationFormat CommFormat READ GetCommFormat WRITE SetCommFormat NOTIFY NotifyCommFormat)
593 static const U8 THM1176_MIN_VERSION_WITH_ABORTREAD = 4;
628 QThread m_InstrumentControlThread;
632 QThread m_InstrumentScanThread;
635 THM1176_RSRC_MGR_CLS * m_pResourceManager;
642 void HandleError (QString Description, QString Context);
648 static const I32 THM1176_INST_MGR_ERROR = 5000;
649 static const I32 THM1176_INST_CTLR_ERROR = 5001;
650 static const I32 THM1176_INST_SCANNER_ERROR = 5002;
661 m_pInstrumentController(nullptr),
662 m_pInstrumentScanner(nullptr),
666 qRegisterMetaType<eTHM1176Units>();
667 qRegisterMetaType<eTHM1176OperatingMode>();
668 qRegisterMetaType<eCommunicationFormat>();
670 qRegisterMetaType<tResourceName>();
672 qRegisterMetaType<sIdentifier>();
673 qRegisterMetaType<sArbitraryMeasurements>();
674 qRegisterMetaType<CMeasurement>();
676 qRegisterMetaType<CResourceList>();
677 qRegisterMetaType<CFluxList>();
678 qRegisterMetaType<CTHM1176UnitsList>();
679 qRegisterMetaType<CDivisorList>();
680 qRegisterMetaType<CErrorList>();
682 qRegisterMetaType<sAveraging<uParm>>();
683 qRegisterMetaType<sAveraging<sBoundedParm>>();
684 qRegisterMetaType<sInputTrigger<uParm>>();
685 qRegisterMetaType<sInputTrigger<sBoundedParm>>();
686 qRegisterMetaType<sRange<uParm>>();
687 qRegisterMetaType<sRange<sBoundedParm>>();
690 qRegisterMetaType<THM1176_RSRC_MGR_CLS *>();
766 bool GetSleepParm (
void);
792 if (m_pTHM1176 ==
nullptr)
794 HandleError(
"Instrument not connected", __func__);
807 bool ReadInformationDates (QDateTime & rManufacturingDate, QDateTime & rCalibrationDate);
838 void SetSleepParm (
bool SleepParm);
862 void UpdateCurrentInstrument (
tResourceName CurrentInstrument);
869 void UpdateIdentification (
sIdentifier Identification);
870 void UpdateRangeList (
CFluxList RangeList);
881 void UpdateSleepParm (
bool SleepParm);
void UpdateOperatingMode(eTHM1176OperatingMode OperatingMode)
Signal that the operating mode has changed.
void UpdateRangeParmBounds(sRange< sBoundedParm > RangeParmBounds)
Signal to report bounds of range parameters for newly connected instrument.
void NotifyCurrentInstrument(tResourceName CurrentInstrument)
Notify that the currently connected instrument has changed.
List of VISA resource names.
void SendTrigger(void)
Send a bus trigger to the instrument (both slot and signal).
List of measurement units.
void NotifyTriggerParms(sInputTrigger< uParm > TriggerParms)
Notify that the trigger parameters have changed.
void RelayAveragingParms(sAveraging< uParm > AveragingParms)
Internal signal to relay the averaging parameters to the Instrument Controller.
eUnits
Enumeration of possible measurement units.
void RelayCommFormat(eCommunicationFormat CommFormat)
Internal signal to relay the communications format to the Instrument Controller.
float F32
32-bit floating-point number.
Type definitions for THM1176 Instrument Manager.
void NotifyErrorList(CErrorList ErrorList)
Notify that new errors are present.
void NotifyRangeList(CFluxList RangeList)
Notify that the list of valid ranges has changed.
unsigned long long U64
64-bit unsigned integer.
void UpdateOutputSelect(sArbitraryMeasurements OutputSelect)
Signal a change of the output selection parameters.
void UpdateCurrentInstrument(tResourceName CurrentInstrument)
Signal that current instrument selection has changed.
Specify the measurement data to be returned.
void UpdateAveragingParms(sAveraging< uParm > AveragingParms)
Signal a change of the averaging parameters.
void clear(void)
Clear to default (zero).
#define THM1176_SCAN_INTERVAL
void NotifyOperatingMode(eTHM1176OperatingMode OperatingMode)
Notify that the operating mode has changed.
void UpdateUnitsList(CTHM1176UnitsList UnitsList)
Signal to report list of valid measurement units for newly connected instrument.
void RelayUnits(eTHM1176Units Units)
Internal signal to relay the measurement units to the Instrument Controller.
void NotifyRangeParms(sRange< uParm > RangeParms)
Notify that the range parameters have changed.
void UpdateInstrumentPointer(CTHM1176Instrument< THM1176_INSTR_CLS, THM1176_RSRC_MGR_CLS > *pTHM1176)
Signal to broadcast updated pointer to THM1176 Instrument object.
THM1176 Instrument Controller class: communicate with instrument.
void NotifyAveragingParms(sAveraging< uParm > AveragingParms)
Notify that the averaging parameters have changed.
void UpdateDivisorList(CDivisorList DivisorList)
Signal to report divisors associated with valid measurement units for newly connected instrument.
~CTHM1176InstrumentManager(void)
Destructor.
CTHM1176InstrumentScanner(void)
Constructor.
@ kComFormatAscii
Human-legible text.
void clear()
Clear to default values.
void RelaySleepParm(bool SleepParm)
Internal signal to relay the sleep parameter to the Instrument Controller.
void StartInstrumentController(THM1176_RSRC_MGR_CLS *pResourceManager)
Internal signal to start to Instrument Controller.
List of divisors, one per measurement unit.
void UpdateAveragingParmBounds(sAveraging< sBoundedParm > AveragingParmBounds)
Signal to report bounds of averaging parameters for newly connected instrument.
CTHM1176InstrumentController(void)
Constructor.
void UpdateTriggerParms(sInputTrigger< uParm > TriggerParms)
Signal a change of the trigger parameters.
Instrument's identification string - parsed version.
void NotifyUnits(eTHM1176Units Units)
Notify that the measurement units have changed.
void NotifyCommFormat(eCommunicationFormat CommFormat)
Notify that the communication format parameters have changed.
eCommunicationFormat
Enumeration of possible formats for returned data.
void RelayOutputSelect(sArbitraryMeasurements OutputSelect)
Internal signal to relay the output selection parameters to the Instrument Controller.
void StopInstrumentScanner(void)
Internal signal to stop the Instrument Scanner.
void clear(void)
Clear to default values.
void UpdateTriggerParmBounds(sInputTrigger< sBoundedParm > TriggerParmBounds)
Signal to report bounds of trigger parameters for newly connected instrument.
void NotifyAveragingParmBounds(sAveraging< sBoundedParm > AveragingParmBounds)
Notify that the bounds on averaging parameters have changed.
THM1176 Instrument Manager class: public interface.
void UpdateErrorList(CErrorList LatestErrors)
Signal that new errors have been reported.
void UpdateCommFormat(eCommunicationFormat CommFormat)
Signal a change of the communication format.
void RelayCurrentInstrument(tResourceName CurrentInstrument)
Internal signal to relay the instrument selection to the Instrument Controller.
eTHM1176Units
Enumeration of possible measurement units, including "ADC".
void RelayOperatingMode(eTHM1176OperatingMode OperatingMode)
Internal signal to relay the operating mode selection to the Instrument Controller.
bool ConvertTimestamp(const U64 RawTimestamp, CAbsoluteTimestamp &rTimestamp)
Convert a raw timestamp to UNIX Epoch time and nanoseconds.
void NotifySleepParm(bool SleepParm)
Notify that the sleep parameter has changed.
int I32
32-bit signed integer.
Timestamp for a measurement.
void StopInstrumentController(void)
Internal signal to stop the Instrument Controller.
~CTHM1176InstrumentScanner(void) override
Destructor.
void NotifyDivisorList(CDivisorList DivisorList)
Notify that the list of divisors associated with each measurement unit for this instrument model has ...
void NotifyMeasurement(CMeasurement Measurement)
Notify that a new set of measurements is available.
void StartInstrumentScanner(THM1176_RSRC_MGR_CLS *pResourceManager)
Internal signal to start the Instrument Scanner.
bool ConvertTimestamp(const U64 RawTimestamp, CAbsoluteTimestamp &rTimestamp)
Convert a raw timestamp to UNIX Epoch time and nanoseconds.
~CTHM1176InstrumentController(void) override
Destructor.
USBTMC driver based on libusb: interface definition.
void UpdateIdentification(sIdentifier Identification)
Signal to report identifier information for newly connected instrument.
void RelayTriggerParms(sInputTrigger< uParm > TriggerParms)
Internal signal to relay the trigger parameters to the Instrument Controller.
void UpdateRangeParms(sRange< uParm > RangeParms)
Signal a change of the range parameters.
std::string tResourceName
IEEE488 resource name.
CTHM1176InstrumentManager(void)
Constructor.
void NotifyTriggerParmBounds(sInputTrigger< sBoundedParm > TriggerParmBounds)
Notify that the bounds on trigger parameters have changed.
void NotifyIdentification(sIdentifier Identification)
Notify that the instrument identification information has changed.
List of flux density values.
void NotifyUnitsList(CTHM1176UnitsList UnitsList)
Notify that the list of valid measurement units has changed.
void SetCalibrationOverride(bool Override)
Set whether or not to override the check for instruments whose zero offset should not be calibrated.
eTHM1176OperatingMode
Operating modes used to initiate actions or provide status.
Data returned for one measurement.
THM1176 Instrument Scanner class: scan for connected instruments.
void UpdateUnits(eTHM1176Units Units)
Signal a change of the measurement units.
unsigned char U8
Unsigned byte.
C++ wrapper for NI-VISA: interface definition.
List of errors returned by the instrument.
unsigned short U16
16-bit unsigned integer.
void NotifyRangeParmBounds(sRange< sBoundedParm > RangeParmBounds)
Notify that the bounds on range parameters have changed.
void UpdateRangeList(CFluxList RangeList)
Signal to report list of valid ranges for newly connected instrument.
double F64
64-bit floating-point number.
unsigned int U32
32-bit unsigned integer.
void UpdateInstrumentList(CResourceList InstrumentList)
An update to the instrument list is available.
void UpdateErrorList(CErrorList ErrorList)
An update to the error list is available.
void UpdateMeasurement(CMeasurement Measurement)
Signal that a new measurement is available.
@ kTHM1176NotConnected
Disconnect instrument.
void RelayRangeParms(sRange< uParm > RangeParms)
Internal signal to relay the range parameters to the Instrument Controller.
void UpdateSleepParm(bool SleepParm)
Signal a change of the sleep parameter.
void NotifyInstrumentList(CResourceList InstrumentList)
Notify that the list of detected instruments has changed.
void NotifyOutputSelect(sArbitraryMeasurements OutputSelect)
Notify that the output selection parameters have changed.