THM1176InstrumentManager  1.0
Qt Object abstraction for Metrolab THM1176
CTHM1176InstrumentManager.cpp
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 
9 #include "OSDefines.h"
10 #include "Helpers.h"
11 #include "Exception.h"
12 
13 using namespace MTL;
14 using namespace MTL::Instrument;
15 using namespace MTL::Instrument::THM1176Types;
16 
17 
18 
20 //----------------------------------------------------------------------//
21 // THM1176 Instrument Scanner //
22 //----------------------------------------------------------------------//
23 void CTHM1176InstrumentScanner::HandleError (QString Description,
24  QString Context)
25 {
26  // Create the error structure.
27  sError l_Error;
29  l_Error.Description = Description.toStdString();
30  l_Error.Context = Context.toStdString();
31 
32  // Emit the update.
33  CErrorList l_ErrorList;
34  l_ErrorList.push_back(l_Error);
35  emit UpdateErrorList(l_ErrorList);
36 
37 } // CTHM1176InstrumentScanner::HandleError
38 
39 void CTHM1176InstrumentScanner::Start (THM1176_RSRC_MGR_CLS * pResourceManager)
40 {
41  m_pResourceManager = pResourceManager;
42  m_TimerID = startTimer(THM1176_SCAN_INTERVAL);
43 
44 } // CTHM1176InstrumentScanner::Start
45 
47 {
48  killTimer(m_TimerID);
49  m_pResourceManager = nullptr;
50 
51  // Quit the event loop.
52  QThread::currentThread()->quit();
53 
54 } // CTHM1176InstrumentScanner::Stop
55 
56 void CTHM1176InstrumentScanner::timerEvent (QTimerEvent * Event)
57 {
58  MTL_Unused(Event)
59 
60  // Get the current list, and if it has changed, emit the signal.
61  if (nullptr != m_pResourceManager)
62  {
63  CResourceList l_InstrumentList;
64  m_pResourceManager->FindResources(l_InstrumentList, THM1176_RSRC_FILTER);
65 
66  if (m_InstrumentList != l_InstrumentList)
67  {
68  m_InstrumentList = l_InstrumentList;
69  emit UpdateInstrumentList(m_InstrumentList);
70  }
71  }
72 
73  // Gripe if the Resource Manager is not up.
74  else
75  HandleError("Resource Manager not running", __func__);
76 
77 } // CTHM1176InstrumentScanner::timerEvent
78 
79 
80 
82 //----------------------------------------------------------------------//
83 // THM1176 Instrument Controller: Error reporting //
84 //----------------------------------------------------------------------//
85 void CTHM1176InstrumentController::HandleError (QString Description,
86  QString Context)
87 {
88  // Get the THM1176 error list, if the THM1176 is connected.
89  CErrorList l_ErrorList;
90  if (nullptr != m_pTHM1176)
91  {
92  l_ErrorList = m_pTHM1176->CurrentErrorList();
93  m_pTHM1176->ClearErrorList();
94  }
95 
96  // Create the error structure for the header message.
97  sError l_Error;
99  l_Error.Description = Description.toStdString();
100  l_Error.Context = Context.toStdString();
101 
102  // Insert the header message at the front of the list.
103  l_ErrorList.insert(l_ErrorList.begin(), l_Error);
104 
105  // Emit the error list update.
106  emit UpdateErrorList(l_ErrorList);
107 
108 } // CTHM1176InstrumentController::HandleError
109 
110 //----------------------------------------------------------------------//
111 // THM1176 Instrument Controller: Initialize / Shutdown //
112 //----------------------------------------------------------------------//
113 void CTHM1176InstrumentController::Start (THM1176_RSRC_MGR_CLS * pResourceManager)
114 {
115  m_pResourceManager = pResourceManager;
116 
117 } // CTHM1176InstrumentController::Start
118 
120 {
121  // Disconnect the THM1176 and deallocate the object, if it exists.
122  if (nullptr != m_pTHM1176)
123  {
124  m_pTHM1176->Disconnect();
125  delete m_pTHM1176;
126  }
127 
128  // Reset the object pointers to NULL, just to be sure.
129  m_pResourceManager = nullptr;
130  m_pTHM1176 = nullptr;
131 
132  // Quit the event loop.
133  QThread::currentThread()->quit();
134 
135 } // CTHM1176InstrumentController::Stop
136 
137 //----------------------------------------------------------------------//
138 // THM1176 Instrument Controller slots: Connection //
139 //----------------------------------------------------------------------//
140 void CTHM1176InstrumentController::ClearInstrumentInfo (void)
141 {
142  m_CurrentInstrument.clear();
143 
144  m_Identification.clear();
145  m_RangeList.clear();
146  m_UnitsList.clear();
147  m_DivisorList.clear();
148  m_AveragingParmBounds.clear();
149  m_TriggerParmBounds.clear();
150  m_RangeParmBounds.clear();
151 
152  m_AveragingParms.clear();
153  m_TriggerParms.clear();
154  m_OutputSelect.clear();
155  m_SleepParm = false;
156  m_Units = kT;
157  m_RangeParms.clear();
158  m_CommFormat = kComFormatAscii;
159 
160 } // CTHM1176InstrumentController::ClearInstrumentInfo
161 
162 void CTHM1176InstrumentController::GetInstrumentInfo (std::string Context)
163 {
164  // Get the parsed identification string.
165  if (!m_pTHM1176->GetIdentification(m_Identification))
166  throw CException<CTHM1176InstrumentManager>("Cannot get identification string", Context);
167 
168  // Get the range list.
169  if (!m_pTHM1176->GetAllRanges(m_RangeList))
170  throw CException<CTHM1176InstrumentManager>("Cannot get range list", Context);
171 
172  // Get the list of units supported by this instrument, and associated divisors.
173  MakeUnitsList(Context);
174 
175  // Get the Averaging parameter bounds.
176  if (!m_pTHM1176->ParmAveragingGet(m_AveragingParmBounds))
177  throw CException<CTHM1176InstrumentManager>("Cannot get Averaging parameter bounds", Context);
178 
179  // Get the Trigger parameter bounds.
180  if (!m_pTHM1176->ParmTriggerInputGet(m_TriggerParmBounds))
181  throw CException<CTHM1176InstrumentManager>("Cannot get Trigger parameter bounds", Context);
182 
183  // Get the Range parameter bounds.
184  if (!m_pTHM1176->ParmRangeGet(m_RangeParmBounds))
185  throw CException<CTHM1176InstrumentManager>("Cannot get Range parameter bounds", Context);
186 
187  // Get the Averaging parameters.
188  m_AveragingParms.NoPoints = m_AveragingParmBounds.NoPoints.Val;
189 
190  // Get the Trigger parameters.
191  m_TriggerParms.Source = m_TriggerParmBounds.Source;
192  m_TriggerParms.Period_s = m_TriggerParmBounds.Period_s.Val;
193  m_TriggerParms.Count = m_TriggerParmBounds.Count.Val;
194 
195  // Reset the output selection.
196  m_OutputSelect.clear();
197  m_OutputSelect.NoMeasurements = m_TriggerParmBounds.Count.Val;
198 
199  // Get the sleep parameter.
200  if (!m_pTHM1176->ParmSleepGet(m_SleepParm))
201  throw CException<CTHM1176InstrumentManager>("Cannot get Sleep parameter", Context);
202 
203  // Get the units.
204  GetCurrentUnits(Context);
205 
206  // Get the Range parameters.
207  m_RangeParms.Auto = m_RangeParmBounds.Auto;
208  m_RangeParms.Range = m_RangeParmBounds.Range.Val;
209 
210  // Get the Communication Format.
211  if (!m_pTHM1176->GetFormat(m_CommFormat))
212  throw CException<CTHM1176InstrumentManager>("Cannot get Communication Format", Context);
213 
214 } // CTHM1176InstrumentController::GetInstrumentInfo
215 
216 void CTHM1176InstrumentController::GetInstrumentParameters (std::string Context)
217 {
218  // Get the Averaging parameters.
219  if (!m_pTHM1176->ParmAveragingGet(m_AveragingParms))
220  throw CException<CTHM1176InstrumentManager>("Cannot get Averaging parameters", Context);
221 
222  // Get the Trigger parameters.
223  if (!m_pTHM1176->ParmTriggerInputGet(m_TriggerParms))
224  throw CException<CTHM1176InstrumentManager>("Cannot get Trigger parameters", Context);
225 
226  // Reset the output selection.
227  m_OutputSelect.clear();
228  m_OutputSelect.NoMeasurements = m_TriggerParmBounds.Count.Val;
229 
230  // Get the sleep parameter.
231  if (!m_pTHM1176->ParmSleepGet(m_SleepParm))
232  throw CException<CTHM1176InstrumentManager>("Cannot get Sleep parameter", Context);
233 
234  // Get the units.
235  GetCurrentUnits(Context);
236 
237  // Get the Range parameters.
238  if (!m_pTHM1176->ParmRangeGet(m_RangeParms))
239  throw CException<CTHM1176InstrumentManager>("Cannot get Range parameters", Context);
240 
241  // Get the Communication Format.
242  if (!m_pTHM1176->GetFormat(m_CommFormat))
243  throw CException<CTHM1176InstrumentManager>("Cannot get Communication Format", Context);
244 
245 } // CTHM1176InstrumentController::GetInstrumentParameters
246 
247 void CTHM1176InstrumentController::PublishInstrumentInfo (void)
248 {
249  emit UpdateCurrentInstrument(m_CurrentInstrument);
250 
251  emit UpdateIdentification(m_Identification);
252  emit UpdateRangeList(m_RangeList);
253  emit UpdateUnitsList(m_UnitsList);
254  emit UpdateDivisorList(m_DivisorList);
255  emit UpdateAveragingParmBounds(m_AveragingParmBounds);
256  emit UpdateTriggerParmBounds(m_TriggerParmBounds);
257  emit UpdateRangeParmBounds(m_RangeParmBounds);
258 
259  emit UpdateOutputSelect(m_OutputSelect);
260  emit UpdateSleepParm(m_SleepParm);
261  emit UpdateUnits(m_Units);
262  emit UpdateCommFormat(m_CommFormat);
263 
264 } // CTHM1176InstrumentController::PublishInstrumentInfo
265 
266 void CTHM1176InstrumentController::PublishInstrumentParameters (void)
267 {
268  emit UpdateAveragingParms(m_AveragingParms);
269  emit UpdateTriggerParms(m_TriggerParms);
270  emit UpdateOutputSelect(m_OutputSelect);
271  emit UpdateSleepParm(m_SleepParm);
272  emit UpdateUnits(m_Units);
273  emit UpdateRangeParms(m_RangeParms);
274  emit UpdateCommFormat(m_CommFormat);
275 
276 } // CTHM1176InstrumentController::PublishInstrumentParameters
277 
279 {
280  // Save the instrument list.
281  m_InstrumentList = InstrumentList;
282 
283  // All is well if we have no active instrument, or if the active instrument is still in the list.
284  if (m_CurrentInstrument.empty() && m_pTHM1176 == nullptr) return;
285 
286  for (auto l_pTHM1176ResourceID = InstrumentList.begin(); l_pTHM1176ResourceID < InstrumentList.end(); l_pTHM1176ResourceID++)
287  if (m_CurrentInstrument == *l_pTHM1176ResourceID) return;
288 
289  // If the active instrument is no longer in the list, stop the continuous-measurement timer.
290  if (m_TimerID)
291  killTimer(m_TimerID);
292  m_TimerID = 0;
293 
294  // Disconnect the instrument.
295  if (m_pTHM1176 != nullptr)
296  m_pTHM1176->Disconnect();
297  m_pTHM1176 = nullptr;
298  emit UpdateInstrumentPointer(m_pTHM1176);
299 
300  // Flag that we are not connected.
301  m_OperatingMode = kTHM1176NotConnected;
302  emit UpdateOperatingMode(m_OperatingMode);
303 
304  // Clear the information on the current instrument.
305  // Note: instrument in Reset mode forces Instrument Manager to emit all parameter-value notifications.
306  ClearInstrumentInfo();
307  PublishInstrumentInfo();
308 
309 } // CTHM1176InstrumentController::UpdateInstrumentList
310 
312 {
313  // Prepare to catch general administrative inconsistencies.
314  try
315  {
316  // Make sure the resource name is in the current resource list.
317  auto l_pResource = m_InstrumentList.begin();
318  for (; l_pResource < m_InstrumentList.end(); l_pResource++)
319  if (*l_pResource == CurrentInstrument) break;
320  if (l_pResource >= m_InstrumentList.end())
321  throw CException<CTHM1176InstrumentManager>("Resource name not in resource list", __func__);
322 
323  // If the resource name is the currently selected one, there is nothing to do.
324  if (CurrentInstrument == m_CurrentInstrument)
325  return;
326 
327  // Disconnect the current instrument, if it exists.
328  if (nullptr != m_pTHM1176)
329  {
330  m_pTHM1176->Disconnect();
331  delete m_pTHM1176;
332  m_pTHM1176 = nullptr;
333  emit UpdateInstrumentPointer(m_pTHM1176);
334 
335  // Flag that we are not connected.
336  m_OperatingMode = kTHM1176NotConnected;
337  emit UpdateOperatingMode(m_OperatingMode);
338 
339  // Clear the information on the current instrument.
340  // Note: instrument in Reset mode forces Instrument Manager to emit all parameter-value notifications.
341  ClearInstrumentInfo();
342  PublishInstrumentInfo();
343  }
344 
345  // Make sure we have the pointer to the Resource Manager.
346  if (nullptr == m_pResourceManager)
347  throw CException<CTHM1176InstrumentManager>("Resource Manager not running", __func__);
348 
349  // Create the new THM1176 object.
350  m_pTHM1176 = new CTHM1176Instrument<THM1176_INSTR_CLS, THM1176_RSRC_MGR_CLS>(*m_pResourceManager, CurrentInstrument);
351  if (nullptr == m_pTHM1176)
352  throw CException<CTHM1176InstrumentManager>("Cannot create THM1176 object", __func__);
353  emit UpdateInstrumentPointer(m_pTHM1176);
354  }
356  {
357  // Notify Instrument Manager that SetCurrentInstrument failed.
358  emit UpdateCurrentInstrument(m_CurrentInstrument);
359 
360  // Emit the error message(s).
361  HandleError(rE.message(), rE.context());
362  return;
363  }
364 
365  // Prepare to catch errors that involve actual instrument I/O.
366  try
367  {
368  // Connect to the THM1176.
369  if (!m_pTHM1176->Connect(THM1176_CONNECT_TIMEOUT))
370  throw CException<CTHM1176InstrumentManager>("Cannot connect to THM1176", __func__);
371 
372  // Retrieve the instrument information from the instrument.
373  GetInstrumentInfo(__func__);
374  m_CurrentInstrument = CurrentInstrument;
375 
376  // Now we have all the information, we can publish it.
377  // Note: instrument in Reset mode forces Instrument Manager to emit all parameter-value notifications.
378  PublishInstrumentInfo();
379 
380  // Set the operating mode to Idle.
381  m_OperatingMode = kTHM1176Idle;
382  emit UpdateOperatingMode(m_OperatingMode);
383  }
385  {
386  delete m_pTHM1176;
387  m_pTHM1176 = nullptr;
388 
389  // Notify Instrument Manager that SetCurrentInstrument failed.
390  ClearInstrumentInfo();
391  emit UpdateCurrentInstrument(m_CurrentInstrument);
392 
393  // Emit the error message(s).
394  HandleError(rE.message(), rE.context());
395  return;
396  }
397 
398 } // CTHM1176InstrumentController::SetCurrentInstrument
399 
400 //----------------------------------------------------------------------//
401 // THM1176 Instrument Controller slots: Instrument control //
402 //----------------------------------------------------------------------//
404 {
405  try
406  {
407  // Make sure we're connected, and not in the requested operating mode already.
408  if (m_pTHM1176 == nullptr)
409  throw CException<CTHM1176InstrumentManager>("Cannot change operating mode", __func__);
410  else if (m_OperatingMode == OperatingMode)
411  return;
412 
413  // If we were in continuous measurement mode, stop the timer and abort the measurements.
414  if (kTHM1176MeasureContinuously == m_OperatingMode)
415  {
416  if (0 != m_TimerID)
417  {
418  killTimer(m_TimerID);
419  m_TimerID = 0;
420  }
421 
422  if (!m_pTHM1176->Abort())
423  throw CException<CTHM1176InstrumentManager>("Cannot abort ", __func__);
424  }
425 
426  // Handle the different cases.
427  m_OperatingMode = OperatingMode;
428  switch (m_OperatingMode)
429  {
431  if (nullptr != m_pTHM1176)
432  {
433  // Abort any ongoing measurements.
434  if (!m_pTHM1176->Abort())
435  throw CException<CTHM1176InstrumentManager>("Cannot abort measurement", __func__);
436 
437  // Disconnect the instrument.
438  m_pTHM1176->Disconnect();
439  delete m_pTHM1176;
440  m_pTHM1176 = nullptr;
441  emit UpdateInstrumentPointer(m_pTHM1176);
442 
443  // Flag that we are not connected.
444  m_OperatingMode = kTHM1176NotConnected;
445  emit UpdateOperatingMode(m_OperatingMode);
446 
447  // Clear the information on the current instrument.
448  // Note: instrument in Reset mode forces Instrument Manager to emit all parameter-value notifications.
449  ClearInstrumentInfo();
450  PublishInstrumentInfo();
451  }
452  break;
453 
454  case kTHM1176Reset:
455  // Abort any ongoing measurements.
456  if (!m_pTHM1176->Abort())
457  throw CException<CTHM1176InstrumentManager>("Cannot abort measurement", __func__);
458 
459  // Set the operating mode to Reset.
460  m_OperatingMode = kTHM1176Reset;
461  emit UpdateOperatingMode(m_OperatingMode);
462 
463  // Reset the instrument.
464  if (!m_pTHM1176->Reset())
465  throw CException<CTHM1176InstrumentManager>("Cannot reset", __func__);
466 
467  // Retrieve and publish the instrument parameters.
468  GetInstrumentParameters(__func__);
469  PublishInstrumentParameters();
470 
471  // Set the operating mode back to Idle.
472  m_OperatingMode = kTHM1176Idle;
473  emit UpdateOperatingMode(m_OperatingMode);
474  break;
475 
476  case kTHM1176Idle:
477  // Abort any ongoing measurements.
478  if (!m_pTHM1176->Abort())
479  throw CException<CTHM1176InstrumentManager>("Cannot abort measurement", __func__);
480 
481  // Flag that we're idle.
482  m_OperatingMode = kTHM1176Idle;
483  emit UpdateOperatingMode(m_OperatingMode);
484  break;
485 
486  case kTHM1176Measure:
487  // Abort any ongoing measurements.
488  if (!m_pTHM1176->Abort())
489  throw CException<CTHM1176InstrumentManager>("Cannot abort measurement", __func__);
490 
491  // Flag that we're Measuring.
492  m_OperatingMode = kTHM1176Measure;
493  emit UpdateOperatingMode(m_OperatingMode);
494 
495  // Initiate the measurement.
496  if (!m_pTHM1176->Initiate(false))
497  throw CException<CTHM1176InstrumentManager>("Cannot initiate measurement", __func__);
498 
499  // What we do next depends on the trigger mode.
500  switch (m_TriggerParms.Source)
501  {
502  case kInputTrigSrcBus:
503  // We will fetch the measurements after the appropriate number of triggers.
504  m_TriggerCount = 0;
505  break;
506 
507  default:
508  {
509  // Transmit the measurements.
510  CMeasurement l_Measurement;
511  eUnits l_Units;
512  sMeasurementConditions l_MeasurementConditions;
513  if (!m_pTHM1176->MeasurementsGet(m_OutputSelect,
514  l_Measurement.Bx, l_Measurement.By, l_Measurement.Bz,
515  l_Units, l_Measurement.Temp, l_Measurement.TimestampList,
516  &l_MeasurementConditions))
517  throw CException<CTHM1176InstrumentManager>("Cannot fetch measurement", __func__);
518 
519  TranslateUnits(l_Measurement, l_Units);
520 
521  l_Measurement.AveragingParms = l_MeasurementConditions.AveragingParms;
522  l_Measurement.TriggerParms = l_MeasurementConditions.TriggerParms;
523  l_Measurement.OutputSelect = m_OutputSelect;
524  l_Measurement.SleepParm = m_SleepParm;
525  l_Measurement.RangeParms = m_RangeParms;
526  l_Measurement.CommFormat = m_CommFormat;
527 
528  l_Measurement.Warnings = m_pTHM1176->CurrentErrorList();
529 
530  emit UpdateMeasurement(l_Measurement);
531 
532  // Flag that we're idle again.
533  m_OperatingMode = kTHM1176Idle;
534  emit UpdateOperatingMode(m_OperatingMode);
535  break;
536  }
537  }
538  break;
539 
541  // Abort any ongoing measurements.
542  if (!m_pTHM1176->Abort())
543  throw CException<CTHM1176InstrumentManager>("Cannot abort measurement", __func__);
544 
545  // Flag that we're Measuring Continuously.
546  m_OperatingMode = kTHM1176MeasureContinuously;
547  emit UpdateOperatingMode(m_OperatingMode);
548 
549  // What we do next depends on the trigger mode.
550  switch (m_TriggerParms.Source)
551  {
552  // For Immediate trigger, start a timer to initiate and read the results.
554  m_TimerID = startTimer(0);
555  break;
556 
557  // For Timed trigger, initiate the measurement continuously, and start
558  // a timer to read the results.
559  case kInputTrigSrcTimer:
560  if (!m_pTHM1176->Initiate(true))
561  throw CException<CTHM1176InstrumentManager>("Cannot initiate measurement", __func__);
562  m_TimerID = startTimer(0);
563  break;
564 
565  // For Bus triggered, initiate the first measurement.
566  case kInputTrigSrcBus:
567  m_TriggerCount = 0;
568  if (!m_pTHM1176->Initiate(false))
569  throw CException<CTHM1176InstrumentManager>("Cannot initiate measurement", __func__);
570  break;
571  }
572  break;
573 
575  // Abort any ongoing measurements.
576  if (!m_pTHM1176->Abort())
577  throw CException<CTHM1176InstrumentManager>("Cannot abort measurement", __func__);
578 
579  // Flag that we're calibrating the zero offset.
580  m_OperatingMode = kTHM1176CalibrateZeroOffset;
581  emit UpdateOperatingMode(m_OperatingMode);
582 
583  // Perform the calibration.
584  if (!m_pTHM1176->CalibrateZeroOffset(m_CalibrationOverride))
585  throw CException<CTHM1176InstrumentManager>("Cannot calibrate zero offset", __func__);
586 
587  // Flag that we're idle again.
588  m_OperatingMode = kTHM1176Idle;
589  emit UpdateOperatingMode(m_OperatingMode);
590  break;
591 
593  // Abort any ongoing measurements.
594  if (!m_pTHM1176->Abort())
595  throw CException<CTHM1176InstrumentManager>("Cannot abort measurement", __func__);
596 
597  // Flag that we're restoring the zero offset.
598  m_OperatingMode = kTHM1176RestoreZeroOffset;
599  emit UpdateOperatingMode(m_OperatingMode);
600 
601  // Perform the restoration.
602  if (!m_pTHM1176->RestoreZeroOffset())
603  throw CException<CTHM1176InstrumentManager>("Cannot restore zero offset", __func__);
604 
605  // Flag that we're idle again.
606  m_OperatingMode = kTHM1176Idle;
607  emit UpdateOperatingMode(m_OperatingMode);
608  break;
609  } // switch
610  } // try
611 
612  // If anything goes wrong, we abort the measurement, emit an error and return to idle.
614  {
615  if (kTHM1176MeasureContinuously == m_OperatingMode && 0 != m_TimerID)
616  {
617  killTimer(m_TimerID);
618  m_TimerID = 0;
619  }
620  m_pTHM1176->Abort();
621  HandleError(rE.message(), rE.context());
622  m_OperatingMode = kTHM1176Idle;
623  emit UpdateOperatingMode(m_OperatingMode);
624  }
625 
626 } // CTHM1176InstrumentController::SetOperatingMode
627 
629 {
630  try
631  {
632  // Make sure we're good to go.
633  if (m_pTHM1176 == nullptr ||
634  (kTHM1176Measure != m_OperatingMode && kTHM1176MeasureContinuously != m_OperatingMode) ||
635  kInputTrigSrcBus != m_TriggerParms.Source ||
636  m_TriggerCount >= m_TriggerParms.Count)
637  throw CException<CTHM1176InstrumentManager>("Cannot send trigger in current mode", __func__);
638 
639  // Send the trigger.
640  if (!m_pTHM1176->SendBusTrigger())
641  throw CException<CTHM1176InstrumentManager>("Cannot send trigger", __func__);
642 
643  // If the trigger count has reached the limit, read the result.
644  if (++m_TriggerCount >= m_TriggerParms.Count)
645  {
646  // Transmit the measurements.
647  CMeasurement l_Measurement;
648  eUnits l_Units;
649  sMeasurementConditions l_MeasurementConditions;
650  if (!m_pTHM1176->MeasurementsGet(m_OutputSelect,
651  l_Measurement.Bx, l_Measurement.By, l_Measurement.Bz,
652  l_Units, l_Measurement.Temp, l_Measurement.TimestampList,
653  &l_MeasurementConditions))
654  throw CException<CTHM1176InstrumentManager>("Cannot fetch measurement", __func__);
655 
656  TranslateUnits(l_Measurement, l_Units);
657 
658  l_Measurement.AveragingParms = l_MeasurementConditions.AveragingParms;
659  l_Measurement.TriggerParms = l_MeasurementConditions.TriggerParms;
660  l_Measurement.OutputSelect = m_OutputSelect;
661  l_Measurement.SleepParm = m_SleepParm;
662  l_Measurement.RangeParms = m_RangeParms;
663  l_Measurement.CommFormat = m_CommFormat;
664 
665  l_Measurement.Warnings = m_pTHM1176->CurrentErrorList();
666 
667  emit UpdateMeasurement(l_Measurement);
668 
669  // For Continuous Measurement, initiate next measurement.
670  if (kTHM1176MeasureContinuously == m_OperatingMode)
671  {
672  m_TriggerCount = 0;
673  if (!m_pTHM1176->Initiate(false))
674  throw CException<CTHM1176InstrumentManager>("Cannot initiate measurement", __func__);
675  }
676  // Else go back to Idle.
677  else
678  {
679  m_OperatingMode = kTHM1176Idle;
680  emit UpdateOperatingMode(m_OperatingMode);
681  }
682  }
683  }
684 
685  // If anything goes wrong, just flag the error.
687  {
688  HandleError(rE.message(), rE.context());
689  }
690 
691 } // CTHM1176InstrumentController::SendTrigger
692 
693 void CTHM1176InstrumentController::timerEvent (QTimerEvent * Event)
694 {
695  MTL_Unused(Event)
696 
697  // This timer handler is only used for continuous measurements.
698  try
699  {
700  // For immediate trigger, we have to initiate the measurement each time.
701  if (kInputTrigSrcImmediate == m_TriggerParms.Source &&
702  !m_pTHM1176->Initiate(false))
703  throw CException<CTHM1176InstrumentManager>("Cannot initiate measurement", __func__);
704 
705  // Transmit the measurements.
706  CMeasurement l_Measurement;
707  eUnits l_Units;
708  sMeasurementConditions l_MeasurementConditions;
709  if (!m_pTHM1176->MeasurementsGet(m_OutputSelect,
710  l_Measurement.Bx, l_Measurement.By, l_Measurement.Bz,
711  l_Units, l_Measurement.Temp, l_Measurement.TimestampList,
712  &l_MeasurementConditions))
713  throw CException<CTHM1176InstrumentManager>("Cannot fetch measurement", __func__);
714 
715  TranslateUnits(l_Measurement, l_Units);
716 
717  l_Measurement.AveragingParms = l_MeasurementConditions.AveragingParms;
718  l_Measurement.TriggerParms = l_MeasurementConditions.TriggerParms;
719  l_Measurement.OutputSelect = m_OutputSelect;
720  l_Measurement.SleepParm = m_SleepParm;
721  l_Measurement.RangeParms = m_RangeParms;
722  l_Measurement.CommFormat = m_CommFormat;
723 
724  l_Measurement.Warnings = m_pTHM1176->CurrentErrorList();
725 
726  emit UpdateMeasurement(l_Measurement);
727  }
728 
729  // If anything goes wrong, just flag the error.
731  {
732  HandleError(rE.message(), rE.context());
733  }
734 
735 } // CTHM1176InstrumentController::timerEvent
736 
737 void CTHM1176InstrumentController::MakeUnitsList (std::string Context)
738 {
739  m_UnitsList.clear();
740  CUnitsList l_UnitsList;
741  if (!m_pTHM1176->GetAllUnits(l_UnitsList))
742  throw CException<CTHM1176InstrumentManager>("Cannot get units list", Context);
743 
744  // Add all units supported by the instrument. First unit is always T.
745  for (auto l_pUnits = l_UnitsList.begin(); l_pUnits < l_UnitsList.end(); l_pUnits++)
746  {
747  m_UnitsList.push_back(static_cast<eTHM1176Units>(*l_pUnits));
748 
749  U32 l_Divisor;
750  if (!m_pTHM1176->GetDivisor(*l_pUnits, l_Divisor))
751  throw CException<CTHM1176InstrumentManager>("Cannot get units list", Context);
752  m_DivisorList.push_back(l_Divisor);
753  }
754 
755  // Add the fake "A/m", "kA/m" and "mA/m" units if they fall in the instrument's range.
756  F32 l_FloatDivisor = m_DivisorList[0] * MU0;
757  if (l_FloatDivisor >= 1. && l_FloatDivisor <= 65535.)
758  {
759  m_UnitsList.push_back(kApm);
760  m_DivisorList.push_back(static_cast<U32>(l_FloatDivisor + 0.5));
761  }
762  l_FloatDivisor = m_DivisorList[0] * MU0 * 1000.;
763  if (l_FloatDivisor >= 1. && l_FloatDivisor <= 65535.)
764  {
765  m_UnitsList.push_back(kkApm);
766  m_DivisorList.push_back(static_cast<U32>(l_FloatDivisor + 0.5));
767  }
768  l_FloatDivisor = m_DivisorList[0] * MU0 / 1000;
769  if (l_FloatDivisor >= 1. && l_FloatDivisor <= 65535.)
770  {
771  m_UnitsList.push_back(kmApm);
772  m_DivisorList.push_back(static_cast<U32>(l_FloatDivisor + 0.5));
773  }
774 
775  // Add the fake "ADC" units.
776  m_UnitsList.push_back(kADC);
777  m_DivisorList.push_back(1);
778 
779 } // CTHM1176InstrumentController::MakeUnitsList
780 
781 void CTHM1176InstrumentController::GetCurrentUnits (std::string Context)
782 {
783  eUnits l_Units;
784  bool l_UseCalibration;
785  if (!m_pTHM1176->ParmUnitsGet(l_Units) ||
786  !m_pTHM1176->ParmUseCalibrationGet(l_UseCalibration))
787  throw CException<CTHM1176InstrumentManager>("Cannot get Units", Context);
788  m_Units = static_cast<eTHM1176Units>(l_Units);
789  if (!l_UseCalibration)
790  m_Units = kADC;
791 
792 } // CTHM1176InstrumentController::GetCurrentUnits
793 
794 void CTHM1176InstrumentController::TranslateUnits (CMeasurement & Measurement,
795  eUnits Units)
796 {
797  F32 l_Multiplier;
798  switch (m_Units)
799  {
800  case kADC:
801  Measurement.Units = kADC;
802  break;
803 
804  case kApm:
805  l_Multiplier = 1.f / MU0;
806  goto HandleApm;
807  case kkApm:
808  l_Multiplier = 0.001f / MU0;
809  goto HandleApm;
810  case kmApm:
811  l_Multiplier = 1000.f / MU0;
812  HandleApm:
813  if (Units == THM1176Types::kT)
814  {
815  for (size_t i = 0; i < Measurement.Bx.size(); i++)
816  Measurement.Bx[i] *= l_Multiplier;
817  for (size_t i = 0; i < Measurement.By.size(); i++)
818  Measurement.By[i] *= l_Multiplier;
819  for (size_t i = 0; i < Measurement.Bz.size(); i++)
820  Measurement.Bz[i] *= l_Multiplier;
821  Measurement.Units = m_Units;
822  }
823  else
824  Measurement.Units = static_cast<eTHM1176Units>(Units);
825  break;
826 
827  default:
828  Measurement.Units = static_cast<eTHM1176Units>(Units);
829  break;
830  }
831 
832 } // CTHM1176InstrumentController::TranslateUnits
833 
834 //----------------------------------------------------------------------//
835 // THM1176 Instrument Controller slots: Parameters //
836 //----------------------------------------------------------------------//
838 {
839  if (m_AveragingParms != AveragingParms)
840  {
841  if (m_pTHM1176 == nullptr ||
842  !m_pTHM1176->ParmAveragingSet(AveragingParms))
843  {
844  HandleError("Cannot change averaging parameters", __func__);
845  if(m_pTHM1176 == nullptr ||
846  !m_pTHM1176->ParmAveragingGet(m_AveragingParms))
847  HandleError("Cannot retrieve averaging parameters", __func__);
848  }
849  else
850  {
851  m_AveragingParms = AveragingParms;
852 
853  // This change aborts any measurements in progress.
854  if (kTHM1176MeasureContinuously == m_OperatingMode &&
855  kInputTrigSrcTimer == m_TriggerParms.Source)
856  {
857  if (0 == m_TimerID ||
858  !m_pTHM1176->Initiate(true))
859  {
860  HandleError("Error restarting continous measurements", __func__);
861  m_OperatingMode = kTHM1176Idle;
862  emit UpdateOperatingMode(m_OperatingMode);
863  }
864  }
865  }
866  }
867  emit UpdateAveragingParms(m_AveragingParms);
868 
869 } // CTHM1176InstrumentController::SetAveragingParms
870 
872 {
873  if (m_TriggerParms != TriggerParms)
874  {
875  if (m_pTHM1176 == nullptr ||
876  !m_pTHM1176->ParmTriggerInputSet(TriggerParms))
877  {
878  HandleError("Cannot change trigger parameters", __func__);
879  if (m_pTHM1176 == nullptr ||
880  !m_pTHM1176->ParmTriggerInputGet(m_TriggerParms))
881  HandleError("Cannot retrieve trigger parameters", __func__);
882  }
883  else
884  {
885  m_TriggerParms = TriggerParms;
886 
887  // This change aborts any measurements in progress.
888  if (kTHM1176MeasureContinuously == m_OperatingMode &&
889  kInputTrigSrcTimer == m_TriggerParms.Source)
890  {
891  if (0 == m_TimerID ||
892  !m_pTHM1176->Initiate(true))
893  {
894  HandleError("Error restarting continous measurements", __func__);
895  m_OperatingMode = kTHM1176Idle;
896  emit UpdateOperatingMode(m_OperatingMode);
897  }
898  }
899  }
900  }
901  emit UpdateTriggerParms(m_TriggerParms);
902 
903 } // CTHM1176InstrumentController::SetTriggerParms
904 
906 {
907  if (m_OutputSelect != OutputSelect)
908  {
909  if (m_pTHM1176 == nullptr)
910  HandleError("Cannot change output selection", __func__);
911  else
912  m_OutputSelect = OutputSelect;
913  }
914  emit UpdateOutputSelect(m_OutputSelect);
915 
916 } // CTHM1176InstrumentController::SetOutputSelect
917 
919 {
920  if (m_SleepParm != SleepParm)
921  {
922  if (m_pTHM1176 == nullptr ||
923  !m_pTHM1176->ParmSleepSet(SleepParm))
924  {
925  HandleError("Cannot change sleep parameter", __func__);
926  if (m_pTHM1176 == nullptr ||
927  !m_pTHM1176->ParmSleepGet(m_SleepParm))
928  HandleError("Cannot retrieve sleep parameter", __func__);
929  }
930  else
931  m_SleepParm = SleepParm;
932  }
933  emit UpdateSleepParm(m_SleepParm);
934 
935 } // CTHM1176InstrumentController::SetSleepParm
936 
938 {
939  if (m_Units != Units)
940  {
941  try
942  {
943  if (m_pTHM1176 == nullptr)
944  throw;
945 
946  switch (Units)
947  {
948  case kApm:
949  case kkApm:
950  case kmApm:
951  if (!m_pTHM1176->ParmUseCalibrationSet(true) ||
952  !m_pTHM1176->ParmUnitsSet(THM1176Types::kT))
953  throw;
954  break;
955  case kADC:
956  if (!m_pTHM1176->ParmUseCalibrationSet(false))
957  throw;
958  break;
959  default:
960  eUnits l_Units = static_cast<eUnits>(Units);
961  if (!m_pTHM1176->ParmUseCalibrationSet(true) ||
962  !m_pTHM1176->ParmUnitsSet(l_Units))
963  throw;
964  break;
965  }
966  m_Units = Units;
967  }
968  catch(...)
969  {
970  HandleError("Cannot change units", __func__);
971  }
972  }
973  emit UpdateUnits(m_Units);
974 
975 } // CTHM1176InstrumentController::SetUnits
976 
978 {
979  if (m_RangeParms != RangeParms)
980  {
981  if (m_pTHM1176 == nullptr ||
982  !m_pTHM1176->ParmRangeSet(RangeParms))
983  {
984  HandleError("Cannot change range parameters", __func__);
985  if (m_pTHM1176 == nullptr ||
986  !m_pTHM1176->ParmRangeGet(m_RangeParms))
987  HandleError("Cannot retrieve range parameters", __func__);
988  }
989  else
990  m_RangeParms = RangeParms;
991  }
992  emit UpdateRangeParms(m_RangeParms);
993 
994 } // CTHM1176InstrumentController::SetRangeParms
995 
997 {
998  if (m_CommFormat != CommFormat)
999  {
1000  if (m_pTHM1176 == nullptr ||
1001  !m_pTHM1176->SetFormat(CommFormat))
1002  {
1003  HandleError("Cannot change communication format", __func__);
1004  if (m_pTHM1176 == nullptr ||
1005  !m_pTHM1176->GetFormat(m_CommFormat))
1006  HandleError("Cannot retrieve communication format", __func__);
1007  }
1008  else
1009  m_CommFormat = CommFormat;
1010  }
1011  emit UpdateCommFormat(m_CommFormat);
1012 
1013 } // CTHM1176InstrumentController::SetCommFormat
1014 
1016 {
1017  m_CalibrationOverride = Override;
1018 
1019 } // CTHM1176InstrumentManager::SetCalibrationOverride
1020 
1021 
1023 //----------------------------------------------------------------------//
1024 // THM1176 Instrument Manager: Error reporting //
1025 //----------------------------------------------------------------------//
1026 void CTHM1176InstrumentManager::HandleError (QString Description,
1027  QString Context)
1028 {
1029  // Create the error structure.
1030  sError l_Error;
1032  l_Error.Description = Description.toStdString();
1033  l_Error.Context = Context.toStdString();
1034 
1035  // Emit the update.
1036  CErrorList l_ErrorList;
1037  l_ErrorList.push_back(l_Error);
1038  emit UpdateErrorList(l_ErrorList);
1039 
1040 } // CTHM1176InstrumentController::HandleError
1041 
1042 //----------------------------------------------------------------------//
1043 // THM1176 Instrument Manager: Start / Stop //
1044 //----------------------------------------------------------------------//
1046 {
1047  // Create Instrument Scanner and Controller
1048  m_pInstrumentScanner = new CTHM1176InstrumentScanner();
1049  m_pInstrumentController = new CTHM1176InstrumentController();
1050 
1051  // Connect the Instrument Scanner slots.
1053  m_pInstrumentScanner, &CTHM1176InstrumentScanner::Start);
1055  m_pInstrumentScanner, &CTHM1176InstrumentScanner::Stop);
1056 
1057  // Connect the Instrument Scanner signals.
1058  connect(m_pInstrumentScanner, &CTHM1176InstrumentScanner::UpdateInstrumentList,
1059  this, &CTHM1176InstrumentManager::UpdateInstrumentList);
1060  connect(m_pInstrumentScanner, &CTHM1176InstrumentScanner::UpdateErrorList,
1061  this, &CTHM1176InstrumentManager::UpdateErrorList);
1062 
1063  // Connect the Instrument Controller slots.
1064  // - Startup and shutdown.
1066  m_pInstrumentController, &CTHM1176InstrumentController::Start);
1068  m_pInstrumentController, &CTHM1176InstrumentController::Stop);
1069  // - Connection
1070  connect(m_pInstrumentScanner, &CTHM1176InstrumentScanner::UpdateInstrumentList,
1071  m_pInstrumentController, &CTHM1176InstrumentController::UpdateInstrumentList);
1073  m_pInstrumentController, &CTHM1176InstrumentController::SetCurrentInstrument);
1074  // - Instrument control
1076  m_pInstrumentController, &CTHM1176InstrumentController::SetOperatingMode);
1078  m_pInstrumentController, &CTHM1176InstrumentController::SendTrigger,
1079  Qt::BlockingQueuedConnection);
1080  // - Parameters
1082  m_pInstrumentController, &CTHM1176InstrumentController::SetAveragingParms);
1084  m_pInstrumentController, &CTHM1176InstrumentController::SetTriggerParms);
1086  m_pInstrumentController, &CTHM1176InstrumentController::SetOutputSelect);
1088  m_pInstrumentController, &CTHM1176InstrumentController::SetSleepParm);
1090  m_pInstrumentController, &CTHM1176InstrumentController::SetUnits);
1092  m_pInstrumentController, &CTHM1176InstrumentController::SetRangeParms);
1094  m_pInstrumentController, &CTHM1176InstrumentController::SetCommFormat);
1096  m_pInstrumentController, &CTHM1176InstrumentController::SetCalibrationOverride);
1097 
1098  // Connect the Instrument Controller signals.
1099  // - Basic instrument control:
1100  connect(m_pInstrumentController, &CTHM1176InstrumentController::UpdateCurrentInstrument,
1101  this, &CTHM1176InstrumentManager::UpdateCurrentInstrument);
1102  connect(m_pInstrumentController, &CTHM1176InstrumentController::UpdateInstrumentPointer,
1103  this, &CTHM1176InstrumentManager::UpdateInstrumentPointer);
1104  connect(m_pInstrumentController, &CTHM1176InstrumentController::UpdateOperatingMode,
1105  this, &CTHM1176InstrumentManager::UpdateOperatingMode);
1106  connect(m_pInstrumentController, &CTHM1176InstrumentController::UpdateMeasurement,
1107  this, &CTHM1176InstrumentManager::UpdateMeasurement);
1108  connect(m_pInstrumentController, &CTHM1176InstrumentController::UpdateErrorList,
1109  this, &CTHM1176InstrumentManager::UpdateErrorList);
1110  // - Instrument information and parameter bounds:
1111  connect(m_pInstrumentController, &CTHM1176InstrumentController::UpdateIdentification,
1112  this, &CTHM1176InstrumentManager::UpdateIdentification);
1113  connect(m_pInstrumentController, &CTHM1176InstrumentController::UpdateRangeList,
1114  this, &CTHM1176InstrumentManager::UpdateRangeList);
1115  connect(m_pInstrumentController, &CTHM1176InstrumentController::UpdateUnitsList,
1116  this, &CTHM1176InstrumentManager::UpdateUnitsList);
1117  connect(m_pInstrumentController, &CTHM1176InstrumentController::UpdateDivisorList,
1118  this, &CTHM1176InstrumentManager::UpdateDivisorList);
1119  connect(m_pInstrumentController, &CTHM1176InstrumentController::UpdateAveragingParmBounds,
1120  this, &CTHM1176InstrumentManager::UpdateAveragingParmBounds);
1121  connect(m_pInstrumentController, &CTHM1176InstrumentController::UpdateTriggerParmBounds,
1122  this, &CTHM1176InstrumentManager::UpdateTriggerParmBounds);
1123  connect(m_pInstrumentController, &CTHM1176InstrumentController::UpdateRangeParmBounds,
1124  this, &CTHM1176InstrumentManager::UpdateRangeParmBounds);
1125  // - Parameters
1126  connect(m_pInstrumentController, &CTHM1176InstrumentController::UpdateAveragingParms,
1127  this, &CTHM1176InstrumentManager::UpdateAveragingParms);
1128  connect(m_pInstrumentController, &CTHM1176InstrumentController::UpdateTriggerParms,
1129  this, &CTHM1176InstrumentManager::UpdateTriggerParms);
1130  connect(m_pInstrumentController, &CTHM1176InstrumentController::UpdateOutputSelect,
1131  this, &CTHM1176InstrumentManager::UpdateOutputSelect);
1132  connect(m_pInstrumentController, &CTHM1176InstrumentController::UpdateSleepParm,
1133  this, &CTHM1176InstrumentManager::UpdateSleepParm);
1134  connect(m_pInstrumentController, &CTHM1176InstrumentController::UpdateUnits,
1135  this, &CTHM1176InstrumentManager::UpdateUnits);
1136  connect(m_pInstrumentController, &CTHM1176InstrumentController::UpdateRangeParms,
1137  this, &CTHM1176InstrumentManager::UpdateRangeParms);
1138  connect(m_pInstrumentController, &CTHM1176InstrumentController::UpdateCommFormat,
1139  this, &CTHM1176InstrumentManager::UpdateCommFormat);
1140 
1141  // Create and initialize the resource manager.
1142  m_pResourceManager = new THM1176_RSRC_MGR_CLS;
1143  if (nullptr == m_pResourceManager || !m_pResourceManager->Initialize())
1144  HandleError("Cannot initialize Resource Manager", __func__);
1145 
1146  // Move the Instrument Scanner to its own thread.
1147  m_pInstrumentScanner->moveToThread(&m_InstrumentScanThread);
1148  m_InstrumentScanThread.start();
1149 
1150  // Initialize the Instrument Scanner.
1151  emit StartInstrumentScanner(m_pResourceManager);
1152 
1153  // Move the Instrument Controller to its own thread.
1154  m_pInstrumentController->moveToThread(&m_InstrumentControlThread);
1155  m_InstrumentControlThread.start();
1156 
1157  // Set up the Instrument Controller to clean up after itself.
1158  connect(&m_InstrumentControlThread, &QThread::finished,
1159  m_pInstrumentController, &CTHM1176InstrumentController::deleteLater);
1160  connect(&m_InstrumentControlThread, &QThread::finished,
1161  m_pInstrumentScanner, &CTHM1176InstrumentScanner::Stop);
1162  connect(&m_InstrumentScanThread, &QThread::finished,
1163  m_pInstrumentScanner, &CTHM1176InstrumentScanner::deleteLater);
1164 
1165  // Initialize the Instrument Controller.
1166  emit StartInstrumentController(m_pResourceManager);
1167 
1168 } // CTHM1176InstrumentManager::Start
1169 
1171 {
1172  // Shut down the Instrument Controller.
1173  // Its thread's finished() signal will in turn shut down the Instrument Scanner.
1174  emit StopInstrumentController();
1175 
1176  // Wait for the Instrument Controller thread to shut down.
1177  if (!m_InstrumentControlThread.wait())
1178  HandleError("Cannot quit Instrument Controller thread", __func__);
1179 
1180  // Wait for the Instrument Scanner thread to shut down.
1181  m_InstrumentScanThread.quit();
1182  if (!m_InstrumentScanThread.wait())
1183  HandleError("Cannot quit Instrument Scanner thread", __func__);
1184 
1185  // Kill the Resource Manager.
1186  delete m_pResourceManager;
1187 
1188  // Reset the object pointers to NULL, just to be sure.
1189  m_pResourceManager = nullptr;
1190  m_pTHM1176 = nullptr;
1191  m_pInstrumentScanner = nullptr;
1192  m_pInstrumentController = nullptr;
1193 
1194 } // CTHM1176InstrumentManager::Stop
1195 
1196 //----------------------------------------------------------------------//
1197 // THM1176 Instrument Manager communication with Instrument Scanner //
1198 //----------------------------------------------------------------------//
1199 void CTHM1176InstrumentManager::UpdateInstrumentList (CResourceList InstrumentList)
1200 {
1201  if (m_InstrumentList != InstrumentList)
1202  {
1203  m_InstrumentList = InstrumentList;
1204  emit NotifyInstrumentList(m_InstrumentList);
1205  }
1206 
1207 } //CTHM1176InstrumentManager::UpdateInstrumentList
1208 
1209 //----------------------------------------------------------------------//
1210 // THM1176 Instrument Manager communication with Instrument Controller //
1211 //----------------------------------------------------------------------//
1212 // Basic instrument control:
1213 void CTHM1176InstrumentManager::UpdateCurrentInstrument (tResourceName CurrentInstrument)
1214 {
1215  // Only emit notification if the current instrument changes.
1216  if (m_CurrentInstrument != CurrentInstrument)
1217  {
1218  m_CurrentInstrument = CurrentInstrument;
1219  emit NotifyCurrentInstrument(m_CurrentInstrument);
1220  }
1221 
1222 } // CTHM1176InstrumentManager::UpdateCurrentInstrument
1223 
1224 void CTHM1176InstrumentManager::UpdateInstrumentPointer (CTHM1176Instrument<THM1176_INSTR_CLS, THM1176_RSRC_MGR_CLS> * pTHM1176)
1225 {
1226  // The instrument pointer is for internal consumption only: just store it.
1227  m_pTHM1176 = pTHM1176;
1228 
1229 } // CTHM1176InstrumentManager::UpdateInstrumentPointer
1230 
1231 void CTHM1176InstrumentManager::UpdateOperatingMode (eTHM1176OperatingMode OperatingMode)
1232 {
1233  // Only emit notification if the poarameter changes.
1234  if (m_OperatingMode != OperatingMode)
1235  {
1236  m_OperatingMode = OperatingMode;
1237  emit NotifyOperatingMode(m_OperatingMode);
1238  }
1239 
1240 } // CTHM1176InstrumentManager::UpdateOperatingMode
1241 
1242 void CTHM1176InstrumentManager::UpdateMeasurement (CMeasurement Measurement)
1243 {
1244  // Always emit notification of measurements.
1245  m_Measurement = Measurement;
1246  emit NotifyMeasurement(m_Measurement);
1247 
1248 } // CTHM1176InstrumentManager::UpdateMeasurement
1249 
1250 void CTHM1176InstrumentManager::UpdateErrorList (CErrorList ErrorList)
1251 {
1252  // Always emit notification of errors.
1253  m_ErrorList = ErrorList;
1254  emit NotifyErrorList(m_ErrorList);
1255 
1256 } // CTHM1176InstrumentManager::UpdateErrorList
1257 
1258 // Instrument information and parameter bounds:
1259 void CTHM1176InstrumentManager::UpdateIdentification (sIdentifier Identification)
1260 {
1261  // Always emit – only done when connecting an instrument.
1262  m_Identification = Identification;
1263  emit NotifyIdentification(m_Identification);
1264 
1265 } // CTHM1176InstrumentManager::UpdateIdentification
1266 
1267 void CTHM1176InstrumentManager::UpdateRangeList (CFluxList RangeList)
1268 {
1269  // Always emit – only done when connecting an instrument.
1270  m_RangeList = RangeList;
1271  emit NotifyRangeList(m_RangeList);
1272 
1273 } // CTHM1176InstrumentManager::UpdateRangeList
1274 
1275 void CTHM1176InstrumentManager::UpdateUnitsList (CTHM1176UnitsList UnitsList)
1276 {
1277  // Always emit – only done when connecting an instrument.
1278  m_UnitsList = UnitsList;
1279  emit NotifyUnitsList(m_UnitsList);
1280 
1281 } // CTHM1176InstrumentManager::UpdateUnitsList
1282 
1283 void CTHM1176InstrumentManager::UpdateDivisorList (CDivisorList DivisorList)
1284 {
1285  // Always emit – only done when connecting an instrument.
1286  m_DivisorList = DivisorList;
1287  emit NotifyDivisorList(m_DivisorList);
1288 
1289 } // CTHM1176InstrumentManager::UpdateDivisorList
1290 
1291 void CTHM1176InstrumentManager::UpdateAveragingParmBounds (sAveraging<sBoundedParm> AveragingParmBounds)
1292 {
1293  // Always emit – only done when connecting an instrument.
1294  m_AveragingParmBounds = AveragingParmBounds;
1295  emit NotifyAveragingParmBounds(m_AveragingParmBounds);
1296 
1297  // Also recover and emit the current parameter value.
1298  m_AveragingParms.NoPoints = m_AveragingParmBounds.NoPoints.Val;
1299  emit NotifyAveragingParms(m_AveragingParms);
1300 
1301 } // CTHM1176InstrumentManager::UpdateAveragingParmBounds
1302 
1303 void CTHM1176InstrumentManager::UpdateTriggerParmBounds (sInputTrigger<sBoundedParm> TriggerParmBounds)
1304 {
1305  // Always emit – only done when connecting an instrument.
1306  m_TriggerParmBounds = TriggerParmBounds;
1307  emit NotifyTriggerParmBounds(m_TriggerParmBounds);
1308 
1309  // Also recover and emit the current parameter value.
1310  m_TriggerParms.Source = TriggerParmBounds.Source;
1311  m_TriggerParms.Period_s = TriggerParmBounds.Period_s.Val;
1312  m_TriggerParms.Count = TriggerParmBounds.Count.Val;
1313  emit NotifyTriggerParms(m_TriggerParms);
1314 
1315 } // CTHM1176InstrumentManager::UpdateTriggerParmBounds
1316 
1317 void CTHM1176InstrumentManager::UpdateRangeParmBounds (sRange<sBoundedParm> RangeParmBounds)
1318 {
1319  // Always emit – only done when connecting an instrument.
1320  m_RangeParmBounds = RangeParmBounds;
1321  emit NotifyRangeParmBounds(m_RangeParmBounds);
1322 
1323  // Also recover and emit the current parameter value.
1324  m_RangeParms.Auto = m_RangeParmBounds.Auto;
1325  m_RangeParms.Range = m_RangeParmBounds.Range.Val;
1326  emit NotifyRangeParms(m_RangeParms);
1327 
1328 } // CTHM1176InstrumentManager::UpdateRangeParmBounds
1329 
1330 // Parameters
1331 void CTHM1176InstrumentManager::UpdateAveragingParms (sAveraging<uParm> AveragingParms)
1332 {
1333  // Only emit notification if the parameter changes.
1334  // Note: notification of averaging parameters at connection is handled by UpdateAveragingParmBounds.
1335  if (m_AveragingParms != AveragingParms)
1336  {
1337  m_AveragingParms = AveragingParms;
1338  emit NotifyAveragingParms(m_AveragingParms);
1339  }
1340 
1341 } // CTHM1176InstrumentManager::UpdateAveragingParms
1342 
1343 void CTHM1176InstrumentManager::UpdateTriggerParms (sInputTrigger<uParm> TriggerParms)
1344 {
1345  // Only emit notification if the parameter changes.
1346  // Note: notification of trigger parameters at connection is handled by UpdateTriggerParmBounds.
1347  if (m_TriggerParms != TriggerParms)
1348  {
1349  m_TriggerParms = TriggerParms;
1350  emit NotifyTriggerParms(m_TriggerParms);
1351  }
1352 
1353 } // CTHM1176InstrumentManager::UpdateTriggerParms
1354 
1355 void CTHM1176InstrumentManager::UpdateOutputSelect (sArbitraryMeasurements OutputSelect)
1356 {
1357  // Only emit notification if the parameter changes, or if instrument is not connected (i.e. connecting).
1358  if (m_OutputSelect != OutputSelect || kTHM1176NotConnected == m_OperatingMode)
1359  {
1360  m_OutputSelect = OutputSelect;
1361  emit NotifyOutputSelect(m_OutputSelect);
1362  }
1363 
1364 } // CTHM1176InstrumentManager::UpdateOutputSelect
1365 
1366 void CTHM1176InstrumentManager::UpdateSleepParm (bool SleepParm)
1367 {
1368  // Only emit notification if the parameter changes, or if instrument is not connected (i.e. connecting).
1369  if (m_SleepParm != SleepParm || kTHM1176NotConnected == m_OperatingMode)
1370  {
1371  m_SleepParm = SleepParm;
1372  emit NotifySleepParm(m_SleepParm);
1373  }
1374 
1375 } // CTHM1176InstrumentManager::UpdateSleepParm
1376 
1377 void CTHM1176InstrumentManager::UpdateUnits (eTHM1176Units Units)
1378 {
1379  // Only emit notification if the parameter changes, or if instrument is not connected (i.e. connecting).
1380  if (m_Units != Units || kTHM1176NotConnected == m_OperatingMode)
1381  {
1382  m_Units = Units;
1383  emit NotifyUnits(m_Units);
1384  }
1385 
1386 } // CTHM1176InstrumentManager::UpdateUnits
1387 
1388 void CTHM1176InstrumentManager::UpdateRangeParms (sRange<uParm> RangeParms)
1389 {
1390  // Only emit notification if the parameter changes.
1391  // Note: notification of range parameters at connection is handled by UpdateRangeParmBounds.
1392  if (m_RangeParms != RangeParms)
1393  {
1394  m_RangeParms = RangeParms;
1395  emit NotifyRangeParms(m_RangeParms);
1396  }
1397 
1398 } // CTHM1176InstrumentManager::UpdateRangeParms
1399 
1400 void CTHM1176InstrumentManager::UpdateCommFormat (eCommunicationFormat CommFormat)
1401 {
1402  // Only emit notification if the parameter changes, or if instrument is not connected (i.e. connecting).
1403  if (m_CommFormat != CommFormat || kTHM1176NotConnected == m_OperatingMode)
1404  {
1405  m_CommFormat = CommFormat;
1406  emit NotifyCommFormat(m_CommFormat);
1407  }
1408 
1409 } // CTHM1176InstrumentManager::UpdateCommFormat
1410 
1411 
1412 //----------------------------------------------------------------------//
1413 // THM1176 Instrument Manager property Get methods //
1414 //----------------------------------------------------------------------//
1415 // Basic instrument control:
1417 {
1418  return m_InstrumentList;
1419 
1420 } // CTHM1176InstrumentManager::GetInstrumentList
1421 
1423 {
1424  return m_CurrentInstrument;
1425 
1426 } // CTHM1176InstrumentManager::GetCurrentInstrument
1427 
1429 {
1430  return m_OperatingMode;
1431 
1432 } // CTHM1176InstrumentManager::GetOperatingMode
1433 
1435 {
1436  if (m_pTHM1176 == nullptr)
1437  HandleError("Instrument not connected", __func__);
1438  return m_Measurement;
1439 
1440 } // CTHM1176InstrumentManager::GetOperatingMode
1441 
1443 {
1444  return m_ErrorList;
1445 
1446 } // CTHM1176InstrumentManager::GetErrorList
1447 
1448 
1449 // Instrument information and parameter bounds:
1451 {
1452  if (m_pTHM1176 == nullptr)
1453  HandleError("Instrument not connected", __func__);
1454  return m_Identification;
1455 
1456 } // CTHM1176InstrumentManager::GetIdentification
1457 
1459 {
1460  if (m_pTHM1176 == nullptr)
1461  HandleError("Instrument not connected", __func__);
1462  return m_RangeList;
1463 
1464 } // CTHM1176InstrumentManager::GetRangeList
1465 
1467 {
1468  if (m_pTHM1176 == nullptr)
1469  HandleError("Instrument not connected", __func__);
1470  return m_UnitsList;
1471 
1472 } // CTHM1176InstrumentManager::GetUnitsList
1473 
1475 {
1476  if (m_pTHM1176 == nullptr)
1477  HandleError("Instrument not connected", __func__);
1478  return m_DivisorList;
1479 
1480 } // CTHM1176InstrumentManager::GetDivisorList
1481 
1483 {
1484  if (m_pTHM1176 == nullptr)
1485  HandleError("Instrument not connected", __func__);
1486  return m_AveragingParmBounds;
1487 
1488 } // CTHM1176InstrumentManager::GetAveragingParmBounds
1489 
1491 {
1492  if (m_pTHM1176 == nullptr)
1493  HandleError("Instrument not connected", __func__);
1494  return m_TriggerParmBounds;
1495 
1496 } // CTHM1176InstrumentManager::GetTriggerParmBounds
1497 
1499 {
1500  if (m_pTHM1176 == nullptr)
1501  HandleError("Instrument not connected", __func__);
1502  return m_RangeParmBounds;
1503 
1504 } // CTHM1176InstrumentManager::GetRangeParmBounds
1505 
1506 
1507 // Parameters:
1509 {
1510  if (m_pTHM1176 == nullptr)
1511  HandleError("Instrument not connected", __func__);
1512  return m_AveragingParms;
1513 
1514 } // CTHM1176InstrumentManager::GetAveragingParms
1515 
1517 {
1518  if (m_pTHM1176 == nullptr)
1519  HandleError("Instrument not connected", __func__);
1520  return m_TriggerParms;
1521 
1522 } // CTHM1176InstrumentManager::GetTriggerParms
1523 
1525 {
1526  if (m_pTHM1176 == nullptr)
1527  HandleError("Instrument not connected", __func__);
1528  return m_OutputSelect;
1529 
1530 } // CTHM1176InstrumentManager::GetOutputSelect
1531 
1533 {
1534  if (m_pTHM1176 == nullptr)
1535  HandleError("Instrument not connected", __func__);
1536  return m_SleepParm;
1537 
1538 } // CTHM1176InstrumentManager::GetSleepParm
1539 
1541 {
1542  if (m_pTHM1176 == nullptr)
1543  HandleError("Instrument not connected", __func__);
1544  return m_Units;
1545 
1546 } // CTHM1176InstrumentManager::GetUnits
1547 
1549 {
1550  if (m_pTHM1176 == nullptr)
1551  HandleError("Instrument not connected", __func__);
1552  return m_RangeParms;
1553 
1554 } // CTHM1176InstrumentManager::GetRangeParms
1555 
1557 {
1558  if (m_pTHM1176 == nullptr)
1559  HandleError("Instrument not connected", __func__);
1560  return m_CommFormat;
1561 
1562 } // CTHM1176InstrumentManager::GetCommFormat
1563 
1565 {
1566  if (m_pTHM1176 == nullptr)
1567  {
1568  HandleError("Instrument not connected", __func__);
1569  return false;
1570  }
1571  else
1572  {
1573  return m_pTHM1176->GetImmediateMeasurementPeriod(rAvg, rPeriod);
1574  }
1575 }
1576 
1577 bool CTHM1176InstrumentManager::ReadInformationDates(QDateTime& rManufacturingDate, QDateTime& rCalibrationDate)
1578 {
1579  if (m_pTHM1176 == nullptr)
1580  {
1581  HandleError("Instrument not connected", __func__);
1582  return false;
1583  }
1584  else
1585  {
1586  std::string l_SManufacturingDate;
1587  std::time_t l_ManufacturingDate;
1588  std::string l_SCalibrationDate;
1589  std::time_t l_CalibrationDate;
1590  bool l_Success = m_pTHM1176->ReadInformationDates(l_SManufacturingDate, l_ManufacturingDate, l_SCalibrationDate, l_CalibrationDate);
1591 
1592  if(l_Success)
1593  {
1594  rManufacturingDate = QDateTime::fromSecsSinceEpoch(l_ManufacturingDate);
1595  rCalibrationDate = QDateTime::fromSecsSinceEpoch(l_CalibrationDate);
1596  }
1597 
1598  return l_Success;
1599  }
1600 } // CTHM1176InstrumentManager::ReadInformationDates
1601 
1602 
1603 //----------------------------------------------------------------------//
1604 // THM1176 Instrument Manager property Set methods/slots //
1605 //----------------------------------------------------------------------//
1606 // - Basic instrument control:
1608 {
1609  // Return immediately if the value has not changed.
1610  if (CurrentInstrument == m_CurrentInstrument)
1611  return;
1612  // Ensure that the resource name is in the current resource list.
1613  auto l_pResource = m_InstrumentList.begin();
1614  for (; l_pResource < m_InstrumentList.end(); l_pResource++)
1615  if (*l_pResource == CurrentInstrument) break;
1616  if (l_pResource >= m_InstrumentList.end())
1617  {
1618  HandleError("Resource name not in resource list", __func__);
1619  return;
1620  }
1621  // If appropriate, abort any outstanding Reads blocking the Instrument Controller.
1622  if (m_pTHM1176 != nullptr &&
1623  (m_OperatingMode == kTHM1176Measure || m_OperatingMode == kTHM1176MeasureContinuously) &&
1624  m_Identification.FirmwareVersion.Major >= THM1176_MIN_VERSION_WITH_ABORTREAD &&
1625  !m_pTHM1176->AbortRead())
1626  HandleError("Cannot abort read", __func__);
1627  // Send it on to the Instrument Controller.
1628  emit RelayCurrentInstrument(CurrentInstrument);
1629 } // CTHM1176InstrumentManager::SetCurrentInstrument
1630 
1632 {
1633  // Ensure that the instrument is connected.
1634  if (m_pTHM1176 == nullptr)
1635  {
1636  HandleError("Instrument not connected", __func__);
1637  return;
1638  }
1639  // Return immediately if the value has not changed.
1640  if (OperatingMode == m_OperatingMode) return;
1641  // If appropriate, abort any outstanding Reads blocking the Instrument Controller.
1642  if ((m_OperatingMode == kTHM1176Measure || m_OperatingMode == kTHM1176MeasureContinuously) &&
1643  m_Identification.FirmwareVersion.Major >= THM1176_MIN_VERSION_WITH_ABORTREAD &&
1644  !m_pTHM1176->AbortRead())
1645  HandleError("Cannot abort read", __func__);
1646  // Send it on to the Instrument Controller.
1647  emit RelayOperatingMode(OperatingMode);
1648 } // CTHM1176InstrumentManager::SetOperatingMode
1649 
1650 // - Parameters:
1652 {
1653  // Ensure that the instrument is connected.
1654  if (m_pTHM1176 == nullptr)
1655  {
1656  HandleError("Instrument not connected", __func__);
1657  return;
1658  }
1659  // Return immediately if the value has not changed.
1660  if (AveragingParms == m_AveragingParms) return;
1661  // Ensure the averaging count is in range.
1662  if (AveragingParms.NoPoints < m_AveragingParmBounds.NoPoints.Min ||
1663  AveragingParms.NoPoints > m_AveragingParmBounds.NoPoints.Max)
1664  {
1665  HandleError("Averaging parameter out of range", __func__);
1666  return;
1667  }
1668  // If appropriate, abort any outstanding Reads blocking the Instrument Controller.
1669  if ((m_OperatingMode == kTHM1176Measure || m_OperatingMode == kTHM1176MeasureContinuously) &&
1670  m_Identification.FirmwareVersion.Major >= THM1176_MIN_VERSION_WITH_ABORTREAD &&
1671  !m_pTHM1176->AbortRead())
1672  HandleError("Cannot abort read", __func__);
1673  // Send it on to the Instrument Controller.
1674  emit RelayAveragingParms(AveragingParms);
1675 } // CTHM1176InstrumentManager::SetAveragingParms
1676 
1678 {
1679  // Ensure that the instrument is connected.
1680  if (m_pTHM1176 == nullptr)
1681  {
1682  HandleError("Instrument not connected", __func__);
1683  return;
1684  }
1685  // Return immediately if the value has not changed.
1686  if (TriggerParms == m_TriggerParms) return;
1687  // Ensure that the trigger parameters are in range.
1688  if (TriggerParms.Count < m_TriggerParmBounds.Count.Min ||
1689  TriggerParms.Count > m_TriggerParmBounds.Count.Max ||
1690  (TriggerParms.Source == kInputTrigSrcTimer &&
1691  (TriggerParms.Period_s < m_TriggerParmBounds.Period_s.Min ||
1692  TriggerParms.Period_s > m_TriggerParmBounds.Period_s.Max)))
1693  {
1694  HandleError("Trigger parameter out of bounds", __func__);
1695  return;
1696  }
1697  // If appropriate, abort any outstanding Reads blocking the Instrument Controller.
1698  if ((m_OperatingMode == kTHM1176Measure || m_OperatingMode == kTHM1176MeasureContinuously) &&
1699  m_Identification.FirmwareVersion.Major >= THM1176_MIN_VERSION_WITH_ABORTREAD &&
1700  !m_pTHM1176->AbortRead())
1701  HandleError("Cannot abort read", __func__);
1702  // Send it on to the Instrument Controller.
1703  emit RelayTriggerParms(TriggerParms);
1704 } // CTHM1176InstrumentManager::SetTriggerParms
1705 
1707 {
1708  // Ensure that the instrument is connected.
1709  if (m_pTHM1176 == nullptr)
1710  {
1711  HandleError("Instrument not connected", __func__);
1712  return;
1713  }
1714  // Return immediately if the value has not changed.
1715  if (OutputSelect == m_OutputSelect) return;
1716  // Ensure that the output selection count is in range.
1717  if (OutputSelect.NoMeasurements <= 0 ||
1718  OutputSelect.NoMeasurements > m_TriggerParms.Count)
1719  {
1720  HandleError("Invalid measurement count", __func__);
1721  return;
1722  }
1723  // If appropriate, abort any outstanding Reads blocking the Instrument Controller.
1724  if ((m_OperatingMode == kTHM1176Measure || m_OperatingMode == kTHM1176MeasureContinuously) &&
1725  m_Identification.FirmwareVersion.Major >= THM1176_MIN_VERSION_WITH_ABORTREAD &&
1726  !m_pTHM1176->AbortRead())
1727  HandleError("Cannot abort read", __func__);
1728  // Send it on to the Instrument Controller.
1729  emit RelayOutputSelect(OutputSelect);
1730 } // CTHM1176InstrumentManager::SetOutputSelect
1731 
1733 {
1734  // Ensure that the instrument is connected.
1735  if (m_pTHM1176 == nullptr)
1736  {
1737  HandleError("Instrument not connected", __func__);
1738  return;
1739  }
1740  // Return immediately if the value has not changed.
1741  if (SleepParm == m_SleepParm) return;
1742  // If appropriate, abort any outstanding Reads blocking the Instrument Controller.
1743  if ((m_OperatingMode == kTHM1176Measure || m_OperatingMode == kTHM1176MeasureContinuously) &&
1744  m_Identification.FirmwareVersion.Major >= THM1176_MIN_VERSION_WITH_ABORTREAD &&
1745  !m_pTHM1176->AbortRead())
1746  HandleError("Cannot abort read", __func__);
1747  // Send it on to the Instrument Controller.
1748  emit RelaySleepParm(SleepParm);
1749 } // CTHM1176InstrumentManager::SetSleepParm
1750 
1752 {
1753  // Ensure that the instrument is connected.
1754  if (m_pTHM1176 == nullptr)
1755  {
1756  HandleError("Instrument not connected", __func__);
1757  return;
1758  }
1759  // Return immediately if the value has not changed.
1760  if (Units == m_Units) return;
1761  // Ensure that the selected units are supported by this instrument.
1762  auto l_pUnits = m_UnitsList.begin();
1763  for (; l_pUnits < m_UnitsList.end(); l_pUnits++)
1764  if (*l_pUnits == Units) break;
1765  if (l_pUnits >= m_UnitsList.end())
1766  {
1767  HandleError("Invalid Units", __func__);
1768  return;
1769  }
1770  // If appropriate, abort any outstanding Reads blocking the Instrument Controller.
1771  if ((m_OperatingMode == kTHM1176Measure || m_OperatingMode == kTHM1176MeasureContinuously) &&
1772  m_Identification.FirmwareVersion.Major >= THM1176_MIN_VERSION_WITH_ABORTREAD &&
1773  !m_pTHM1176->AbortRead())
1774  HandleError("Cannot abort read", __func__);
1775  // Send it on to the Instrument Controller.
1776  emit RelayUnits(Units);
1777 } // CTHM1176InstrumentManager::SetUnits
1778 
1780 {
1781  // Ensure that the instrument is connected.
1782  if (m_pTHM1176 == nullptr)
1783  {
1784  HandleError("Instrument not connected", __func__);
1785  return;
1786  }
1787  // Return immediately if the value has not changed.
1788  if (RangeParms == m_RangeParms) return;
1789  // Ensure that any manual range selections are in range.
1790  tFlux l_Tolerance = 0.001f * RangeParms.Range;
1791  if (!RangeParms.Auto)
1792  {
1793  auto l_pRange = m_RangeList.begin();
1794  for (; l_pRange < m_RangeList.end(); l_pRange++)
1795  if (abs(*l_pRange - RangeParms.Range) < l_Tolerance) break;
1796  if (l_pRange >= m_RangeList.end())
1797  {
1798  HandleError("Invalid range selection", __func__);
1799  return;
1800  }
1801  }
1802  // If appropriate, abort any outstanding Reads blocking the Instrument Controller.
1803  if ((m_OperatingMode == kTHM1176Measure || m_OperatingMode == kTHM1176MeasureContinuously) &&
1804  m_Identification.FirmwareVersion.Major >= THM1176_MIN_VERSION_WITH_ABORTREAD &&
1805  !m_pTHM1176->AbortRead())
1806  HandleError("Cannot abort read", __func__);
1807  // Send it on to the Instrument Controller.
1808  emit RelayRangeParms(RangeParms);
1809 } // CTHM1176InstrumentManager::SetRangeParms
1810 
1812 {
1813  // Ensure that the instrument is connected.
1814  if (m_pTHM1176 == nullptr)
1815  {
1816  HandleError("Instrument not connected", __func__);
1817  return;
1818  }
1819  // Return immediately if the value has not changed.
1820  if (CommFormat == m_CommFormat) return;
1821  // If appropriate, abort any outstanding Reads blocking the Instrument Controller.
1822  if ((m_OperatingMode == kTHM1176Measure || m_OperatingMode == kTHM1176MeasureContinuously) &&
1823  m_Identification.FirmwareVersion.Major >= THM1176_MIN_VERSION_WITH_ABORTREAD &&
1824  !m_pTHM1176->AbortRead())
1825  HandleError("Cannot abort read", __func__);
1826  // Send it on to the Instrument Controller.
1827  emit RelayCommFormat(CommFormat);
1828 } // CTHM1176InstrumentManager::SetCommFormat
MTL::CTHM1176InstrumentManager::GetCommFormat
eCommunicationFormat GetCommFormat(void)
Get the communication format parameters.
Definition: CTHM1176InstrumentManager.cpp:1556
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::CMeasurement::Bz
CFluxList Bz
Bz value for each measurement.
Definition: THM1176InstrumentManagerTypes.h:56
MTL::CMeasurement::By
CFluxList By
By value for each measurement.
Definition: THM1176InstrumentManagerTypes.h:55
MTL::Instrument::CResourceList
List of VISA resource names.
Definition: IEEE488InstrumentTypes.h:26
MTL::Instrument::THM1176Types::kInputTrigSrcBus
@ kInputTrigSrcBus
Bus trigger: start measurement upon USB trigger message.
Definition: THM1176Types.h:399
MTL::CTHM1176InstrumentManager::SendTrigger
void SendTrigger(void)
Send a bus trigger to the instrument (both slot and signal).
MTL::CTHM1176InstrumentManager::SetSleepParm
void SetSleepParm(bool SleepParm)
Set the sleep parameter.
Definition: CTHM1176InstrumentManager.cpp:1732
MTL::CTHM1176UnitsList
List of measurement units.
Definition: THM1176InstrumentManagerTypes.h:46
MTL::Instrument::THM1176Types::sRange::Range
ParmType< tFlux > Range
Measurement range, if auto-ranging is not enabled.
Definition: THM1176Types.h:460
MTL::Instrument::THM1176Types::sInputTrigger::Period_s
ParmType< F64 > Period_s
Trigger period, for timed trigger.
Definition: THM1176Types.h:407
MTL::CTHM1176InstrumentController::SetOperatingMode
void SetOperatingMode(eTHM1176OperatingMode OperatingMode)
Set operating mode.
Definition: CTHM1176InstrumentManager.cpp:403
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
MTL::kApm
@ kApm
Equivalent H in a vacuum, in A/m.
Definition: THM1176InstrumentManagerTypes.h:38
MTL::Instrument::THM1176Types::sMeasurementConditions::AveragingParms
sAveraging< uParm > AveragingParms
Averaging parameters.
Definition: THM1176Types.h:599
MTL::CTHM1176InstrumentManager::GetUnits
eTHM1176Units GetUnits(void)
Get the measurement units.
Definition: CTHM1176InstrumentManager.cpp:1540
MTL::CTHM1176InstrumentManager::GetErrorList
CErrorList GetErrorList(void)
Get the current error list.
Definition: CTHM1176InstrumentManager.cpp:1442
MTL::CTHM1176InstrumentManager::Stop
void Stop(void)
Shut down the THM1176 Instrument Manager.
Definition: CTHM1176InstrumentManager.cpp:1170
MTL::CTHM1176InstrumentController::UpdateOutputSelect
void UpdateOutputSelect(sArbitraryMeasurements OutputSelect)
Signal a change of the output selection parameters.
MTL::CTHM1176InstrumentManager::SetRangeParms
void SetRangeParms(sRange< uParm > RangeParms)
Set the range parameters.
Definition: CTHM1176InstrumentManager.cpp:1779
MTL::CTHM1176InstrumentManager::GetInstrumentList
CResourceList GetInstrumentList(void)
Get the list of connected instruments.
Definition: CTHM1176InstrumentManager.cpp:1416
MTL::CTHM1176InstrumentController::UpdateCurrentInstrument
void UpdateCurrentInstrument(tResourceName CurrentInstrument)
Signal that current instrument selection has changed.
MTL::CTHM1176InstrumentController::Start
void Start(THM1176_RSRC_MGR_CLS *pResourceManager)
Initialize the Instrument Controller.
Definition: CTHM1176InstrumentManager.cpp:113
MTL::kTHM1176CalibrateZeroOffset
@ kTHM1176CalibrateZeroOffset
Initiate the zero-offset calibration procedure.
Definition: THM1176InstrumentManagerTypes.h:23
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::sMeasurementConditions
Summary of the parameters used to make a measurement.
Definition: THM1176Types.h:598
MTL::kTHM1176MeasureContinuously
@ kTHM1176MeasureContinuously
Start a continuous measurement.
Definition: THM1176InstrumentManagerTypes.h:22
MTL::Instrument::CTHM1176Instrument< THM1176_INSTR_CLS, THM1176_RSRC_MGR_CLS >
THM1176_SCAN_INTERVAL
#define THM1176_SCAN_INTERVAL
Definition: THM1176IM_Test01_Connect.cpp:21
MTL::CMeasurement::SleepParm
bool SleepParm
Sleep parameters used for measurement.
Definition: THM1176InstrumentManagerTypes.h:67
MTL::Instrument::THM1176Types::sError::Description
std::string Description
Error description.
Definition: THM1176Types.h:216
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::kTHM1176RestoreZeroOffset
@ kTHM1176RestoreZeroOffset
Restore the factory zero-offset setting.
Definition: THM1176InstrumentManagerTypes.h:24
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::CException::message
const char * message() const noexcept
Return the message.
Definition: Exception.h:40
MTL::kADC
@ kADC
Raw ADC values.
Definition: THM1176InstrumentManagerTypes.h:41
MTL::CTHM1176InstrumentManager::GetCurrentInstrument
tResourceName GetCurrentInstrument(void)
Get VISA resource name of currently connected instrument.
Definition: CTHM1176InstrumentManager.cpp:1422
MTL::CTHM1176InstrumentManager::THM1176_INST_MGR_ERROR
static const I32 THM1176_INST_MGR_ERROR
Additional error code: Instrument Manager Error.
Definition: CTHM1176InstrumentManager.h:648
MTL::CTHM1176InstrumentManager::GetSleepParm
bool GetSleepParm(void)
Get the sleep parameter.
Definition: CTHM1176InstrumentManager.cpp:1532
MTL::CTHM1176InstrumentController::UpdateDivisorList
void UpdateDivisorList(CDivisorList DivisorList)
Signal to report divisors associated with valid measurement units for newly connected instrument.
MTL::CTHM1176InstrumentManager::GetTriggerParms
sInputTrigger< uParm > GetTriggerParms(void)
Get the trigger parameters.
Definition: CTHM1176InstrumentManager.cpp:1516
MTL::CTHM1176InstrumentManager::GetDivisorList
CDivisorList GetDivisorList(void)
Get the list of divisors associated with each measurement unit for this instrument model.
Definition: CTHM1176InstrumentManager.cpp:1474
MTL::Instrument::THM1176Types::kComFormatAscii
@ kComFormatAscii
Human-legible text.
Definition: THM1176Types.h:446
MTL::CTHM1176InstrumentScanner::Start
void Start(THM1176_RSRC_MGR_CLS *pResourceManager)
Initialize THM1176 Instrument Scanner.
Definition: CTHM1176InstrumentManager.cpp:39
MTL::CTHM1176InstrumentManager::GetAveragingParms
sAveraging< uParm > GetAveragingParms(void)
Get the averaging parameters.
Definition: CTHM1176InstrumentManager.cpp:1508
MTL::CTHM1176InstrumentManager::RelaySleepParm
void RelaySleepParm(bool SleepParm)
Internal signal to relay the sleep parameter to the Instrument Controller.
MTL::Instrument::THM1176Types::sArbitraryMeasurements::NoMeasurements
U32 NoMeasurements
Return this number of measurements.
Definition: THM1176Types.h:578
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::CMeasurement::Units
eTHM1176Units Units
Measurement units for Bx, By, Bz.
Definition: THM1176InstrumentManagerTypes.h:58
MTL::CTHM1176InstrumentManager::SetOperatingMode
void SetOperatingMode(eTHM1176OperatingMode OperatingMode)
Set a new operating mode, for example to start measuring.
Definition: CTHM1176InstrumentManager.cpp:1631
Helpers.h
Collection of utility macros for error messages.
MTL::CTHM1176InstrumentManager::GetAveragingParmBounds
sAveraging< sBoundedParm > GetAveragingParmBounds(void)
Get the bounds on averaging parameters.
Definition: CTHM1176InstrumentManager.cpp:1482
MTL::CTHM1176InstrumentController::UpdateAveragingParmBounds
void UpdateAveragingParmBounds(sAveraging< sBoundedParm > AveragingParmBounds)
Signal to report bounds of averaging parameters for newly connected instrument.
MTL::CTHM1176InstrumentController::SetAveragingParms
void SetAveragingParms(sAveraging< uParm > AveragingParms)
Set the averaging parameters.
Definition: CTHM1176InstrumentManager.cpp:837
MTL::CTHM1176InstrumentController::UpdateTriggerParms
void UpdateTriggerParms(sInputTrigger< uParm > TriggerParms)
Signal a change of the trigger parameters.
MTL::CTHM1176InstrumentManager::GetImmediateMeasurementPeriod
bool GetImmediateMeasurementPeriod(const sAveraging< uParm > &rAvg, F64 &rPeriod)
Get measurement interval for Immediate Trigger, for a given averaging parameter.
Definition: CTHM1176InstrumentManager.cpp:1564
MTL::Instrument::THM1176Types::sIdentifier
Instrument's identification string - parsed version.
Definition: THM1176Types.h:336
MTL::Instrument::THM1176Types::sRange::Auto
bool Auto
Auto-ranging enabled.
Definition: THM1176Types.h:459
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::CTHM1176InstrumentController::SetCurrentInstrument
void SetCurrentInstrument(tResourceName CurrentInstrument)
Select the instrument to connect to.
Definition: CTHM1176InstrumentManager.cpp:311
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::CTHM1176InstrumentController::UpdateErrorList
void UpdateErrorList(CErrorList LatestErrors)
Signal that new errors have been reported.
MTL::Instrument::THM1176Types::sInputTrigger::Count
ParmType< U16 > Count
Trigger count: take this many measurements before sending results.
Definition: THM1176Types.h:408
MTL::CMeasurement::OutputSelect
sArbitraryMeasurements OutputSelect
Output selection parameters used for measurement.
Definition: THM1176InstrumentManagerTypes.h:65
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::THM1176Types::sBoundedParm::Val
DataType Val
Current value.
Definition: THM1176Types.h:247
MTL::CTHM1176InstrumentController::SendTrigger
void SendTrigger(void)
Send a bus trigger.
Definition: CTHM1176InstrumentManager.cpp:628
MTL::Instrument::THM1176Types::sAveraging< uParm >
MTL::CTHM1176InstrumentManager::GetUnitsList
CTHM1176UnitsList GetUnitsList(void)
Get the list of valid measurement units for this instrument model.
Definition: CTHM1176InstrumentManager.cpp:1466
MTL::Instrument::THM1176Types::kInputTrigSrcImmediate
@ kInputTrigSrcImmediate
Immediate trigger: start measurement immediately after previous one completes.
Definition: THM1176Types.h:397
MTL::CTHM1176InstrumentManager::THM1176_INST_CTLR_ERROR
static const I32 THM1176_INST_CTLR_ERROR
Additional error code: Instrument Controller Error.
Definition: CTHM1176InstrumentManager.h:649
MTL::CTHM1176InstrumentManager::Start
void Start(void)
Initialize the THM1176 Instrument Manager.
Definition: CTHM1176InstrumentManager.cpp:1045
MTL::CTHM1176InstrumentManager::SetUnits
void SetUnits(eTHM1176Units Units)
Set the measurement units.
Definition: CTHM1176InstrumentManager.cpp:1751
MTL::CTHM1176InstrumentManager::GetOperatingMode
eTHM1176OperatingMode GetOperatingMode(void)
Get the current operating mode.
Definition: CTHM1176InstrumentManager.cpp:1428
MTL::CTHM1176InstrumentController::Stop
void Stop(void)
Shut down the Instrument Controller.
Definition: CTHM1176InstrumentManager.cpp:119
MTL::CTHM1176InstrumentController::SetRangeParms
void SetRangeParms(sRange< uParm > RangeParms)
Set range parameters.
Definition: CTHM1176InstrumentManager.cpp:977
CTHM1176InstrumentManager.h
Interface definition for Metrolab THM1176/TFM1186 Instrument Manager.
MTL::CTHM1176InstrumentManager::StopInstrumentController
void StopInstrumentController(void)
Internal signal to stop the Instrument Controller.
MTL::kTHM1176Measure
@ kTHM1176Measure
Start a single measurement.
Definition: THM1176InstrumentManagerTypes.h:21
MTL::CTHM1176InstrumentManager::GetRangeParms
sRange< uParm > GetRangeParms(void)
Get the range parameters.
Definition: CTHM1176InstrumentManager.cpp:1548
MTL::CTHM1176InstrumentManager::GetTriggerParmBounds
sInputTrigger< sBoundedParm > GetTriggerParmBounds(void)
Get the bounds on trigger parameters.
Definition: CTHM1176InstrumentManager.cpp:1490
MTL::CTHM1176InstrumentManager::GetRangeParmBounds
sRange< sBoundedParm > GetRangeParmBounds(void)
Get the bounds on range parameters.
Definition: CTHM1176InstrumentManager.cpp:1498
MTL::CTHM1176InstrumentController::SetSleepParm
void SetSleepParm(bool SleepParm)
Set whether or not the instrument sleeps after each measurement.
Definition: CTHM1176InstrumentManager.cpp:918
MTL::kTHM1176Idle
@ kTHM1176Idle
Place the instrument in idle mode.
Definition: THM1176InstrumentManagerTypes.h:20
MTL::Instrument::THM1176Types::sError::Context
std::string Context
SCPI commands being executed at time of error.
Definition: THM1176Types.h:217
MTL::CTHM1176InstrumentManager::StartInstrumentScanner
void StartInstrumentScanner(THM1176_RSRC_MGR_CLS *pResourceManager)
Internal signal to start the Instrument Scanner.
MTL::CMeasurement::AveragingParms
sAveraging< uParm > AveragingParms
Averaging parameters used for measurement.
Definition: THM1176InstrumentManagerTypes.h:62
MTL::kmApm
@ kmApm
Equivalent H in a vacuum, in mA/m.
Definition: THM1176InstrumentManagerTypes.h:40
MTL::CException
Exception to be thrown.
Definition: Exception.h:17
MTL::CMeasurement::Bx
CFluxList Bx
Bx value for each measurement.
Definition: THM1176InstrumentManagerTypes.h:54
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::CTHM1176InstrumentManager::GetIdentification
sIdentifier GetIdentification(void)
Get the current instrument's identification information.
Definition: CTHM1176InstrumentManager.cpp:1450
MTL::CTHM1176InstrumentManager::GetMeasurement
CMeasurement GetMeasurement(void)
Get the last set of measurements.
Definition: CTHM1176InstrumentManager.cpp:1434
MTL::Instrument::tResourceName
std::string tResourceName
IEEE488 resource name.
Definition: IEEE488InstrumentTypes.h:22
MTL::CTHM1176InstrumentManager::GetOutputSelect
sArbitraryMeasurements GetOutputSelect(void)
Get the output selection parameters.
Definition: CTHM1176InstrumentManager.cpp:1524
MTL::Instrument::THM1176Types::kT
@ kT
Tesla.
Definition: THM1176Types.h:183
MTL::Instrument::THM1176Types::sInputTrigger< uParm >
MTL::Instrument::THM1176Types::CUnitsList
List of measurement units.
Definition: THM1176Types.h:194
MTL::Instrument::THM1176Types::sMeasurementConditions::TriggerParms
sInputTrigger< uParm > TriggerParms
Trigger parameters.
Definition: THM1176Types.h:600
MTL::CMeasurement::Temp
ushort Temp
Temperature, in arbitrary units.
Definition: THM1176InstrumentManagerTypes.h:59
MTL::CTHM1176InstrumentManager::SetCommFormat
void SetCommFormat(eCommunicationFormat CommFormat)
Set the communication format parameters.
Definition: CTHM1176InstrumentManager.cpp:1811
MTL::CTHM1176InstrumentManager::ReadInformationDates
bool ReadInformationDates(QDateTime &rManufacturingDate, QDateTime &rCalibrationDate)
Fetch the intrument's date information.
Definition: CTHM1176InstrumentManager.cpp:1577
MTL::Instrument::THM1176Types::CFluxList
List of flux density values.
Definition: THM1176Types.h:170
MTL::CTHM1176InstrumentController::SetCommFormat
void SetCommFormat(eCommunicationFormat CommFormat)
Set communication format.
Definition: CTHM1176InstrumentManager.cpp:996
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::Instrument::THM1176Types::sError
Error returned by the instrument.
Definition: THM1176Types.h:214
MTL::CMeasurement::TriggerParms
sInputTrigger< uParm > TriggerParms
Trigger parameters used for measurement.
Definition: THM1176InstrumentManagerTypes.h:63
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::kkApm
@ kkApm
Equivalent H in a vacuum, in kA/m.
Definition: THM1176InstrumentManagerTypes.h:39
MTL::CTHM1176InstrumentController::SetTriggerParms
void SetTriggerParms(sInputTrigger< uParm > TriggerParms)
Set the trigger parameters.
Definition: CTHM1176InstrumentManager.cpp:871
MTL::CTHM1176InstrumentManager::GetRangeList
CFluxList GetRangeList(void)
Get list of valid ranges for this instrument model.
Definition: CTHM1176InstrumentManager.cpp:1458
MTL::CTHM1176InstrumentController::UpdateUnits
void UpdateUnits(eTHM1176Units Units)
Signal a change of the measurement units.
MTL::CTHM1176InstrumentManager::SetTriggerParms
void SetTriggerParms(sInputTrigger< uParm > TriggerParms)
Set the trigger parameters.
Definition: CTHM1176InstrumentManager.cpp:1677
MTL::CMeasurement::TimestampList
CTimestampList TimestampList
Timestamp for each measurement.
Definition: THM1176InstrumentManagerTypes.h:57
MTL::Instrument::THM1176Types::CErrorList
List of errors returned by the instrument.
Definition: THM1176Types.h:232
MTL::Instrument::THM1176Types::sInputTrigger::Source
eInputTriggerSource Source
Trigger source.
Definition: THM1176Types.h:406
OSDefines.h
Platform Dependent Definitions.
MTL::CTHM1176InstrumentController::SetCalibrationOverride
void SetCalibrationOverride(bool Override)
Set whether or not to override the check for instruments whose zero offset should not be calibrated.
Definition: CTHM1176InstrumentManager.cpp:1015
MTL::CTHM1176InstrumentManager::SetAveragingParms
void SetAveragingParms(sAveraging< uParm > AveragingParms)
Set the averaging parameters.
Definition: CTHM1176InstrumentManager.cpp:1651
Exception.h
Exception handling utilities.
MTL::CTHM1176InstrumentController::UpdateRangeList
void UpdateRangeList(CFluxList RangeList)
Signal to report list of valid ranges for newly connected instrument.
MTL::CTHM1176InstrumentController::UpdateInstrumentList
void UpdateInstrumentList(CResourceList InstrumentList)
Update the Instrument Controller's copy of the list of detected instruments.
Definition: CTHM1176InstrumentManager.cpp:278
MTL::CException::context
const char * context() const noexcept
Return the context.
Definition: Exception.h:46
F64
double F64
64-bit floating-point number.
Definition: OSDefines.h:35
MTL::CTHM1176InstrumentManager::SetCurrentInstrument
void SetCurrentInstrument(tResourceName CurrentInstrument)
Connect a new instrument.
Definition: CTHM1176InstrumentManager.cpp:1607
MTL_Unused
#define MTL_Unused(x)
Definition: Helpers.h:47
MTL::CTHM1176InstrumentController::SetOutputSelect
void SetOutputSelect(sArbitraryMeasurements OutputSelect)
Select what data is returned.
Definition: CTHM1176InstrumentManager.cpp:905
MTL::CMeasurement::CommFormat
eCommunicationFormat CommFormat
Communication parameters used for measurement.
Definition: THM1176InstrumentManagerTypes.h:66
U32
unsigned int U32
32-bit unsigned integer.
Definition: OSDefines.h:32
MTL::kTHM1176Reset
@ kTHM1176Reset
Reset instrument.
Definition: THM1176InstrumentManagerTypes.h:19
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::CTHM1176InstrumentManager::SetOutputSelect
void SetOutputSelect(sArbitraryMeasurements OutputSelect)
Set the output selection parameters.
Definition: CTHM1176InstrumentManager.cpp:1706
MTL::Instrument::THM1176Types::sAveraging::NoPoints
ParmType< U16 > NoPoints
Number of points in block average.
Definition: THM1176Types.h:368
MTL::CTHM1176InstrumentController::SetUnits
void SetUnits(eTHM1176Units Units)
Select the measurement units.
Definition: CTHM1176InstrumentManager.cpp:937
MTL::CTHM1176InstrumentController::UpdateMeasurement
void UpdateMeasurement(CMeasurement Measurement)
Signal that a new measurement is available.
MTL::Instrument::THM1176Types::sError::Code
I32 Code
Error code.
Definition: THM1176Types.h:215
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::CTHM1176InstrumentManager::THM1176_INST_SCANNER_ERROR
static const I32 THM1176_INST_SCANNER_ERROR
Additional error code: Instrument Scanner Error.
Definition: CTHM1176InstrumentManager.h:650
MTL::CMeasurement::RangeParms
sRange< uParm > RangeParms
Range parameters used for measurement.
Definition: THM1176InstrumentManagerTypes.h:64
MTL::CTHM1176InstrumentScanner::Stop
void Stop(void)
Shut down THM1176 Instrument Scanner.
Definition: CTHM1176InstrumentManager.cpp:46
MTL::CTHM1176InstrumentController::UpdateSleepParm
void UpdateSleepParm(bool SleepParm)
Signal a change of the sleep parameter.
MTL::Instrument::THM1176Types::tFlux
F32 tFlux
Flux density value, as 32-bit floating-point number.
Definition: THM1176Types.h:30
MTL::CMeasurement::Warnings
CErrorList Warnings
Any warnings returned during the measurement.
Definition: THM1176InstrumentManagerTypes.h:70
MTL::Instrument::THM1176Types::kInputTrigSrcTimer
@ kInputTrigSrcTimer
Timed trigger: start measurement at regular intervals.
Definition: THM1176Types.h:398