THM1176InstrumentManager  1.0
Qt Object abstraction for Metrolab THM1176
CTHM1176InstrumentManager.h
Go to the documentation of this file.
1 // Copyright (c) 2020 Metrolab Technology S.A., Geneva, Switzerland (www.metrolab.com)
2 // See the included file LICENSE.txt for the licensing conditions.
3 
7 
145 
146 #pragma once
147 
149 
150 #if (THM1176_INSTRUMENT_TYPE_IS_VISA)
151  #include "VISAInstrument.h"
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"
155  #include "VISAInstrument.h"
156 #elif (THM1176_INSTRUMENT_TYPE_IS_USBTMC)
157  #include "USBTMCInstrument.h"
158  #define THM1176_RSRC_MGR_CLS CUSBTMCResourceManager
159  #define THM1176_INSTR_CLS CUSBTMCInstrument
160  #define THM1176_RSRC_FILTER "7162:1176"
161  #include "USBTMCInstrument.h"
162 #else
163  #error "One of THM1176_INSTRUMENT_TYPE_IS_VISA or ..._USBTMC must be defined"
164 #endif
165 
166 #include <QtCore/QThread>
167 #include <QtCore/QTimer>
168 #include <QtCore/QString>
169 #include <QtCore/QDateTime>
170 
171 using namespace MTL;
172 using namespace MTL::Instrument;
173 using namespace MTL::Instrument::THM1176Types;
174 
175 //----------------------------------------------------------------------//
176 // Type definitions //
177 //----------------------------------------------------------------------//
178 namespace MTL
179 {
180 Q_NAMESPACE
181 Q_ENUM_NS(eTHM1176OperatingMode)
182 Q_ENUM_NS(eTHM1176Units)
183 }
184 
185 //----------------------------------------------------------------------//
186 // Qt meta-type declarations //
187 //----------------------------------------------------------------------//
188 Q_DECLARE_METATYPE(eTHM1176Units)
189 Q_DECLARE_METATYPE(eTHM1176OperatingMode)
190 Q_DECLARE_METATYPE(eCommunicationFormat)
191 
192 Q_DECLARE_METATYPE(tResourceName)
193 
194 Q_DECLARE_METATYPE(sIdentifier)
195 Q_DECLARE_METATYPE(sArbitraryMeasurements)
196 Q_DECLARE_METATYPE(CMeasurement)
197 
198 Q_DECLARE_METATYPE(CResourceList)
199 Q_DECLARE_METATYPE(CFluxList)
200 Q_DECLARE_METATYPE(CTHM1176UnitsList)
201 Q_DECLARE_METATYPE(CDivisorList)
202 Q_DECLARE_METATYPE(CErrorList)
203 
204 Q_DECLARE_METATYPE(sAveraging<uParm>)
205 Q_DECLARE_METATYPE(sAveraging<sBoundedParm>)
206 Q_DECLARE_METATYPE(sInputTrigger<uParm>)
207 Q_DECLARE_METATYPE(sInputTrigger<sBoundedParm>)
208 Q_DECLARE_METATYPE(sRange<uParm>)
209 Q_DECLARE_METATYPE(sRange<sBoundedParm>)
210 
211 //----------------------------------------------------------------------//
212 // Qt meta-type declarations //
213 //----------------------------------------------------------------------//
214 Q_DECLARE_METATYPE(THM1176_INSTR_CLS *)
215 Q_DECLARE_METATYPE(THM1176_RSRC_MGR_CLS *)
216 
217 namespace MTL
218 {
226 class CTHM1176InstrumentScanner : public QObject
227 {
228  Q_OBJECT
229 
230 private:
231  //----------------------------------------------------------------------//
232  // THM1176 Instrument Scanner constants //
233  //----------------------------------------------------------------------//
234  static const U32 THM1176_SCAN_INTERVAL = 1000; // ms
235 
236  //----------------------------------------------------------------------//
237  // THM1176 Instrument Scanner class variables //
238  //----------------------------------------------------------------------//
239  int m_TimerID;
240  CResourceList m_InstrumentList;
241  THM1176_RSRC_MGR_CLS * m_pResourceManager;
242 
243  //----------------------------------------------------------------------//
244  // THM1176 Instrument Scanner private methods //
245  //----------------------------------------------------------------------//
246  void timerEvent (QTimerEvent * Event) override;
247  void HandleError (QString Description,
248  QString Context);
249 
250 public:
251  //----------------------------------------------------------------------//
252  // THM1176 Instrument Scanner constructor / destructor //
253  //----------------------------------------------------------------------//
256  m_pResourceManager(nullptr)
257  { }
260  { }
261 
262 public slots:
263  //----------------------------------------------------------------------//
264  // THM1176 Instrument Scanner slots //
265  //----------------------------------------------------------------------//
268  void Start (THM1176_RSRC_MGR_CLS * pResourceManager);
270  void Stop (void);
271 
272 signals:
273  //----------------------------------------------------------------------//
274  // THM1176 Instrument Scanner signals //
275  //----------------------------------------------------------------------//
278  void UpdateInstrumentList (CResourceList InstrumentList);
281  void UpdateErrorList (CErrorList ErrorList);
282 
283 }; // CTHM1176InstrumentScanner
284 
285 
292 class CTHM1176InstrumentController : public QObject
293 {
294  Q_OBJECT
295 
296 private:
297  //----------------------------------------------------------------------//
298  // THM1176 Instrument Controller constants //
299  //----------------------------------------------------------------------//
300  static constexpr U32 THM1176_CONNECT_TIMEOUT = 5000; // ms
301  static constexpr F32 MU0 = 1.256637061436E-6f; // Magnetic permeability of vacuum
302 
303  //----------------------------------------------------------------------//
304  // THM1176 Instrument Controller class variables //
305  //----------------------------------------------------------------------//
306  // Connection
307  THM1176_RSRC_MGR_CLS * m_pResourceManager;
309  m_pTHM1176;
310  CResourceList m_InstrumentList;
311  tResourceName m_CurrentInstrument;
312 
313  // Instrument information and parameter bounds:
314  sIdentifier m_Identification;
315  CFluxList m_RangeList;
316  CTHM1176UnitsList m_UnitsList;
317  CDivisorList m_DivisorList;
318  sAveraging<sBoundedParm> m_AveragingParmBounds;
319  sInputTrigger<sBoundedParm> m_TriggerParmBounds;
320  sRange<sBoundedParm> m_RangeParmBounds;
321 
322  // Parameters
323  sAveraging<uParm> m_AveragingParms;
324  sInputTrigger<uParm> m_TriggerParms;
325  sArbitraryMeasurements m_OutputSelect;
326  bool m_SleepParm;
327  eTHM1176Units m_Units;
328  sRange<uParm> m_RangeParms;
329  eCommunicationFormat m_CommFormat;
330 
331  // Control parameters
332  eTHM1176OperatingMode m_OperatingMode;
333  U16 m_TriggerCount;
334  int m_TimerID;
335  bool m_CalibrationOverride;
336 
337  //----------------------------------------------------------------------//
338  // THM1176 Instrument Controller private methods //
339  //----------------------------------------------------------------------//
340  void HandleError (QString Description,
341  QString Context);
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);
347  void TranslateUnits (CMeasurement & Measurement,
348  eUnits Units);
349  void PublishInstrumentInfo (void);
350  void PublishInstrumentParameters (void);
351  void timerEvent (QTimerEvent * Event) override;
352 
353 public:
354  //----------------------------------------------------------------------//
355  // THM1176 Instrument Controller constructor / destructor //
356  //----------------------------------------------------------------------//
359  m_pResourceManager(nullptr),
360  m_pTHM1176(nullptr),
361  m_SleepParm(false),
362  m_Units(kT),
363  m_CommFormat(kComFormatAscii),
364  m_OperatingMode(kTHM1176NotConnected),
365  m_TriggerCount(0),
366  m_TimerID(0),
367  m_CalibrationOverride(false)
368  {
369  m_AveragingParmBounds.clear();
370  m_TriggerParmBounds.clear();
371  m_RangeParmBounds.clear();
372 
373  m_AveragingParms.clear();
374  m_TriggerParms.clear();
375  m_OutputSelect.clear();
376  m_RangeParms.clear();
377  }
378 
381  { }
382 
383 public slots:
384  //----------------------------------------------------------------------//
385  // THM1176 Instrument Controller slots //
386  //----------------------------------------------------------------------//
387  // Startup and shutdown.
390  void Start (THM1176_RSRC_MGR_CLS * pResourceManager);
391 
393  void Stop (void);
394 
395  // Connection
398  void UpdateInstrumentList (CResourceList InstrumentList);
399 
402  void SetCurrentInstrument (tResourceName CurrentInstrument);
403 
404  // Instrument control
407  void SetOperatingMode (eTHM1176OperatingMode OperatingMode);
408 
410  void SendTrigger (void);
411 
412  // Parameters
415  void SetAveragingParms (sAveraging<uParm> AveragingParms);
416 
419  void SetTriggerParms (sInputTrigger<uParm> TriggerParms);
420 
423  void SetOutputSelect (sArbitraryMeasurements OutputSelect);
424 
427  void SetSleepParm (bool SleepParm);
428 
431  void SetUnits (eTHM1176Units Units);
432 
435  void SetRangeParms (sRange<uParm> RangeParms);
436 
439  void SetCommFormat (eCommunicationFormat CommFormat);
440 
444  void SetCalibrationOverride (bool Override);
445 
446 signals:
447  //----------------------------------------------------------------------//
448  // THM1176 Instrument Controller signals //
449  //----------------------------------------------------------------------//
450  // Basic instrument control:
453  void UpdateCurrentInstrument (tResourceName CurrentInstrument);
454 
458 
462 
465  void UpdateMeasurement (CMeasurement Measurement);
466 
469  void UpdateErrorList (CErrorList LatestErrors);
470 
471  // Instrument information and parameter bounds:
474  void UpdateIdentification (sIdentifier Identification);
475 
478  void UpdateRangeList (CFluxList RangeList);
479 
483 
486  void UpdateDivisorList (CDivisorList DivisorList);
487 
491 
495 
499 
500  // Parameters
504 
508 
512 
515  void UpdateSleepParm (bool SleepParm);
516 
520 
523  void UpdateRangeParms (sRange<uParm> RangeParms);
524 
528 
529 }; // CTHM1176InstrumentController
530 
531 
538 class CTHM1176InstrumentManager : public QObject
539 {
540  Q_OBJECT
541 
542  //----------------------------------------------------------------------//
543  // THM1176 Instrument Manager properties //
544  //----------------------------------------------------------------------//
545  // Basic instrument control:
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)
556 
557  // Instrument information and parameter bounds:
559  Q_PROPERTY(sIdentifier Identification READ GetIdentification NOTIFY NotifyIdentification)
561  Q_PROPERTY(CFluxList RangeList READ GetRangeList NOTIFY NotifyRangeList)
563  Q_PROPERTY(CTHM1176UnitsList UnitsList READ GetUnitsList NOTIFY NotifyUnitsList)
565  Q_PROPERTY(CDivisorList DivisorList READ GetDivisorList NOTIFY NotifyDivisorList)
567  Q_PROPERTY(sAveraging<sBoundedParm> AveragingParmBounds READ GetAveragingParmBounds NOTIFY NotifyAveragingParmBounds)
569  Q_PROPERTY(sInputTrigger<sBoundedParm> TriggerParmBounds READ GetTriggerParmBounds NOTIFY NotifyTriggerParmBounds)
571  Q_PROPERTY(sRange<sBoundedParm> RangeParmBounds READ GetRangeParmBounds NOTIFY NotifyRangeParmBounds)
572 
573  // Parameters:
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)
588 
589 private:
590  //----------------------------------------------------------------------//
591  // THM1176 Instrument Manager constants //
592  //----------------------------------------------------------------------//
593  static const U8 THM1176_MIN_VERSION_WITH_ABORTREAD = 4;
594 
595  //----------------------------------------------------------------------//
596  // THM1176 Instrument Manager class variables - properties //
597  //----------------------------------------------------------------------//
598  // Basic instrument control:
599  CResourceList m_InstrumentList;
600  tResourceName m_CurrentInstrument;
601  eTHM1176OperatingMode m_OperatingMode;
602  CMeasurement m_Measurement;
603  CErrorList m_ErrorList;
604 
605  // Instrument information and parameter bounds:
606  sIdentifier m_Identification;
607  CFluxList m_RangeList;
608  CTHM1176UnitsList m_UnitsList;
609  CDivisorList m_DivisorList;
610  sAveraging<sBoundedParm> m_AveragingParmBounds;
611  sInputTrigger<sBoundedParm> m_TriggerParmBounds;
612  sRange<sBoundedParm> m_RangeParmBounds;
613 
614  // Parameters:
615  sAveraging<uParm> m_AveragingParms;
616  sInputTrigger<uParm> m_TriggerParms;
617  sArbitraryMeasurements m_OutputSelect;
618  bool m_SleepParm;
619  eTHM1176Units m_Units;
620  sRange<uParm> m_RangeParms;
621  eCommunicationFormat m_CommFormat;
622 
623  //----------------------------------------------------------------------//
624  // THM1176 Instrument Manager class variables - other //
625  //----------------------------------------------------------------------//
626  // Instrument Controller
627  CTHM1176InstrumentController* m_pInstrumentController;
628  QThread m_InstrumentControlThread;
629 
630  // Instrument Scanner
631  CTHM1176InstrumentScanner* m_pInstrumentScanner;
632  QThread m_InstrumentScanThread;
633 
634  // Instrument connection
635  THM1176_RSRC_MGR_CLS * m_pResourceManager;
637  m_pTHM1176;
638 
639  //----------------------------------------------------------------------//
640  // THM1176 Instrument Manager private methods //
641  //----------------------------------------------------------------------//
642  void HandleError (QString Description, QString Context);
643 
644 public:
645  //----------------------------------------------------------------------//
646  // THM1176 Instrument Manager public constants //
647  //----------------------------------------------------------------------//
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;
651 
652  //----------------------------------------------------------------------//
653  // THM1176 Instrument Manager constructor / destructor //
654  //----------------------------------------------------------------------//
657  m_OperatingMode(kTHM1176NotConnected),
658  m_SleepParm(false),
659  m_Units(kT),
660  m_CommFormat(kComFormatAscii),
661  m_pInstrumentController(nullptr),
662  m_pInstrumentScanner(nullptr),
663  m_pTHM1176(nullptr)
664  {
665 
666  qRegisterMetaType<eTHM1176Units>();
667  qRegisterMetaType<eTHM1176OperatingMode>();
668  qRegisterMetaType<eCommunicationFormat>();
669 
670  qRegisterMetaType<tResourceName>();
671 
672  qRegisterMetaType<sIdentifier>();
673  qRegisterMetaType<sArbitraryMeasurements>();
674  qRegisterMetaType<CMeasurement>();
675 
676  qRegisterMetaType<CResourceList>();
677  qRegisterMetaType<CFluxList>();
678  qRegisterMetaType<CTHM1176UnitsList>();
679  qRegisterMetaType<CDivisorList>();
680  qRegisterMetaType<CErrorList>();
681 
682  qRegisterMetaType<sAveraging<uParm>>();
683  qRegisterMetaType<sAveraging<sBoundedParm>>();
684  qRegisterMetaType<sInputTrigger<uParm>>();
685  qRegisterMetaType<sInputTrigger<sBoundedParm>>();
686  qRegisterMetaType<sRange<uParm>>();
687  qRegisterMetaType<sRange<sBoundedParm>>();
688 
689  // Meta-types to be passed internally.
690  qRegisterMetaType<THM1176_RSRC_MGR_CLS *>();
691 
692  }
693 
696  { }
697 
698  //----------------------------------------------------------------------//
699  // THM1176 Instrument Manager property Get methods //
700  //----------------------------------------------------------------------//
701  // Basic instrument control:
704  CResourceList GetInstrumentList (void);
705 
708  tResourceName GetCurrentInstrument (void);
709 
712  eTHM1176OperatingMode GetOperatingMode (void);
713 
716  CMeasurement GetMeasurement (void);
717 
720  CErrorList GetErrorList (void);
721 
722  // Instrument information and parameter bounds:
725  sIdentifier GetIdentification (void);
726 
729  CFluxList GetRangeList (void);
730 
733  CTHM1176UnitsList GetUnitsList (void);
734 
737  CDivisorList GetDivisorList (void);
738 
741  sAveraging<sBoundedParm> GetAveragingParmBounds (void);
742 
745  sInputTrigger<sBoundedParm> GetTriggerParmBounds (void);
746 
749  sRange<sBoundedParm> GetRangeParmBounds (void);
750 
751  // Parameters:
754  sAveraging<uParm> GetAveragingParms (void);
755 
758  sInputTrigger<uParm> GetTriggerParms (void);
759 
762  sArbitraryMeasurements GetOutputSelect (void);
763 
766  bool GetSleepParm (void);
767 
770  eTHM1176Units GetUnits (void);
771 
774  sRange<uParm> GetRangeParms (void);
775 
778  eCommunicationFormat GetCommFormat (void);
779 
784  bool GetImmediateMeasurementPeriod(const sAveraging<uParm> & rAvg, F64 & rPeriod);
785 
790  inline bool ConvertTimestamp (const U64 RawTimestamp, CAbsoluteTimestamp & rTimestamp)
791  {
792  if (m_pTHM1176 == nullptr)
793  {
794  HandleError("Instrument not connected", __func__);
795  return false;
796  }
797  else
798  {
799  return m_pTHM1176->ConvertTimestamp(RawTimestamp, rTimestamp);
800  }
801  }; // CTHM1176InstrumentManager::ConvertTimestamp
802 
807  bool ReadInformationDates (QDateTime & rManufacturingDate, QDateTime & rCalibrationDate);
808 
809 
810 public slots:
811  //----------------------------------------------------------------------//
812  // THM1176 Instrument Manager property Set methods //
813  //----------------------------------------------------------------------//
814  // Basic instrument control:
817  void SetCurrentInstrument (tResourceName CurrentInstrument);
818 
821  void SetOperatingMode (eTHM1176OperatingMode OperatingMode);
822 
823  // Parameters:
826  void SetAveragingParms (sAveraging<uParm> AveragingParms);
827 
830  void SetTriggerParms (sInputTrigger<uParm> TriggerParms);
831 
834  void SetOutputSelect (sArbitraryMeasurements OutputSelect);
835 
838  void SetSleepParm (bool SleepParm);
839 
842  void SetUnits (eTHM1176Units Units);
843 
846  void SetRangeParms (sRange<uParm> RangeParms);
847 
850  void SetCommFormat (eCommunicationFormat CommFormat);
851 
852 private slots:
853  //----------------------------------------------------------------------//
854  // THM1176 Instrument Manager communication with Instrument Scanner //
855  //----------------------------------------------------------------------//
856  void UpdateInstrumentList (CResourceList InstrumentList);
857 
858  //----------------------------------------------------------------------//
859  // THM1176 Instrument Manager communication with Instrument Controller //
860  //----------------------------------------------------------------------//
861  // Basic instrument control:
862  void UpdateCurrentInstrument (tResourceName CurrentInstrument);
863  void UpdateInstrumentPointer (CTHM1176Instrument<THM1176_INSTR_CLS, THM1176_RSRC_MGR_CLS> * pTHM1176);
864  void UpdateOperatingMode (eTHM1176OperatingMode OperatingMode);
865  void UpdateMeasurement (CMeasurement Measurement);
866  void UpdateErrorList (CErrorList ErrorList);
867 
868  // Instrument information and parameter bounds:
869  void UpdateIdentification (sIdentifier Identification);
870  void UpdateRangeList (CFluxList RangeList);
871  void UpdateUnitsList (CTHM1176UnitsList UnitsList);
872  void UpdateDivisorList (CDivisorList DivisorList);
873  void UpdateAveragingParmBounds (sAveraging<sBoundedParm> AveragingParmBounds);
874  void UpdateTriggerParmBounds (sInputTrigger<sBoundedParm> TriggerParmBounds);
875  void UpdateRangeParmBounds (sRange<sBoundedParm> RangeParmBounds);
876 
877  // Parameters
878  void UpdateAveragingParms (sAveraging<uParm> AveragingParms);
879  void UpdateTriggerParms (sInputTrigger<uParm> TriggerParms);
880  void UpdateOutputSelect (sArbitraryMeasurements OutputSelect);
881  void UpdateSleepParm (bool SleepParm);
882  void UpdateUnits (eTHM1176Units Units);
883  void UpdateRangeParms (sRange<uParm> RangeParms);
884  void UpdateCommFormat (eCommunicationFormat CommFormat);
885 
886 public slots:
887  //----------------------------------------------------------------------//
888  // THM1176 Instrument Manager slots //
889  //----------------------------------------------------------------------//
890  // Startup and shutdown:
892  void Start (void);
893 
895  void Stop (void);
896 
897 signals:
898  //----------------------------------------------------------------------//
899  // THM1176 Instrument Manager instrument control signals //
900  //----------------------------------------------------------------------//
906  void SendTrigger (void);
907 
915  void SetCalibrationOverride (bool Override);
916 
917 
918  //----------------------------------------------------------------------//
919  // THM1176 Instrument Manager property change notifications //
920  //----------------------------------------------------------------------//
921  // Basic instrument control:
924  void NotifyInstrumentList (CResourceList InstrumentList);
925 
928  void NotifyCurrentInstrument (tResourceName CurrentInstrument);
929 
933 
936  void NotifyMeasurement (CMeasurement Measurement);
937 
940  void NotifyErrorList (CErrorList ErrorList);
941 
942  // Instrument information and parameter bounds:
945  void NotifyIdentification (sIdentifier Identification);
946 
949  void NotifyRangeList (CFluxList RangeList);
950 
954 
957  void NotifyDivisorList (CDivisorList DivisorList);
958 
962 
966 
970 
971  // Parameters:
975 
979 
983 
986  void NotifySleepParm (bool SleepParm);
987 
991 
994  void NotifyRangeParms (sRange<uParm> RangeParms);
995 
999 
1000  //----------------------------------------------------------------------//
1001  // THM1176 Instrument Manager internal signals //
1002  //----------------------------------------------------------------------//
1005  void StartInstrumentScanner (THM1176_RSRC_MGR_CLS * pResourceManager);
1006 
1009 
1012  void StartInstrumentController (THM1176_RSRC_MGR_CLS * pResourceManager);
1013 
1016 
1017  //----------------------------------------------------------------------//
1018  // THM1176 Instrument Manager communication with Instrument Controller //
1019  //----------------------------------------------------------------------//
1020  // Basic instrument control:
1023  void RelayCurrentInstrument (tResourceName CurrentInstrument);
1024 
1028 
1029  // Parameters
1033 
1037 
1041 
1044  void RelaySleepParm (bool SleepParm);
1045 
1049 
1052  void RelayRangeParms (sRange<uParm> RangeParms);
1053 
1057 
1058 }; // CTHM1176InstrumentManager
1059 
1060 } // namespace MTL
MTL::CTHM1176InstrumentController::UpdateOperatingMode
void UpdateOperatingMode(eTHM1176OperatingMode OperatingMode)
Signal that the operating mode has changed.
MTL::CTHM1176InstrumentController::UpdateRangeParmBounds
void UpdateRangeParmBounds(sRange< sBoundedParm > RangeParmBounds)
Signal to report bounds of range parameters for newly connected instrument.
MTL::CTHM1176InstrumentManager::NotifyCurrentInstrument
void NotifyCurrentInstrument(tResourceName CurrentInstrument)
Notify that the currently connected instrument has changed.
MTL::Instrument::CResourceList
List of VISA resource names.
Definition: IEEE488InstrumentTypes.h:26
MTL::CTHM1176InstrumentManager::SendTrigger
void SendTrigger(void)
Send a bus trigger to the instrument (both slot and signal).
MTL::CTHM1176UnitsList
List of measurement units.
Definition: THM1176InstrumentManagerTypes.h:46
MTL::CTHM1176InstrumentManager::NotifyTriggerParms
void NotifyTriggerParms(sInputTrigger< uParm > TriggerParms)
Notify that the trigger parameters have changed.
MTL::CTHM1176InstrumentManager::RelayAveragingParms
void RelayAveragingParms(sAveraging< uParm > AveragingParms)
Internal signal to relay the averaging parameters to the Instrument Controller.
MTL::Instrument::THM1176Types::eUnits
eUnits
Enumeration of possible measurement units.
Definition: THM1176Types.h:182
MTL::CTHM1176InstrumentManager::RelayCommFormat
void RelayCommFormat(eCommunicationFormat CommFormat)
Internal signal to relay the communications format to the Instrument Controller.
F32
float F32
32-bit floating-point number.
Definition: OSDefines.h:34
THM1176InstrumentManagerTypes.h
Type definitions for THM1176 Instrument Manager.
MTL::CTHM1176InstrumentManager::NotifyErrorList
void NotifyErrorList(CErrorList ErrorList)
Notify that new errors are present.
MTL::CTHM1176InstrumentManager::NotifyRangeList
void NotifyRangeList(CFluxList RangeList)
Notify that the list of valid ranges has changed.
U64
unsigned long long U64
64-bit unsigned integer.
Definition: OSDefines.h:33
MTL::CTHM1176InstrumentController::UpdateOutputSelect
void UpdateOutputSelect(sArbitraryMeasurements OutputSelect)
Signal a change of the output selection parameters.
MTL::CTHM1176InstrumentController::UpdateCurrentInstrument
void UpdateCurrentInstrument(tResourceName CurrentInstrument)
Signal that current instrument selection has changed.
MTL::Instrument::THM1176Types::sArbitraryMeasurements
Specify the measurement data to be returned.
Definition: THM1176Types.h:572
MTL::CTHM1176InstrumentController::UpdateAveragingParms
void UpdateAveragingParms(sAveraging< uParm > AveragingParms)
Signal a change of the averaging parameters.
MTL::Instrument::THM1176Types::sAveraging::clear
void clear(void)
Clear to default (zero).
Definition: THM1176Types.h:376
MTL::Instrument::CTHM1176Instrument< THM1176_INSTR_CLS, THM1176_RSRC_MGR_CLS >
THM1176_SCAN_INTERVAL
#define THM1176_SCAN_INTERVAL
Definition: THM1176IM_Test01_Connect.cpp:21
MTL::CTHM1176InstrumentManager::NotifyOperatingMode
void NotifyOperatingMode(eTHM1176OperatingMode OperatingMode)
Notify that the operating mode has changed.
MTL::CTHM1176InstrumentController::UpdateUnitsList
void UpdateUnitsList(CTHM1176UnitsList UnitsList)
Signal to report list of valid measurement units for newly connected instrument.
MTL::CTHM1176InstrumentManager::RelayUnits
void RelayUnits(eTHM1176Units Units)
Internal signal to relay the measurement units to the Instrument Controller.
MTL::CTHM1176InstrumentManager::NotifyRangeParms
void NotifyRangeParms(sRange< uParm > RangeParms)
Notify that the range parameters have changed.
MTL::Instrument::THM1176Types::sRange< uParm >
MTL::CTHM1176InstrumentController::UpdateInstrumentPointer
void UpdateInstrumentPointer(CTHM1176Instrument< THM1176_INSTR_CLS, THM1176_RSRC_MGR_CLS > *pTHM1176)
Signal to broadcast updated pointer to THM1176 Instrument object.
MTL::CTHM1176InstrumentController
THM1176 Instrument Controller class: communicate with instrument.
Definition: CTHM1176InstrumentManager.h:293
MTL::CTHM1176InstrumentManager::NotifyAveragingParms
void NotifyAveragingParms(sAveraging< uParm > AveragingParms)
Notify that the averaging parameters have changed.
MTL::CTHM1176InstrumentController::UpdateDivisorList
void UpdateDivisorList(CDivisorList DivisorList)
Signal to report divisors associated with valid measurement units for newly connected instrument.
MTL::CTHM1176InstrumentManager::~CTHM1176InstrumentManager
~CTHM1176InstrumentManager(void)
Destructor.
Definition: CTHM1176InstrumentManager.h:695
MTL::CTHM1176InstrumentScanner::CTHM1176InstrumentScanner
CTHM1176InstrumentScanner(void)
Constructor.
Definition: CTHM1176InstrumentManager.h:255
MTL::Instrument::THM1176Types::kComFormatAscii
@ kComFormatAscii
Human-legible text.
Definition: THM1176Types.h:446
MTL::Instrument::THM1176Types::sArbitraryMeasurements::clear
void clear()
Clear to default values.
Definition: THM1176Types.cpp:483
MTL::CTHM1176InstrumentManager::RelaySleepParm
void RelaySleepParm(bool SleepParm)
Internal signal to relay the sleep parameter to the Instrument Controller.
MTL::CTHM1176InstrumentManager::StartInstrumentController
void StartInstrumentController(THM1176_RSRC_MGR_CLS *pResourceManager)
Internal signal to start to Instrument Controller.
MTL::Instrument::THM1176Types::CDivisorList
List of divisors, one per measurement unit.
Definition: THM1176Types.h:203
MTL::CTHM1176InstrumentController::UpdateAveragingParmBounds
void UpdateAveragingParmBounds(sAveraging< sBoundedParm > AveragingParmBounds)
Signal to report bounds of averaging parameters for newly connected instrument.
MTL::CTHM1176InstrumentController::CTHM1176InstrumentController
CTHM1176InstrumentController(void)
Constructor.
Definition: CTHM1176InstrumentManager.h:358
MTL::CTHM1176InstrumentController::UpdateTriggerParms
void UpdateTriggerParms(sInputTrigger< uParm > TriggerParms)
Signal a change of the trigger parameters.
MTL::Instrument::THM1176Types::sIdentifier
Instrument's identification string - parsed version.
Definition: THM1176Types.h:336
MTL::CTHM1176InstrumentManager::NotifyUnits
void NotifyUnits(eTHM1176Units Units)
Notify that the measurement units have changed.
MTL::CTHM1176InstrumentManager::NotifyCommFormat
void NotifyCommFormat(eCommunicationFormat CommFormat)
Notify that the communication format parameters have changed.
MTL::Instrument::THM1176Types::eCommunicationFormat
eCommunicationFormat
Enumeration of possible formats for returned data.
Definition: THM1176Types.h:445
MTL::CTHM1176InstrumentManager::RelayOutputSelect
void RelayOutputSelect(sArbitraryMeasurements OutputSelect)
Internal signal to relay the output selection parameters to the Instrument Controller.
MTL::CTHM1176InstrumentManager::StopInstrumentScanner
void StopInstrumentScanner(void)
Internal signal to stop the Instrument Scanner.
MTL::Instrument::THM1176Types::sRange::clear
void clear(void)
Clear to default values.
Definition: THM1176Types.h:469
MTL::CTHM1176InstrumentController::UpdateTriggerParmBounds
void UpdateTriggerParmBounds(sInputTrigger< sBoundedParm > TriggerParmBounds)
Signal to report bounds of trigger parameters for newly connected instrument.
MTL
Definition: CTHM1176InstrumentManager.h:179
MTL::CTHM1176InstrumentManager::NotifyAveragingParmBounds
void NotifyAveragingParmBounds(sAveraging< sBoundedParm > AveragingParmBounds)
Notify that the bounds on averaging parameters have changed.
MTL::CTHM1176InstrumentManager
THM1176 Instrument Manager class: public interface.
Definition: CTHM1176InstrumentManager.h:539
MTL::CTHM1176InstrumentController::UpdateErrorList
void UpdateErrorList(CErrorList LatestErrors)
Signal that new errors have been reported.
MTL::Instrument
Definition: THM1176.h:75
MTL::CTHM1176InstrumentController::UpdateCommFormat
void UpdateCommFormat(eCommunicationFormat CommFormat)
Signal a change of the communication format.
MTL::Instrument::THM1176Types
Definition: THM1176TypeConversions.h:20
MTL::CTHM1176InstrumentManager::RelayCurrentInstrument
void RelayCurrentInstrument(tResourceName CurrentInstrument)
Internal signal to relay the instrument selection to the Instrument Controller.
MTL::eTHM1176Units
eTHM1176Units
Enumeration of possible measurement units, including "ADC".
Definition: THM1176InstrumentManagerTypes.h:29
MTL::CTHM1176InstrumentManager::RelayOperatingMode
void RelayOperatingMode(eTHM1176OperatingMode OperatingMode)
Internal signal to relay the operating mode selection to the Instrument Controller.
MTL::Instrument::CTHM1176Instrument::ConvertTimestamp
bool ConvertTimestamp(const U64 RawTimestamp, CAbsoluteTimestamp &rTimestamp)
Convert a raw timestamp to UNIX Epoch time and nanoseconds.
Definition: THM1176.h:426
MTL::Instrument::THM1176Types::sAveraging< uParm >
MTL::CTHM1176InstrumentManager::NotifySleepParm
void NotifySleepParm(bool SleepParm)
Notify that the sleep parameter has changed.
I32
int I32
32-bit signed integer.
Definition: OSDefines.h:28
MTL::Instrument::THM1176Types::CAbsoluteTimestamp
Timestamp for a measurement.
Definition: THM1176Types.h:530
MTL::CTHM1176InstrumentManager::StopInstrumentController
void StopInstrumentController(void)
Internal signal to stop the Instrument Controller.
MTL::CTHM1176InstrumentScanner::~CTHM1176InstrumentScanner
~CTHM1176InstrumentScanner(void) override
Destructor.
Definition: CTHM1176InstrumentManager.h:259
MTL::CTHM1176InstrumentManager::NotifyDivisorList
void NotifyDivisorList(CDivisorList DivisorList)
Notify that the list of divisors associated with each measurement unit for this instrument model has ...
MTL::Instrument::THM1176Types::sInputTrigger::clear
void clear(void)
Clear to default.
Definition: THM1176Types.h:418
MTL::CTHM1176InstrumentManager::NotifyMeasurement
void NotifyMeasurement(CMeasurement Measurement)
Notify that a new set of measurements is available.
MTL::CTHM1176InstrumentManager::StartInstrumentScanner
void StartInstrumentScanner(THM1176_RSRC_MGR_CLS *pResourceManager)
Internal signal to start the Instrument Scanner.
MTL::CTHM1176InstrumentManager::ConvertTimestamp
bool ConvertTimestamp(const U64 RawTimestamp, CAbsoluteTimestamp &rTimestamp)
Convert a raw timestamp to UNIX Epoch time and nanoseconds.
Definition: CTHM1176InstrumentManager.h:790
MTL::CTHM1176InstrumentController::~CTHM1176InstrumentController
~CTHM1176InstrumentController(void) override
Destructor.
Definition: CTHM1176InstrumentManager.h:380
USBTMCInstrument.h
USBTMC driver based on libusb: interface definition.
MTL::CTHM1176InstrumentController::UpdateIdentification
void UpdateIdentification(sIdentifier Identification)
Signal to report identifier information for newly connected instrument.
MTL::CTHM1176InstrumentManager::RelayTriggerParms
void RelayTriggerParms(sInputTrigger< uParm > TriggerParms)
Internal signal to relay the trigger parameters to the Instrument Controller.
MTL::CTHM1176InstrumentController::UpdateRangeParms
void UpdateRangeParms(sRange< uParm > RangeParms)
Signal a change of the range parameters.
MTL::Instrument::tResourceName
std::string tResourceName
IEEE488 resource name.
Definition: IEEE488InstrumentTypes.h:22
MTL::Instrument::THM1176Types::kT
@ kT
Tesla.
Definition: THM1176Types.h:183
MTL::Instrument::THM1176Types::sInputTrigger< uParm >
MTL::CTHM1176InstrumentManager::CTHM1176InstrumentManager
CTHM1176InstrumentManager(void)
Constructor.
Definition: CTHM1176InstrumentManager.h:656
MTL::CTHM1176InstrumentManager::NotifyTriggerParmBounds
void NotifyTriggerParmBounds(sInputTrigger< sBoundedParm > TriggerParmBounds)
Notify that the bounds on trigger parameters have changed.
MTL::CTHM1176InstrumentManager::NotifyIdentification
void NotifyIdentification(sIdentifier Identification)
Notify that the instrument identification information has changed.
MTL::Instrument::THM1176Types::CFluxList
List of flux density values.
Definition: THM1176Types.h:170
MTL::CTHM1176InstrumentManager::NotifyUnitsList
void NotifyUnitsList(CTHM1176UnitsList UnitsList)
Notify that the list of valid measurement units has changed.
MTL::CTHM1176InstrumentManager::SetCalibrationOverride
void SetCalibrationOverride(bool Override)
Set whether or not to override the check for instruments whose zero offset should not be calibrated.
MTL::eTHM1176OperatingMode
eTHM1176OperatingMode
Operating modes used to initiate actions or provide status.
Definition: THM1176InstrumentManagerTypes.h:17
MTL::CMeasurement
Data returned for one measurement.
Definition: THM1176InstrumentManagerTypes.h:51
MTL::CTHM1176InstrumentScanner
THM1176 Instrument Scanner class: scan for connected instruments.
Definition: CTHM1176InstrumentManager.h:227
MTL::CTHM1176InstrumentController::UpdateUnits
void UpdateUnits(eTHM1176Units Units)
Signal a change of the measurement units.
U8
unsigned char U8
Unsigned byte.
Definition: OSDefines.h:30
VISAInstrument.h
C++ wrapper for NI-VISA: interface definition.
MTL::Instrument::THM1176Types::CErrorList
List of errors returned by the instrument.
Definition: THM1176Types.h:232
U16
unsigned short U16
16-bit unsigned integer.
Definition: OSDefines.h:31
MTL::CTHM1176InstrumentManager::NotifyRangeParmBounds
void NotifyRangeParmBounds(sRange< sBoundedParm > RangeParmBounds)
Notify that the bounds on range parameters have changed.
MTL::CTHM1176InstrumentController::UpdateRangeList
void UpdateRangeList(CFluxList RangeList)
Signal to report list of valid ranges for newly connected instrument.
F64
double F64
64-bit floating-point number.
Definition: OSDefines.h:35
U32
unsigned int U32
32-bit unsigned integer.
Definition: OSDefines.h:32
MTL::CTHM1176InstrumentScanner::UpdateInstrumentList
void UpdateInstrumentList(CResourceList InstrumentList)
An update to the instrument list is available.
MTL::CTHM1176InstrumentScanner::UpdateErrorList
void UpdateErrorList(CErrorList ErrorList)
An update to the error list is available.
MTL::CTHM1176InstrumentController::UpdateMeasurement
void UpdateMeasurement(CMeasurement Measurement)
Signal that a new measurement is available.
THM1176_CONNECT_TIMEOUT
#define THM1176_CONNECT_TIMEOUT
Definition: THM1176MeasureImmediateTiming.cpp:26
MTL::kTHM1176NotConnected
@ kTHM1176NotConnected
Disconnect instrument.
Definition: THM1176InstrumentManagerTypes.h:18
MTL::CTHM1176InstrumentManager::RelayRangeParms
void RelayRangeParms(sRange< uParm > RangeParms)
Internal signal to relay the range parameters to the Instrument Controller.
MTL::CTHM1176InstrumentController::UpdateSleepParm
void UpdateSleepParm(bool SleepParm)
Signal a change of the sleep parameter.
MTL::CTHM1176InstrumentManager::NotifyInstrumentList
void NotifyInstrumentList(CResourceList InstrumentList)
Notify that the list of detected instruments has changed.
MTL::CTHM1176InstrumentManager::NotifyOutputSelect
void NotifyOutputSelect(sArbitraryMeasurements OutputSelect)
Notify that the output selection parameters have changed.