THM1176InstrumentManager  1.0
Qt Object abstraction for Metrolab THM1176
THM1176Types.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 
8 #include <iostream>
9 #include <iomanip>
10 #include <ctime>
11 
12 #include "Eigen/SVD"
13 
14 #include "THM1176.h"
15 
16 using namespace MTL;
17 using namespace MTL::Instrument;
18 using namespace MTL::Instrument::THM1176Types;
19 
20 namespace MTL {
21 namespace Instrument {
22 namespace THM1176Types {
23 
24 //----------------------------------------------------------------------//
25 // Status //
26 //----------------------------------------------------------------------//
27 std::ostream & operator<<(std::ostream & Stream, const eStatusRegisterSet & RegSet)
28 {
29  Stream << ((RegSet == kStatusByte) ? "StatByte" :
30  (RegSet == kStandardEventStatusRegister) ? "StdEvReg" :
31  (RegSet == kStatusQuestionableStatusRegister) ? "QuestReg" :
32  (RegSet == kStatusOperationStatusRegister) ? "OperReg" : "?");
33  return Stream;
34 }
35 std::ostream & operator<<(std::ostream & Stream, const eStatusRegisterType & RegType)
36 {
37  Stream << ((RegType == kStatusEvent) ? "Event" :
38  (RegType == kStatusCondition) ? "Condition" :
39  (RegType == kStatusEnable) ? "Enable" : "?");
40  return Stream;
41 }
42 std::ostream & operator<<(std::ostream & Stream, const sStatusRegister & RegDef)
43 {
44  Stream << "regdef(" << RegDef.Set << " " << RegDef.Type << ")";
45  return Stream;
46 }
47 std::ostream & operator<<(std::ostream & Stream, const RegisterList & RegList)
48 {
49  Stream << "( ";
50  for (auto l_Reg : RegList)
51  Stream << l_Reg << " ";
52  Stream << ")";
53  return Stream;
54 }
55 std::ostream & operator<<(std::ostream & Stream, const StatusValues & StatusList)
56 {
57  Stream << "( ";
58  for (auto l_Value : StatusList)
59  Stream << l_Value << " ";
60  Stream << ")";
61  return Stream;
62 }
63 std::ostream & operator<<(std::ostream & Stream, const uStatusByte & StatusByte)
64 {
65  Stream << "(EAV=" << StatusByte.StatusByte.EAV <<
66  " QSB=" << StatusByte.StatusByte.QSB <<
67  " MAV=" << StatusByte.StatusByte.MAV <<
68  " ESB=" << StatusByte.StatusByte.ESB <<
69  " RQS=" << StatusByte.StatusByte.RQS <<
70  " OSB=" << StatusByte.StatusByte.OSB << ")";
71  return Stream;
72 }
73 std::ostream & operator<<(std::ostream & Stream, const uStandardEvent & StdEventReg)
74 {
75  Stream << "(OperationComplete=" << StdEventReg.StandardEvent.OperationComplete <<
76  " QueryError=" << StdEventReg.StandardEvent.QueryError <<
77  " DeviceDependentError=" << StdEventReg.StandardEvent.DeviceDependentError <<
78  " ExecutionError=" << StdEventReg.StandardEvent.ExecutionError <<
79  " CommandError=" << StdEventReg.StandardEvent.CommandError <<
80  " PowerOn=" << StdEventReg.StandardEvent.PowerOn << ")";
81  return Stream;
82 }
83 std::ostream & operator<<(std::ostream & Stream, const uOPERation & OperReg)
84 {
85  Stream << "(CALibrating=" << OperReg.OPERation.CALibrating <<
86  " RANGing=" << OperReg.OPERation.RANGing <<
87  " MEASuring=" << OperReg.OPERation.MEASuring <<
88  " WaitingForTRIGger=" << OperReg.OPERation.WaitingForTRIGger << ")";
89  return Stream;
90 }
91 std::ostream & operator<<(std::ostream & Stream, const uQUEStionable & QuestReg)
92 {
93  Stream << "(Frequency=" << QuestReg.QUEStionable.Frequency <<
94  " Overrange=" << QuestReg.QUEStionable.Overrange << ")";
95  return Stream;
96 }
97 
98 //----------------------------------------------------------------------//
99 // Flux //
100 //----------------------------------------------------------------------//
101 std::ostream & operator<<(std::ostream & Stream, const CFluxList & FluxList)
102 {
103  Stream << "( ";
104  for (auto l_Flux : FluxList)
105  Stream << l_Flux << " ";
106  Stream << ")";
107  return Stream;
108 }
109 
110 //----------------------------------------------------------------------//
111 // Units //
112 //----------------------------------------------------------------------//
113 std::ostream & operator<<(std::ostream & Stream, const eUnits & Units)
114 {
115  Stream << ((Units == kT) ? "T" :
116  (Units == kmT) ? "mT" :
117  (Units == kuT) ? "uT" :
118  (Units == knT) ? "nT" :
119  (Units == kGauss) ? "Gauss" :
120  (Units == kkGauss)? "kGauss" :
121  (Units == kmGauss)? "mGauss" :
122  (Units == kMHzp) ? "MHzp" : "?");
123  return Stream;
124 }
125 std::ostream & operator<<(std::ostream & Stream, const CUnitsList & UnitsList)
126 {
127  Stream << "( ";
128  for (auto l_Units : UnitsList)
129  Stream << l_Units << " ";
130  Stream << ")";
131  return Stream;
132 }
133 std::ostream & operator<<(std::ostream & Stream, const CDivisorList & DivisorList)
134 {
135  Stream << "( ";
136  for (auto l_Divisor : DivisorList)
137  Stream << l_Divisor << " ";
138  Stream << ")";
139  return Stream;
140 }
141 
142 //----------------------------------------------------------------------//
143 // Errors //
144 //----------------------------------------------------------------------//
145 bool sError::operator==(sError other) const
146 {
147  return (
148  Code == other.Code &&
149  Description == other.Description &&
150  Context == other.Context
151  );
152 }
153 bool sError::operator!=(sError other) const
154 {
155  return (!operator==(other));
156 }
157 std::ostream & operator<<(std::ostream & Stream, const sError & Error)
158 {
159  Stream << "err(code=" << Error.Code <<
160  " desc=" << Error.Description <<
161  " ctxt=" << Error.Context << ")";
162  return Stream;
163 }
164 std::ostream & operator<<(std::ostream & Stream, const CErrorList & ErrorList)
165 {
166  for (auto l_Error : ErrorList)
167  Stream << l_Error << std::endl;
168  return Stream;
169 }
170 
171 //----------------------------------------------------------------------//
172 // Version //
173 //----------------------------------------------------------------------//
174 void sVersion::clear(void)
175 {
176  Major = 0;
177  Minor = 0;
178 }
180 {
181  return (
182  Major == other.Major &&
183  Minor == other.Minor);
184 }
186 {
187  return (!operator==(other));
188 }
189 std::ostream & operator<<(std::ostream & Stream, const sVersion & Version)
190 {
191  Stream << Version.Major << "." << Version.Minor;
192  return Stream;
193 }
194 
195 //----------------------------------------------------------------------//
196 // Identifier //
197 //----------------------------------------------------------------------//
199 {
200  Manufacturer.clear();
201  Model.clear();
202  SerialNumber = 0;
203  ElectronicsVersion.clear();
204  ProbeVersion.clear();
205  FirmwareVersion.clear();
206 }
208 {
209  return (
210  Manufacturer == other.Manufacturer &&
211  Model == other.Model &&
212  SerialNumber == other.SerialNumber &&
213  ElectronicsVersion == other.ElectronicsVersion &&
214  ProbeVersion == other.ProbeVersion &&
215  FirmwareVersion == other.FirmwareVersion
216  );
217 }
219 {
220  return (!operator==(other));
221 }
222 std::ostream & operator<<(std::ostream & Stream, const sIdentifier & ID)
223 {
224  Stream << "id(mfr=" << ID.Manufacturer <<
225  " mdl=" << ID.Model <<
226  " sn=" << ID.SerialNumber <<
227  " elv=" << ID.ElectronicsVersion <<
228  " prv=" << ID.ProbeVersion <<
229  " fwv=" << ID.FirmwareVersion << ")";
230  return Stream;
231 }
232 
233 //----------------------------------------------------------------------//
234 // Parameters //
235 //----------------------------------------------------------------------//
236 std::ostream & operator<<(std::ostream & Stream, const sAveraging<uParm> & AvgParm)
237 {
238  Stream << AvgParm.NoPoints;
239  return Stream;
240 }
241 std::ostream & operator<<(std::ostream & Stream, const sAveraging<sBoundedParm> & AvgParm)
242 {
243  Stream << "avg(val=" << AvgParm.NoPoints.Val <<
244  " min=" << AvgParm.NoPoints.Min <<
245  " max=" << AvgParm.NoPoints.Max <<
246  " def=" << AvgParm.NoPoints.Def << ")";
247  return Stream;
248 }
249 
250 std::ostream & operator<<(std::ostream & Stream, const eInputTriggerSource & TrgSrc)
251 {
252  Stream << ((TrgSrc == kInputTrigSrcImmediate) ? "imm" :
253  (TrgSrc == kInputTrigSrcTimer) ? "tim" :
254  (TrgSrc == kInputTrigSrcBus) ? "bus" : "?");
255  return Stream;
256 }
257 std::ostream & operator<<(std::ostream & Stream, const sInputTrigger<uParm> & TrigParm)
258 {
259  Stream << "trg(src=" << TrigParm.Source <<
260  " per=" << TrigParm.Period_s <<
261  " cnt=" << TrigParm.Count << ")";
262  return Stream;
263 }
264 std::ostream & operator<<(std::ostream & Stream, const sInputTrigger<sBoundedParm> & TrigParm)
265 {
266  Stream << "trg(src=" << TrigParm.Source <<
267  " per(val=" << TrigParm.Period_s.Val <<
268  " min=" << TrigParm.Period_s.Min <<
269  " max=" << TrigParm.Period_s.Max <<
270  " def=" << TrigParm.Period_s.Def << ")" <<
271  " cnt(val=" << TrigParm.Count.Val <<
272  " min=" << TrigParm.Count.Min <<
273  " max=" << TrigParm.Count.Max <<
274  " def=" << TrigParm.Count.Def << "))";
275  return Stream;
276 }
277 
278 std::ostream & operator<<(std::ostream & Stream, const eCommunicationFormat & CommFormat)
279 {
280  Stream << ((CommFormat == kComFormatAscii) ? "ascii" :
281  (CommFormat == kComFormatInteger) ? "int" :
282  (CommFormat == kComFormatPacked2Byte) ? "pack2" :
283  (CommFormat == kComFormatPacked1Byte) ? "pack1" : "?");
284  return Stream;
285 }
286 
287 std::ostream & operator<<(std::ostream & Stream, const sRange<uParm> & RangeParm)
288 {
289  Stream << "range(auto=" << RangeParm.Auto <<
290  " rng=" << RangeParm.Range << ")";
291  return Stream;
292 }
293 std::ostream & operator<<(std::ostream & Stream, const sRange<sBoundedParm> & RangeParm)
294 {
295  Stream << "range(auto=" << RangeParm.Auto <<
296  " rng(val=" << RangeParm.Range.Val <<
297  " min=" << RangeParm.Range.Min <<
298  " max=" << RangeParm.Range.Max <<
299  " def=" << RangeParm.Range.Def << "))";
300  return Stream;
301 }
302 
303 //----------------------------------------------------------------------//
304 // Files //
305 //----------------------------------------------------------------------//
307 {
308  Path.clear();
309  Type.clear();
310  Size = 0;
311 }
312 bool sFile::operator==(sFile other) const
313 {
314  return (
315  Path == other.Path &&
316  Type == other.Type &&
317  Size == other.Size
318  );
319 }
320 bool sFile::operator!=(sFile other) const
321 {
322  return (!operator==(other));
323 }
324 std::ostream & operator<<(std::ostream & Stream, const sFile & FileInfo)
325 {
326  Stream << "file(siz=" << FileInfo.Size <<
327  " path=" << FileInfo.Path <<
328  " type=" << FileInfo.Type << ")";
329  return Stream;
330 }
331 std::ostream & operator<<(std::ostream & Stream, const tFileList & FileList)
332 {
333  for (auto l_FileInfo : FileList)
334  Stream << l_FileInfo << std::endl;
335  return Stream;
336 }
337 
338 //----------------------------------------------------------------------//
339 // Time stamp //
340 //----------------------------------------------------------------------//
341 CAbsoluteTimestamp::CAbsoluteTimestamp(std::time_t Seconds, U64 Nanoseconds) :
342  s(Seconds), ns(Nanoseconds)
343 {
344  s += ns / NS_PER_SEC;
345  ns = ns % NS_PER_SEC;
346 }
348 {
349  s = Value.s;
350  ns = Value.ns;
351  return *this;
352 }
354 {
355  return (s == other.s && ns == other.ns);
356 }
358 {
359  return (!operator==(other));
360 }
361 std::time_t CAbsoluteTimestamp::seconds(void) const
362 {
363  return s;
364 }
366 {
367  return ns;
368 }
370 {
371  s = 0;
372  ns = 0;
373 }
374 
375 //----------------------------------------------------------------------//
376 // Timestamp addition / subtraction / insertion //
377 //----------------------------------------------------------------------//
379 {
380  std::time_t s;
381  U64 ns;
382 
383  s = a.seconds() + b.seconds();
384  ns = a.nanoseconds() + b.nanoseconds();
385 
386  return CAbsoluteTimestamp(s, ns);
387 }
388 
390 {
391  std::time_t s;
392  U64 ns;
393 
394  if (a.nanoseconds() > b.nanoseconds())
395  {
396  ns = a.nanoseconds() - b.nanoseconds();
397  s = (a.seconds() > b.seconds()) ? (a.seconds() - b.seconds()) : 0;
398  }
399  else
400  {
402  s = (a.seconds() > (b.seconds() + 1)) ? (a.seconds() - (b.seconds() + 1)) : 0;
403  }
404 
405  return CAbsoluteTimestamp(s, ns);
406 }
407 
408 std::ostream & operator<<(std::ostream & Stream, const CAbsoluteTimestamp & Timestamp)
409 {
410  std::time_t l_Seconds = Timestamp.seconds();
411  U64 l_NanoSeconds = Timestamp.nanoseconds();
412  char l_DateTimeString[32];
413  std::strftime(l_DateTimeString, 31, "%FT%T", std::localtime(&l_Seconds));
414  Stream << std::string(l_DateTimeString) << "."
415  << std::setfill('0') << std::setw(9)
416  << l_NanoSeconds
417  << std::setfill(' ') << std::setw(0);
418  return Stream;
419 }
420 
421 //----------------------------------------------------------------------//
422 // Time stamp list //
423 //----------------------------------------------------------------------//
425 {
426  // Make sure we have enough timestamps.
427  if (this->size() < 2)
428  {
429  Period = 0.;
430  return false;
431  }
432 
433  // Set up the linear system:
434  // Given n observations (0, T0), (1, T1), ... (n-1, Tn-1):
435  //
436  // [ 1 0 ] [ T0 ]
437  // Xnx2 = [ 1 1 ], b2x1 = [ b0 ], Ynx1 = [ T1 ],
438  // [ ... ] [ b1 ] [ ... ]
439  // [ 1 n-1 ] [ Tn-1 ]
440  //
441  // we will solve the overconstrained problem:
442  // Xnx2 b2x1 = Ynx1
443  // The period is the coefficient b1.
444  //
445  MatrixXd l_X;
446  Vector2d l_b;
447  VectorXd l_Y;
448 
449  size_t l_n = this->size();
450  l_X.resize(l_n, 2);
451  l_Y.resize(l_n);
452 
453  // Initialize X and Y.
454  U64 l_T0 = this->at(0);
455  for (U32 l_i = 0; l_i < l_n; l_i++)
456  {
457  l_X(l_i, 0) = 1.;
458  l_X(l_i, 1) = l_i;
459  l_Y(l_i) = static_cast<F64> (this->at(l_i) - l_T0);
460  }
461 
462  // Solve the the linear least-squares system using the SVD decomposition.
463  // See https://eigen.tuxfamily.org/dox/group__LeastSquares.html.
464  l_b = l_X.jacobiSvd(ComputeThinU | ComputeThinV).solve(l_Y);
465 
466  // Return the result.
467  Period = l_b(1);
468  return true;
469 }
470 
471 std::ostream & operator<<(std::ostream & Stream, const CTimestampList & TimestampList)
472 {
473  Stream << "( ";
474  for (auto l_TimeStamp : TimestampList)
475  Stream << l_TimeStamp << " ";
476  Stream << ")";
477  return Stream;
478 }
479 
480 //----------------------------------------------------------------------//
481 // Measurements //
482 //----------------------------------------------------------------------//
484 {
485  Bx = By = Bz = Temperature = Timestamp = true;
486  NoMeasurements = 1;
487 }
489 {
490  return (
491  Bx == other.Bx &&
492  By == other.By &&
493  Bz == other.Bz &&
494  Temperature == other.Temperature &&
495  Timestamp == other.Timestamp &&
497  );
498 }
500 {
501  return (!operator==(other));
502 }
503 
505 {
508  UseCalibration = true;
509 }
511 {
512  return (
513  AveragingParms == other.AveragingParms &&
514  TriggerParms == other.TriggerParms &&
516  );
517 }
519 {
520  return (!operator==(other));
521 }
522 std::ostream & operator<<(std::ostream & Stream, const sArbitraryMeasurements & MeasSpec)
523 {
524  Stream << "arb(Bx=" << MeasSpec.Bx <<
525  " By=" << MeasSpec.By <<
526  " Bz=" << MeasSpec.Bz <<
527  " temp=" << MeasSpec.Temperature <<
528  " time=" << MeasSpec.Timestamp <<
529  " count=" << MeasSpec.NoMeasurements << ")";
530  return Stream;
531 }
532 std::ostream & operator<<(std::ostream & Stream, const sMeasurementConditions & MeasCond)
533 {
534  Stream << "meas_cond(avg=" << MeasCond.AveragingParms <<
535  " trig=" << MeasCond.TriggerParms <<
536  " cal=" << MeasCond.UseCalibration << ")";
537  return Stream;
538 }
539 
540 } // namespace THM1176Types
541 } // namespace Instrument
542 } // namespace MTL
MTL::Instrument::THM1176Types::uStandardEvent::sStandardEvent::PowerOn
U8 PowerOn
THM1176 has been powered up.
Definition: THM1176Types.h:115
MTL::Instrument::THM1176Types::sMeasurementConditions::UseCalibration
bool UseCalibration
Use calibration data.
Definition: THM1176Types.h:601
MTL::Instrument::THM1176Types::kInputTrigSrcBus
@ kInputTrigSrcBus
Bus trigger: start measurement upon USB trigger message.
Definition: THM1176Types.h:399
MTL::Instrument::THM1176Types::uStatusByte
Union to access the Status Byte as integer or bit fields.
Definition: THM1176Types.h:81
MTL::Instrument::THM1176Types::sFile::Type
std::string Type
File type ("ASCII" or "BINARY").
Definition: THM1176Types.h:496
MTL::Instrument::THM1176Types::sStatusRegister::Type
eStatusRegisterType Type
SCPI register type.
Definition: THM1176Types.h:54
MTL::Instrument::THM1176Types::RegisterList
List of SCPI status registers.
Definition: THM1176Types.h:66
MTL::Instrument::THM1176Types::uStandardEvent::sStandardEvent::QueryError
U8 QueryError
Error in preceding query.
Definition: THM1176Types.h:110
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::Instrument::THM1176Types::kStatusOperationStatusRegister
@ kStatusOperationStatusRegister
Operation Status Register.
Definition: THM1176Types.h:41
MTL::Instrument::THM1176Types::kuT
@ kuT
Micro-Tesla.
Definition: THM1176Types.h:185
MTL::Instrument::THM1176Types::eStatusRegisterSet
eStatusRegisterSet
Enumeration of SCPI status register sets.
Definition: THM1176Types.h:37
MTL::Instrument::THM1176Types::eUnits
eUnits
Enumeration of possible measurement units.
Definition: THM1176Types.h:182
MTL::Instrument::THM1176Types::kStatusCondition
@ kStatusCondition
Condition register.
Definition: THM1176Types.h:47
MTL::Instrument::THM1176Types::sMeasurementConditions::clear
void clear()
Clear to default values.
Definition: THM1176Types.cpp:504
MTL::Instrument::THM1176Types::sMeasurementConditions::AveragingParms
sAveraging< uParm > AveragingParms
Averaging parameters.
Definition: THM1176Types.h:599
MTL::Instrument::THM1176Types::kStatusEnable
@ kStatusEnable
Enable register.
Definition: THM1176Types.h:48
MTL::Instrument::THM1176Types::sFile::operator!=
bool operator!=(sFile other) const
Inequality operator.
Definition: THM1176Types.cpp:320
MTL::Instrument::THM1176Types::uStandardEvent::StandardEvent
struct MTL::Instrument::THM1176Types::uStandardEvent::sStandardEvent StandardEvent
Access the Standard Event Status Register as bit fields.
U64
unsigned long long U64
64-bit unsigned integer.
Definition: OSDefines.h:33
MTL::Instrument::THM1176Types::sArbitraryMeasurements::operator!=
bool operator!=(sArbitraryMeasurements other) const
Inequality operator.
Definition: THM1176Types.cpp:499
MTL::Instrument::THM1176Types::uStatusByte::sStatusByte::OSB
U8 OSB
OPERation status summary bit.
Definition: THM1176Types.h:95
MTL::Instrument::THM1176Types::eStatusRegisterType
eStatusRegisterType
Enumeration of SCPI status register types.
Definition: THM1176Types.h:45
MTL::Instrument::THM1176Types::sVersion::operator!=
bool operator!=(sVersion other) const
Inequality operator.
Definition: THM1176Types.cpp:185
MTL::Instrument::THM1176Types::uStatusByte::StatusByte
struct MTL::Instrument::THM1176Types::uStatusByte::sStatusByte StatusByte
Access the Status Byte as bit fields.
MTL::Instrument::THM1176Types::sArbitraryMeasurements
Specify the measurement data to be returned.
Definition: THM1176Types.h:572
MTL::Instrument::THM1176Types::kGauss
@ kGauss
Gauss.
Definition: THM1176Types.h:187
MTL::Instrument::THM1176Types::CTimestampList::GetEstimatedPeriod
bool GetEstimatedPeriod(F64 &Period)
Estimate the measurement period from this timestamp list, by means of a least-squares fit.
Definition: THM1176Types.cpp:424
MTL::Instrument::THM1176Types::sMeasurementConditions
Summary of the parameters used to make a measurement.
Definition: THM1176Types.h:598
MTL::Instrument::THM1176Types::sBoundedParm::Min
DataType Min
Lower bound.
Definition: THM1176Types.h:248
MTL::Instrument::THM1176Types::sAveraging::clear
void clear(void)
Clear to default (zero).
Definition: THM1176Types.h:376
MTL::Instrument::THM1176Types::uStandardEvent::sStandardEvent::ExecutionError
U8 ExecutionError
Error detected during command execution.
Definition: THM1176Types.h:112
MTL::Instrument::THM1176Types::sVersion::clear
void clear(void)
Clear to default (zeroes).
Definition: THM1176Types.cpp:174
MTL::Instrument::THM1176Types::sError::Description
std::string Description
Error description.
Definition: THM1176Types.h:216
MTL::Instrument::THM1176Types::uQUEStionable::sQUEStionable::Frequency
U16 Frequency
Acquisition buffer or the timed trigger has been overrun.
Definition: THM1176Types.h:148
MTL::Instrument::THM1176Types::sRange< uParm >
MTL::Instrument::THM1176Types::uStatusByte::sStatusByte::ESB
U8 ESB
Standard Event Status Register summary bit.
Definition: THM1176Types.h:93
MTL::Instrument::THM1176Types::sFile::Path
std::string Path
File path.
Definition: THM1176Types.h:495
MTL::Instrument::THM1176Types::sBoundedParm::Max
DataType Max
Upper bound.
Definition: THM1176Types.h:249
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::Instrument::THM1176Types::sArbitraryMeasurements::NoMeasurements
U32 NoMeasurements
Return this number of measurements.
Definition: THM1176Types.h:578
MTL::Instrument::THM1176Types::uStandardEvent::sStandardEvent::CommandError
U8 CommandError
Error in preceding command.
Definition: THM1176Types.h:113
MTL::Instrument::THM1176Types::CDivisorList
List of divisors, one per measurement unit.
Definition: THM1176Types.h:203
MTL::Instrument::THM1176Types::sIdentifier::FirmwareVersion
struct sVersion FirmwareVersion
Version numbers of firmware.
Definition: THM1176Types.h:342
MTL::Instrument::THM1176Types::sFile::clear
void clear()
Clear to default values.
Definition: THM1176Types.cpp:306
MTL::Instrument::THM1176Types::sStatusRegister::Set
eStatusRegisterSet Set
SCPI register set.
Definition: THM1176Types.h:53
MTL::Instrument::THM1176Types::knT
@ knT
Nano-Tesla.
Definition: THM1176Types.h:186
MTL::Instrument::THM1176Types::operator-
CAbsoluteTimestamp operator-(CAbsoluteTimestamp a, CAbsoluteTimestamp b)
Timestamp subtraction operator.
Definition: THM1176Types.cpp:389
MTL::Instrument::THM1176Types::sError::operator!=
bool operator!=(sError other) const
Inequality operator.
Definition: THM1176Types.cpp:153
MTL::Instrument::THM1176Types::sIdentifier
Instrument's identification string - parsed version.
Definition: THM1176Types.h:336
MTL::Instrument::THM1176Types::uOPERation::sOPERation::WaitingForTRIGger
U16 WaitingForTRIGger
Waiting for trigger.
Definition: THM1176Types.h:133
MTL::Instrument::THM1176Types::operator+
CAbsoluteTimestamp operator+(CAbsoluteTimestamp a, CAbsoluteTimestamp b)
Timestamp addition operator.
Definition: THM1176Types.cpp:378
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::Instrument::THM1176Types::uQUEStionable::sQUEStionable::Overrange
U16 Overrange
Measurement was over-range.
Definition: THM1176Types.h:150
MTL::Instrument::THM1176Types::sVersion::Minor
U8 Minor
Minor version number.
Definition: THM1176Types.h:316
MTL
Definition: CTHM1176InstrumentManager.h:179
MTL::Instrument::THM1176Types::sInputTrigger::Count
ParmType< U16 > Count
Trigger count: take this many measurements before sending results.
Definition: THM1176Types.h:408
MTL::Instrument
Definition: THM1176.h:75
MTL::Instrument::THM1176Types::operator<<
std::ostream & operator<<(std::ostream &Stream, const eStatusRegisterSet &RegSet)
Status register set stream output.
Definition: THM1176Types.cpp:27
MTL::Instrument::THM1176Types
Definition: THM1176TypeConversions.h:20
MTL::Instrument::THM1176Types::kStatusQuestionableStatusRegister
@ kStatusQuestionableStatusRegister
Questionable Status Register.
Definition: THM1176Types.h:40
MTL::Instrument::THM1176Types::uStatusByte::sStatusByte::MAV
U8 MAV
Message Available.
Definition: THM1176Types.h:92
MTL::Instrument::THM1176Types::sBoundedParm::Val
DataType Val
Current value.
Definition: THM1176Types.h:247
MTL::Instrument::THM1176Types::kStandardEventStatusRegister
@ kStandardEventStatusRegister
Standard Event Status Register.
Definition: THM1176Types.h:39
MTL::Instrument::THM1176Types::sArbitraryMeasurements::Bz
bool Bz
Return the flux density Z-component.
Definition: THM1176Types.h:575
MTL::Instrument::THM1176Types::eInputTriggerSource
eInputTriggerSource
Enumeration of possible trigger sources.
Definition: THM1176Types.h:396
MTL::Instrument::THM1176Types::kmGauss
@ kmGauss
Milli-Gauss.
Definition: THM1176Types.h:189
MTL::Instrument::THM1176Types::kkGauss
@ kkGauss
Kilo-Gauss.
Definition: THM1176Types.h:188
MTL::Instrument::THM1176Types::sAveraging< uParm >
MTL::Instrument::THM1176Types::sVersion::operator==
bool operator==(sVersion other) const
Equality operator.
Definition: THM1176Types.cpp:179
MTL::Instrument::THM1176Types::kmT
@ kmT
Milli-Tesla.
Definition: THM1176Types.h:184
MTL::Instrument::THM1176Types::sIdentifier::operator==
bool operator==(sIdentifier other) const
Equality oeprator.
Definition: THM1176Types.cpp:207
MTL::Instrument::THM1176Types::kInputTrigSrcImmediate
@ kInputTrigSrcImmediate
Immediate trigger: start measurement immediately after previous one completes.
Definition: THM1176Types.h:397
MTL::Instrument::THM1176Types::uStatusByte::sStatusByte::RQS
U8 RQS
ReQuest for Service.
Definition: THM1176Types.h:94
MTL::Instrument::THM1176Types::sMeasurementConditions::operator!=
bool operator!=(sMeasurementConditions other) const
Inequality operator.
Definition: THM1176Types.cpp:518
MTL::Instrument::THM1176Types::kStatusByte
@ kStatusByte
Status Byte.
Definition: THM1176Types.h:38
MTL::Instrument::THM1176Types::CAbsoluteTimestamp::operator!=
bool operator!=(CAbsoluteTimestamp other)
Inequality operator.
Definition: THM1176Types.cpp:357
MTL::Instrument::THM1176Types::CAbsoluteTimestamp::nanoseconds
U64 nanoseconds(void) const
Fetch the number of nanoseconds.
Definition: THM1176Types.cpp:365
MTL::Instrument::THM1176Types::kStatusEvent
@ kStatusEvent
Event register.
Definition: THM1176Types.h:46
MTL::Instrument::THM1176Types::uStatusByte::sStatusByte::EAV
U8 EAV
Error Available in Error / Event Queue.
Definition: THM1176Types.h:90
MTL::Instrument::THM1176Types::sIdentifier::Manufacturer
std::string Manufacturer
Manufacturer name ("Metrolab Technology SA")
Definition: THM1176Types.h:337
MTL::Instrument::THM1176Types::tFileList
std::vector< sFile > tFileList
List of directory entries.
Definition: THM1176Types.h:511
MTL::Instrument::THM1176Types::sMeasurementConditions::operator==
bool operator==(sMeasurementConditions other) const
Equality operator.
Definition: THM1176Types.cpp:510
MTL::Instrument::THM1176Types::sArbitraryMeasurements::Timestamp
bool Timestamp
Return the timestamp.
Definition: THM1176Types.h:577
MTL::Instrument::THM1176Types::CAbsoluteTimestamp
Timestamp for a measurement.
Definition: THM1176Types.h:530
MTL::Instrument::THM1176Types::CTimestampList
List of timestamps.
Definition: THM1176Types.h:555
MTL::Instrument::THM1176Types::uQUEStionable
Union to access the Questionable Status Register as integer or bit fields.
Definition: THM1176Types.h:139
MTL::Instrument::THM1176Types::sIdentifier::Model
std::string Model
Model name (e.g. "THM1176-MF")
Definition: THM1176Types.h:338
MTL::Instrument::THM1176Types::StatusValues
List of values returned for several SCPI status registers.
Definition: THM1176Types.h:76
MTL::Instrument::THM1176Types::sError::Context
std::string Context
SCPI commands being executed at time of error.
Definition: THM1176Types.h:217
MTL::Instrument::THM1176Types::sInputTrigger::clear
void clear(void)
Clear to default.
Definition: THM1176Types.h:418
MTL::Instrument::THM1176Types::CAbsoluteTimestamp::NS_PER_SEC
static const U64 NS_PER_SEC
Definition: THM1176Types.h:536
MTL::Instrument::THM1176Types::uOPERation::sOPERation::RANGing
U16 RANGing
Changing range.
Definition: THM1176Types.h:130
MTL::Instrument::THM1176Types::CAbsoluteTimestamp::CAbsoluteTimestamp
CAbsoluteTimestamp(std::time_t Seconds=0, U64 Nanoseconds=0)
Constructor.
Definition: THM1176Types.cpp:341
MTL::Instrument::THM1176Types::kMHzp
@ kMHzp
Equivalent proton NMR resonant frequency, in Mega-Hertz.
Definition: THM1176Types.h:190
MTL::Instrument::THM1176Types::uQUEStionable::QUEStionable
struct MTL::Instrument::THM1176Types::uQUEStionable::sQUEStionable QUEStionable
Access the Questionable Status Register as bit fields.
MTL::Instrument::THM1176Types::sVersion::Major
U8 Major
Major version number.
Definition: THM1176Types.h:315
MTL::Instrument::THM1176Types::uOPERation
Union to access the Operation Status Register as integer or bit fields.
Definition: THM1176Types.h:120
MTL::Instrument::THM1176Types::uStandardEvent::sStandardEvent::DeviceDependentError
U8 DeviceDependentError
Errors specific to the THM1176, including internal errors.
Definition: THM1176Types.h:111
MTL::Instrument::THM1176Types::kT
@ kT
Tesla.
Definition: THM1176Types.h:183
MTL::Instrument::THM1176Types::sInputTrigger< uParm >
MTL::Instrument::THM1176Types::sStatusRegister
Complete identification of a SCPI status register.
Definition: THM1176Types.h:52
MTL::Instrument::THM1176Types::CUnitsList
List of measurement units.
Definition: THM1176Types.h:194
MTL::Instrument::THM1176Types::uOPERation::sOPERation::CALibrating
U16 CALibrating
Measuring zero-offset.
Definition: THM1176Types.h:128
MTL::Instrument::THM1176Types::sMeasurementConditions::TriggerParms
sInputTrigger< uParm > TriggerParms
Trigger parameters.
Definition: THM1176Types.h:600
MTL::Instrument::THM1176Types::uStandardEvent::sStandardEvent::OperationComplete
U8 OperationComplete
*OPC has flagged operation complete
Definition: THM1176Types.h:108
MTL::Instrument::THM1176Types::kComFormatInteger
@ kComFormatInteger
Binary (32-bit integers)
Definition: THM1176Types.h:447
MTL::Instrument::THM1176Types::CFluxList
List of flux density values.
Definition: THM1176Types.h:170
MTL::Instrument::THM1176Types::sError::operator==
bool operator==(sError other) const
Equality operator.
Definition: THM1176Types.cpp:145
MTL::Instrument::THM1176Types::sError
Error returned by the instrument.
Definition: THM1176Types.h:214
MTL::Instrument::THM1176Types::sFile::operator==
bool operator==(sFile other) const
Equality operator.
Definition: THM1176Types.cpp:312
MTL::Instrument::THM1176Types::sArbitraryMeasurements::Temperature
bool Temperature
Return the sensor temperature.
Definition: THM1176Types.h:576
MTL::Instrument::THM1176Types::uOPERation::sOPERation::MEASuring
U16 MEASuring
Measuring magnetic field strength.
Definition: THM1176Types.h:132
MTL::Instrument::THM1176Types::uOPERation::OPERation
struct MTL::Instrument::THM1176Types::uOPERation::sOPERation OPERation
Access the Operation Status Register as bit fields.
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
THM1176.h
Interface definition for C++ API for Metrolab THM1176/TFM1186.
MTL::Instrument::THM1176Types::sIdentifier::ElectronicsVersion
struct sVersion ElectronicsVersion
Version numbers of electronics.
Definition: THM1176Types.h:340
MTL::Instrument::THM1176Types::CAbsoluteTimestamp::operator==
bool operator==(CAbsoluteTimestamp other)
Equality operator.
Definition: THM1176Types.cpp:353
MTL::Instrument::THM1176Types::sArbitraryMeasurements::Bx
bool Bx
Return the flux density X-component.
Definition: THM1176Types.h:573
F64
double F64
64-bit floating-point number.
Definition: OSDefines.h:35
MTL::Instrument::THM1176Types::sFile::Size
size_t Size
File size, in bytes.
Definition: THM1176Types.h:494
MTL::Instrument::THM1176Types::sFile
Directory entry in the instrument's file system.
Definition: THM1176Types.h:493
U32
unsigned int U32
32-bit unsigned integer.
Definition: OSDefines.h:32
MTL::Instrument::THM1176Types::sBoundedParm::Def
DataType Def
Default value.
Definition: THM1176Types.h:250
MTL::Instrument::THM1176Types::sAveraging::NoPoints
ParmType< U16 > NoPoints
Number of points in block average.
Definition: THM1176Types.h:368
MTL::Instrument::THM1176Types::sIdentifier::clear
void clear(void)
Clear to default.
Definition: THM1176Types.cpp:198
MTL::Instrument::THM1176Types::uStatusByte::sStatusByte::QSB
U8 QSB
QUEStionable status summary bit.
Definition: THM1176Types.h:91
MTL::Instrument::THM1176Types::sError::Code
I32 Code
Error code.
Definition: THM1176Types.h:215
MTL::Instrument::THM1176Types::sVersion
Major and minor version numbers.
Definition: THM1176Types.h:314
MTL::Instrument::THM1176Types::CAbsoluteTimestamp::seconds
std::time_t seconds(void) const
Fetch the number of seconds.
Definition: THM1176Types.cpp:361
MTL::Instrument::THM1176Types::CAbsoluteTimestamp::operator=
CAbsoluteTimestamp & operator=(const CAbsoluteTimestamp &Value)
Assignment operator.
Definition: THM1176Types.cpp:347
MTL::Instrument::THM1176Types::CAbsoluteTimestamp::clear
void clear(void)
Clear to default values (zeroes)
Definition: THM1176Types.cpp:369
MTL::Instrument::THM1176Types::sArbitraryMeasurements::operator==
bool operator==(sArbitraryMeasurements other) const
Equality operator.
Definition: THM1176Types.cpp:488
MTL::Instrument::THM1176Types::kComFormatPacked2Byte
@ kComFormatPacked2Byte
Binary packed: first field value as I32, remainder deltas as I16.
Definition: THM1176Types.h:448
MTL::Instrument::THM1176Types::sIdentifier::ProbeVersion
struct sVersion ProbeVersion
Version numbers of probe.
Definition: THM1176Types.h:341
MTL::Instrument::THM1176Types::sArbitraryMeasurements::By
bool By
Return the flux density Y-component.
Definition: THM1176Types.h:574
MTL::Instrument::THM1176Types::uStandardEvent
Union to access the Standard Event Status Register as integer or bit fields.
Definition: THM1176Types.h:100
MTL::Instrument::THM1176Types::sIdentifier::operator!=
bool operator!=(sIdentifier other) const
Inequality operator.
Definition: THM1176Types.cpp:218
MTL::Instrument::THM1176Types::sIdentifier::SerialNumber
U32 SerialNumber
Serial number.
Definition: THM1176Types.h:339
MTL::Instrument::THM1176Types::kComFormatPacked1Byte
@ kComFormatPacked1Byte
Binary packed: first field value as I32, remainder deltas as I8.
Definition: THM1176Types.h:449
MTL::Instrument::THM1176Types::kInputTrigSrcTimer
@ kInputTrigSrcTimer
Timed trigger: start measurement at regular intervals.
Definition: THM1176Types.h:398