| THM1176InstrumentDriver 1.2 C++ API for Metrolab THM1176

Loading...
Searching...
No Matches
THM1176Types.cpp
Go to the documentation of this file.
1// Copyright (c) 2025 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//----------------------------------------------------------------------//
27std::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}
35std::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}
42std::ostream & operator<<(std::ostream & Stream, const sStatusRegister & RegDef)
43{
44 Stream << "regdef(" << RegDef.Set << " " << RegDef.Type << ")";
45 return Stream;
46}
47std::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}
55std::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}
63std::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}
73std::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}
83std::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}
91std::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//----------------------------------------------------------------------//
101std::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//----------------------------------------------------------------------//
113std::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}
125std::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}
133std::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}
157std::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}
164std::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}
179 bool sVersion::operator==(sVersion other) const
180{
181 return (
182 Major == other.Major &&
183 Minor == other.Minor);
184}
185 bool sVersion::operator!=(sVersion other) const
186{
187 return (!operator==(other));
188}
189std::ostream & operator<<(std::ostream & Stream, const sVersion & Version)
190{
191 Stream << Version.Major << "." << Version.Minor;
192 return Stream;
193}
194
195//----------------------------------------------------------------------//
196// Identifier //
197//----------------------------------------------------------------------//
198 void sIdentifier::clear(void)
199{
200 Manufacturer.clear();
201 Model.clear();
202 SerialNumber = 0;
203 ElectronicsVersion.clear();
204 ProbeVersion.clear();
205 FirmwareVersion.clear();
206 ModelRevision = eModelRevision::kA;
207 InstrModel= eInstrModel::kUnknown;
208}
209 bool sIdentifier::operator==(sIdentifier other) const
210{
211 return (
212 Manufacturer == other.Manufacturer &&
213 Model == other.Model &&
214 SerialNumber == other.SerialNumber &&
215 ElectronicsVersion == other.ElectronicsVersion &&
216 ProbeVersion == other.ProbeVersion &&
217 FirmwareVersion == other.FirmwareVersion
218 );
219}
220 bool sIdentifier::operator!=(sIdentifier other) const
221{
222 return (!operator==(other));
223}
224std::ostream & operator<<(std::ostream & Stream, const sIdentifier & ID)
225{
226 Stream << "id(mfr=" << ID.Manufacturer <<
227 " mdl=" << ID.Model <<
228 " sn=" << ID.SerialNumber <<
229 " elv=" << ID.ElectronicsVersion <<
230 " prv=" << ID.ProbeVersion <<
231 " fwv=" << ID.FirmwareVersion << ")";
232 return Stream;
233}
234
235//----------------------------------------------------------------------//
236// Parameters //
237//----------------------------------------------------------------------//
238std::ostream & operator<<(std::ostream & Stream, const sAveraging<uParm> & AvgParm)
239{
240 Stream << AvgParm.NoPoints;
241 return Stream;
242}
243std::ostream & operator<<(std::ostream & Stream, const sAveraging<sBoundedParm> & AvgParm)
244{
245 Stream << "avg(val=" << AvgParm.NoPoints.Val <<
246 " min=" << AvgParm.NoPoints.Min <<
247 " max=" << AvgParm.NoPoints.Max <<
248 " def=" << AvgParm.NoPoints.Def << ")";
249 return Stream;
250}
251
252std::ostream & operator<<(std::ostream & Stream, const eInputTriggerSource & TrgSrc)
253{
254 Stream << ((TrgSrc == kInputTrigSrcImmediate) ? "imm" :
255 (TrgSrc == kInputTrigSrcTimer) ? "tim" :
256 (TrgSrc == kInputTrigSrcBus) ? "bus" : "?");
257 return Stream;
258}
259std::ostream & operator<<(std::ostream & Stream, const sInputTrigger<uParm> & TrigParm)
260{
261 Stream << "trg(src=" << TrigParm.Source <<
262 " per=" << TrigParm.Period_s <<
263 " cnt=" << TrigParm.Count << ")";
264 return Stream;
265}
266std::ostream & operator<<(std::ostream & Stream, const sInputTrigger<sBoundedParm> & TrigParm)
267{
268 Stream << "trg(src=" << TrigParm.Source <<
269 " per(val=" << TrigParm.Period_s.Val <<
270 " min=" << TrigParm.Period_s.Min <<
271 " max=" << TrigParm.Period_s.Max <<
272 " def=" << TrigParm.Period_s.Def << ")" <<
273 " cnt(val=" << TrigParm.Count.Val <<
274 " min=" << TrigParm.Count.Min <<
275 " max=" << TrigParm.Count.Max <<
276 " def=" << TrigParm.Count.Def << "))";
277 return Stream;
278}
279
280std::ostream & operator<<(std::ostream & Stream, const eCommunicationFormat & CommFormat)
281{
282 Stream << ((CommFormat == kComFormatAscii) ? "ascii" :
283 (CommFormat == kComFormatInteger) ? "int" :
284 (CommFormat == kComFormatPacked2Byte) ? "pack2" :
285 (CommFormat == kComFormatPacked1Byte) ? "pack1" : "?");
286 return Stream;
287}
288
289std::ostream & operator<<(std::ostream & Stream, const sRange<uParm> & RangeParm)
290{
291 Stream << "range(auto=" << RangeParm.Auto <<
292 " rng=" << RangeParm.Range << ")";
293 return Stream;
294}
295std::ostream & operator<<(std::ostream & Stream, const sRange<sBoundedParm> & RangeParm)
296{
297 Stream << "range(auto=" << RangeParm.Auto <<
298 " rng(val=" << RangeParm.Range.Val <<
299 " min=" << RangeParm.Range.Min <<
300 " max=" << RangeParm.Range.Max <<
301 " def=" << RangeParm.Range.Def << "))";
302 return Stream;
303}
304
305//----------------------------------------------------------------------//
306// Files //
307//----------------------------------------------------------------------//
308 void sFile::clear()
309{
310 Path.clear();
311 Type.clear();
312 Size = 0;
313}
314 bool sFile::operator==(sFile other) const
315{
316 return (
317 Path == other.Path &&
318 Type == other.Type &&
319 Size == other.Size
320 );
321}
322 bool sFile::operator!=(sFile other) const
323{
324 return (!operator==(other));
325}
326std::ostream & operator<<(std::ostream & Stream, const sFile & FileInfo)
327{
328 Stream << "file(siz=" << FileInfo.Size <<
329 " path=" << FileInfo.Path <<
330 " type=" << FileInfo.Type << ")";
331 return Stream;
332}
333std::ostream & operator<<(std::ostream & Stream, const tFileList & FileList)
334{
335 for (auto l_FileInfo : FileList)
336 Stream << l_FileInfo << std::endl;
337 return Stream;
338}
339
340//----------------------------------------------------------------------//
341// Time stamp //
342//----------------------------------------------------------------------//
343 CAbsoluteTimestamp::CAbsoluteTimestamp(std::time_t Seconds, U64 Nanoseconds) :
344 s(Seconds), ns(Nanoseconds)
345{
346 s += ns / NS_PER_SEC;
347 ns = ns % NS_PER_SEC;
348}
349 CAbsoluteTimestamp & CAbsoluteTimestamp::operator= (const CAbsoluteTimestamp & Value)
350{
351 s = Value.s;
352 ns = Value.ns;
353 return *this;
354}
355 bool CAbsoluteTimestamp::operator==(CAbsoluteTimestamp other)
356{
357 return (s == other.s && ns == other.ns);
358}
359 bool CAbsoluteTimestamp::operator!=(CAbsoluteTimestamp other)
360{
361 return (!operator==(other));
362}
363std::time_t CAbsoluteTimestamp::seconds(void) const
364{
365 return s;
366}
367 U64 CAbsoluteTimestamp::nanoseconds(void) const
368{
369 return ns;
370}
371 void CAbsoluteTimestamp::clear(void)
372{
373 s = 0;
374 ns = 0;
375}
376
377//----------------------------------------------------------------------//
378// Timestamp addition / subtraction / insertion //
379//----------------------------------------------------------------------//
380 CAbsoluteTimestamp operator+ (CAbsoluteTimestamp a, CAbsoluteTimestamp b)
381{
382 std::time_t s;
383 U64 ns;
384
385 s = a.seconds() + b.seconds();
386 ns = a.nanoseconds() + b.nanoseconds();
387 //Manage ns overlap to sec:
388 s += ns / CAbsoluteTimestamp::NS_PER_SEC;
389 ns = ns % CAbsoluteTimestamp::NS_PER_SEC;
390
391 return CAbsoluteTimestamp(s, ns);
392}
393
394 CAbsoluteTimestamp operator- (CAbsoluteTimestamp a, CAbsoluteTimestamp b)
395{
396 std::time_t s;
397 U64 ns;
398
399 if (a.nanoseconds() > b.nanoseconds())
400 {
401 ns = a.nanoseconds() - b.nanoseconds();
402 s = (a.seconds() > b.seconds()) ? (a.seconds() - b.seconds()) : 0;
403 }
404 else
405 {
406 ns = a.nanoseconds() + (CAbsoluteTimestamp::NS_PER_SEC - b.nanoseconds());
407 s = (a.seconds() > (b.seconds() + 1)) ? (a.seconds() - (b.seconds() + 1)) : 0;
408 }
409
410 return CAbsoluteTimestamp(s, ns);
411}
412
413std::ostream & operator<<(std::ostream & Stream, const CAbsoluteTimestamp & Timestamp)
414{
415 std::time_t l_Seconds = Timestamp.seconds();
416 U64 l_NanoSeconds = Timestamp.nanoseconds();
417 char l_DateTimeString[32];
418 std::strftime(l_DateTimeString, 31, "%FT%T", std::localtime(&l_Seconds));
419 Stream << std::string(l_DateTimeString) << "."
420 << std::setfill('0') << std::setw(9)
421 << l_NanoSeconds
422 << std::setfill(' ') << std::setw(0);
423 return Stream;
424}
425
426//----------------------------------------------------------------------//
427// Time stamp list //
428//----------------------------------------------------------------------//
429 bool CTimestampList::GetEstimatedPeriod(F64 & Period)
430{
431 // Make sure we have enough timestamps.
432 if (this->size() < 2)
433 {
434 Period = 0.;
435 return false;
436 }
437
438 // Set up the linear system:
439 // Given n observations (0, T0), (1, T1), ... (n-1, Tn-1):
440 //
441 // [ 1 0 ] [ T0 ]
442 // Xnx2 = [ 1 1 ], b2x1 = [ b0 ], Ynx1 = [ T1 ],
443 // [ ... ] [ b1 ] [ ... ]
444 // [ 1 n-1 ] [ Tn-1 ]
445 //
446 // we will solve the overconstrained problem:
447 // Xnx2 b2x1 = Ynx1
448 // The period is the coefficient b1.
449 //
450 MatrixXd l_X;
451 Vector2d l_b;
452 VectorXd l_Y;
453
454 size_t l_n = this->size();
455 l_X.resize(l_n, 2);
456 l_Y.resize(l_n);
457
458 // Initialize X and Y.
459 U64 l_T0 = this->at(0);
460 for (U32 l_i = 0; l_i < l_n; l_i++)
461 {
462 l_X(l_i, 0) = 1.;
463 l_X(l_i, 1) = l_i;
464 l_Y(l_i) = static_cast<F64> (this->at(l_i) - l_T0);
465 }
466
467 // Solve the the linear least-squares system using the SVD decomposition.
468 // See https://eigen.tuxfamily.org/dox/group__LeastSquares.html.
469 l_b = l_X.jacobiSvd(ComputeThinU | ComputeThinV).solve(l_Y);
470
471 // Return the result.
472 Period = l_b(1);
473 return true;
474}
475
476std::ostream & operator<<(std::ostream & Stream, const CTimestampList & TimestampList)
477{
478 Stream << "( ";
479 for (auto l_TimeStamp : TimestampList)
480 Stream << l_TimeStamp << " ";
481 Stream << ")";
482 return Stream;
483}
484
485//----------------------------------------------------------------------//
486// Measurements //
487//----------------------------------------------------------------------//
488 void sArbitraryMeasurements::clear()
489{
490 Bx = By = Bz = Temperature = Timestamp = true;
491 NoMeasurements = 1;
492}
493 bool sArbitraryMeasurements::operator==(sArbitraryMeasurements other) const
494{
495 return (
496 Bx == other.Bx &&
497 By == other.By &&
498 Bz == other.Bz &&
499 Temperature == other.Temperature &&
500 Timestamp == other.Timestamp &&
501 NoMeasurements == other.NoMeasurements
502 );
503}
504 bool sArbitraryMeasurements::operator!=(sArbitraryMeasurements other) const
505{
506 return (!operator==(other));
507}
508
509 void sMeasurementConditions::clear()
510{
511 AveragingParms.clear();
512 TriggerParms.clear();
513 UseCalibration = true;
514 Range = 0.;
515}
516 bool sMeasurementConditions::operator==(sMeasurementConditions other) const
517{
518 return (
519 AveragingParms == other.AveragingParms &&
520 TriggerParms == other.TriggerParms &&
521 UseCalibration == other.UseCalibration &&
522 Range == other.Range
523 );
524}
525 bool sMeasurementConditions::operator!=(sMeasurementConditions other) const
526{
527 return (!operator==(other));
528}
529std::ostream & operator<<(std::ostream & Stream, const sArbitraryMeasurements & MeasSpec)
530{
531 Stream << "arb(Bx=" << MeasSpec.Bx <<
532 " By=" << MeasSpec.By <<
533 " Bz=" << MeasSpec.Bz <<
534 " temp=" << MeasSpec.Temperature <<
535 " time=" << MeasSpec.Timestamp <<
536 " count=" << MeasSpec.NoMeasurements << ")";
537 return Stream;
538}
539std::ostream & operator<<(std::ostream & Stream, const sMeasurementConditions & MeasCond)
540{
541 Stream << "meas_cond(avg=" << MeasCond.AveragingParms <<
542 " trig=" << MeasCond.TriggerParms <<
543 " cal=" << MeasCond.UseCalibration <<
544 " range=" << MeasCond.Range << ")";
545 return Stream;
546}
547
548} // namespace THM1176Types
549} // namespace Instrument
550} // namespace MTL
U64
unsigned long long U64
64-bit unsigned integer.
Definition OSDefines.h:32
U32
unsigned int U32
32-bit unsigned integer.
Definition OSDefines.h:31
F64
double F64
64-bit floating-point number.
Definition OSDefines.h:34
THM1176.h
Interface definition for C++ API for Metrolab THM1176/TFM1186.
MTL::Instrument::THM1176Types::CAbsoluteTimestamp
Timestamp for a measurement.
Definition THM1176Types.h:551
MTL::Instrument::THM1176Types::CAbsoluteTimestamp::NS_PER_SEC
static const U64 NS_PER_SEC
Definition THM1176Types.h:557
MTL::Instrument::THM1176Types::CAbsoluteTimestamp::seconds
std::time_t seconds(void) const
Fetch the number of seconds.
Definition THM1176Types.cpp:363
MTL::Instrument::THM1176Types::CAbsoluteTimestamp::operator!=
bool operator!=(CAbsoluteTimestamp other)
Inequality operator.
Definition THM1176Types.cpp:359
MTL::Instrument::THM1176Types::CAbsoluteTimestamp::operator==
bool operator==(CAbsoluteTimestamp other)
Equality operator.
Definition THM1176Types.cpp:355
MTL::Instrument::THM1176Types::CAbsoluteTimestamp::CAbsoluteTimestamp
CAbsoluteTimestamp(std::time_t Seconds=0, U64 Nanoseconds=0)
Constructor.
Definition THM1176Types.cpp:343
MTL::Instrument::THM1176Types::CAbsoluteTimestamp::clear
void clear(void)
Clear to default values (zeroes).
Definition THM1176Types.cpp:371
MTL::Instrument::THM1176Types::CAbsoluteTimestamp::operator=
CAbsoluteTimestamp & operator=(const CAbsoluteTimestamp &Value)
Assignment operator.
Definition THM1176Types.cpp:349
MTL::Instrument::THM1176Types::CAbsoluteTimestamp::nanoseconds
U64 nanoseconds(void) const
Fetch the number of nanoseconds.
Definition THM1176Types.cpp:367
MTL::Instrument::THM1176Types::CDivisorList
List of divisors, one per measurement unit.
Definition THM1176Types.h:203
MTL::Instrument::THM1176Types::CErrorList
List of errors returned by the instrument.
Definition THM1176Types.h:232
MTL::Instrument::THM1176Types::CFluxList
List of flux density values.
Definition THM1176Types.h:170
MTL::Instrument::THM1176Types::CTimestampList
List of timestamps.
Definition THM1176Types.h:576
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:429
MTL::Instrument::THM1176Types::CUnitsList
List of measurement units.
Definition THM1176Types.h:194
MTL::Instrument::THM1176Types::RegisterList
List of SCPI status registers.
Definition THM1176Types.h:66
MTL::Instrument::THM1176Types::StatusValues
List of values returned for several SCPI status registers.
Definition THM1176Types.h:76
MTL::Instrument::THM1176Types
Definition THM1176TypeConversions.h:20
MTL::Instrument::THM1176Types::eStatusRegisterType
eStatusRegisterType
Enumeration of SCPI status register types.
Definition THM1176Types.h:45
MTL::Instrument::THM1176Types::kStatusEnable
@ kStatusEnable
Enable register.
Definition THM1176Types.h:48
MTL::Instrument::THM1176Types::kStatusCondition
@ kStatusCondition
Condition register.
Definition THM1176Types.h:47
MTL::Instrument::THM1176Types::kStatusEvent
@ kStatusEvent
Event register.
Definition THM1176Types.h:46
MTL::Instrument::THM1176Types::operator-
CAbsoluteTimestamp operator-(CAbsoluteTimestamp a, CAbsoluteTimestamp b)
Timestamp subtraction operator.
Definition THM1176Types.cpp:394
MTL::Instrument::THM1176Types::eInstrModel::kUnknown
@ kUnknown
Definition THM1176Types.h:341
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::eCommunicationFormat
eCommunicationFormat
Enumeration of possible formats for returned data.
Definition THM1176Types.h:466
MTL::Instrument::THM1176Types::kComFormatInteger
@ kComFormatInteger
Binary (32-bit integers).
Definition THM1176Types.h:468
MTL::Instrument::THM1176Types::kComFormatPacked2Byte
@ kComFormatPacked2Byte
Binary packed: first field value as I32, remainder deltas as I16.
Definition THM1176Types.h:469
MTL::Instrument::THM1176Types::kComFormatPacked1Byte
@ kComFormatPacked1Byte
Binary packed: first field value as I32, remainder deltas as I8.
Definition THM1176Types.h:470
MTL::Instrument::THM1176Types::kComFormatAscii
@ kComFormatAscii
Human-legible text.
Definition THM1176Types.h:467
MTL::Instrument::THM1176Types::tFileList
std::vector< sFile > tFileList
List of directory entries.
Definition THM1176Types.h:532
MTL::Instrument::THM1176Types::kA
@ kA
Definition THM1176Types.h:347
MTL::Instrument::THM1176Types::operator+
CAbsoluteTimestamp operator+(CAbsoluteTimestamp a, CAbsoluteTimestamp b)
Timestamp addition operator.
Definition THM1176Types.cpp:380
MTL::Instrument::THM1176Types::eInputTriggerSource
eInputTriggerSource
Enumeration of possible trigger sources.
Definition THM1176Types.h:417
MTL::Instrument::THM1176Types::kInputTrigSrcTimer
@ kInputTrigSrcTimer
Timed trigger: start measurement at regular intervals.
Definition THM1176Types.h:419
MTL::Instrument::THM1176Types::kInputTrigSrcImmediate
@ kInputTrigSrcImmediate
Immediate trigger: start measurement immediately after previous one completes.
Definition THM1176Types.h:418
MTL::Instrument::THM1176Types::kInputTrigSrcBus
@ kInputTrigSrcBus
Bus trigger: start measurement upon USB trigger message.
Definition THM1176Types.h:420
MTL::Instrument::THM1176Types::eUnits
eUnits
Enumeration of possible measurement units.
Definition THM1176Types.h:182
MTL::Instrument::THM1176Types::knT
@ knT
Nano-Tesla.
Definition THM1176Types.h:186
MTL::Instrument::THM1176Types::kmT
@ kmT
Milli-Tesla.
Definition THM1176Types.h:184
MTL::Instrument::THM1176Types::kMHzp
@ kMHzp
Equivalent proton NMR resonant frequency, in Mega-Hertz.
Definition THM1176Types.h:190
MTL::Instrument::THM1176Types::kGauss
@ kGauss
Gauss.
Definition THM1176Types.h:187
MTL::Instrument::THM1176Types::kmGauss
@ kmGauss
Milli-Gauss.
Definition THM1176Types.h:189
MTL::Instrument::THM1176Types::kT
@ kT
Tesla.
Definition THM1176Types.h:183
MTL::Instrument::THM1176Types::kkGauss
@ kkGauss
Kilo-Gauss.
Definition THM1176Types.h:188
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::kStatusByte
@ kStatusByte
Status Byte.
Definition THM1176Types.h:38
MTL::Instrument::THM1176Types::kStatusQuestionableStatusRegister
@ kStatusQuestionableStatusRegister
Questionable Status Register.
Definition THM1176Types.h:40
MTL::Instrument::THM1176Types::kStandardEventStatusRegister
@ kStandardEventStatusRegister
Standard Event Status Register.
Definition THM1176Types.h:39
MTL::Instrument::THM1176Types::kStatusOperationStatusRegister
@ kStatusOperationStatusRegister
Operation Status Register.
Definition THM1176Types.h:41
MTL::Instrument
Definition THM1176.h:74
MTL
Definition THM1176.h:73
MTL::Instrument::THM1176Types::sArbitraryMeasurements
Specify the measurement data to be returned.
Definition THM1176Types.h:593
MTL::Instrument::THM1176Types::sArbitraryMeasurements::Bx
bool Bx
Return the flux density X-component.
Definition THM1176Types.h:594
MTL::Instrument::THM1176Types::sArbitraryMeasurements::operator==
bool operator==(sArbitraryMeasurements other) const
Equality operator.
Definition THM1176Types.cpp:493
MTL::Instrument::THM1176Types::sArbitraryMeasurements::Temperature
bool Temperature
Return the sensor temperature.
Definition THM1176Types.h:597
MTL::Instrument::THM1176Types::sArbitraryMeasurements::operator!=
bool operator!=(sArbitraryMeasurements other) const
Inequality operator.
Definition THM1176Types.cpp:504
MTL::Instrument::THM1176Types::sArbitraryMeasurements::By
bool By
Return the flux density Y-component.
Definition THM1176Types.h:595
MTL::Instrument::THM1176Types::sArbitraryMeasurements::Bz
bool Bz
Return the flux density Z-component.
Definition THM1176Types.h:596
MTL::Instrument::THM1176Types::sArbitraryMeasurements::clear
void clear()
Clear to default values.
Definition THM1176Types.cpp:488
MTL::Instrument::THM1176Types::sArbitraryMeasurements::sArbitraryMeasurements
sArbitraryMeasurements(bool Bx=false, bool By=false, bool Bz=false, bool Temp=false, bool Time=false, U32 NMeas=0)
Constructor.
Definition THM1176Types.h:609
MTL::Instrument::THM1176Types::sArbitraryMeasurements::Timestamp
bool Timestamp
Return the timestamp.
Definition THM1176Types.h:598
MTL::Instrument::THM1176Types::sArbitraryMeasurements::NoMeasurements
U32 NoMeasurements
Return this number of measurements.
Definition THM1176Types.h:599
MTL::Instrument::THM1176Types::sAveraging
Averaging parameter.
Definition THM1176Types.h:388
MTL::Instrument::THM1176Types::sAveraging::NoPoints
ParmType< U16 > NoPoints
Number of points in block average.
Definition THM1176Types.h:389
MTL::Instrument::THM1176Types::sError
Error returned by the instrument.
Definition THM1176Types.h:214
MTL::Instrument::THM1176Types::sError::operator==
bool operator==(sError other) const
Equality operator.
Definition THM1176Types.cpp:145
MTL::Instrument::THM1176Types::sError::sError
sError(I32 Code=0, std::string Description="", std::string Context="")
Constructor.
Definition THM1176Types.h:224
MTL::Instrument::THM1176Types::sError::Context
std::string Context
SCPI commands being executed at time of error.
Definition THM1176Types.h:217
MTL::Instrument::THM1176Types::sError::operator!=
bool operator!=(sError other) const
Inequality operator.
Definition THM1176Types.cpp:153
MTL::Instrument::THM1176Types::sError::Code
I32 Code
Error code.
Definition THM1176Types.h:215
MTL::Instrument::THM1176Types::sError::Description
std::string Description
Error description.
Definition THM1176Types.h:216
MTL::Instrument::THM1176Types::sFile
Directory entry in the instrument's file system.
Definition THM1176Types.h:514
MTL::Instrument::THM1176Types::sFile::clear
void clear()
Clear to default values.
Definition THM1176Types.cpp:308
MTL::Instrument::THM1176Types::sFile::Path
std::string Path
File path.
Definition THM1176Types.h:516
MTL::Instrument::THM1176Types::sFile::operator==
bool operator==(sFile other) const
Equality operator.
Definition THM1176Types.cpp:314
MTL::Instrument::THM1176Types::sFile::operator!=
bool operator!=(sFile other) const
Inequality operator.
Definition THM1176Types.cpp:322
MTL::Instrument::THM1176Types::sFile::Type
std::string Type
File type ("ASCII" or "BINARY").
Definition THM1176Types.h:517
MTL::Instrument::THM1176Types::sFile::sFile
sFile(size_t S=0, std::string P="", std::string T="")
Constructor.
Definition THM1176Types.h:524
MTL::Instrument::THM1176Types::sFile::Size
size_t Size
File size, in bytes.
Definition THM1176Types.h:515
MTL::Instrument::THM1176Types::sIdentifier
Instrument's identification string - parsed version.
Definition THM1176Types.h:353
MTL::Instrument::THM1176Types::sIdentifier::FirmwareVersion
struct sVersion FirmwareVersion
Version numbers of firmware.
Definition THM1176Types.h:359
MTL::Instrument::THM1176Types::sIdentifier::Manufacturer
std::string Manufacturer
Manufacturer name ("Metrolab Technology SA").
Definition THM1176Types.h:354
MTL::Instrument::THM1176Types::sIdentifier::ElectronicsVersion
struct sVersion ElectronicsVersion
Version numbers of electronics.
Definition THM1176Types.h:357
MTL::Instrument::THM1176Types::sIdentifier::SerialNumber
U32 SerialNumber
Serial number.
Definition THM1176Types.h:356
MTL::Instrument::THM1176Types::sIdentifier::operator!=
bool operator!=(sIdentifier other) const
Inequality operator.
Definition THM1176Types.cpp:220
MTL::Instrument::THM1176Types::sIdentifier::ProbeVersion
struct sVersion ProbeVersion
Version numbers of probe.
Definition THM1176Types.h:358
MTL::Instrument::THM1176Types::sIdentifier::Model
std::string Model
Model name (e.g. "THM1176-MF").
Definition THM1176Types.h:355
MTL::Instrument::THM1176Types::sIdentifier::operator==
bool operator==(sIdentifier other) const
Equality oeprator.
Definition THM1176Types.cpp:209
MTL::Instrument::THM1176Types::sIdentifier::clear
void clear(void)
Clear to default.
Definition THM1176Types.cpp:198
MTL::Instrument::THM1176Types::sIdentifier::InstrModel
enum eInstrModel InstrModel
Enumerator of instrument model.
Definition THM1176Types.h:361
MTL::Instrument::THM1176Types::sIdentifier::sIdentifier
sIdentifier(std::string Mfr="", std::string Mdl="", U32 SN=0, struct sVersion EVsn={ }, struct sVersion PVsn={ }, struct sVersion FVsn={ }, eModelRevision ThmRev=kA, eInstrModel InstrMdl=eInstrModel::kUnknown)
Constructor.
Definition THM1176Types.h:373
MTL::Instrument::THM1176Types::sIdentifier::ModelRevision
enum eModelRevision ModelRevision
Revision of Model.
Definition THM1176Types.h:360
MTL::Instrument::THM1176Types::sInputTrigger
Input trigger parameter.
Definition THM1176Types.h:426
MTL::Instrument::THM1176Types::sInputTrigger::Count
ParmType< U16 > Count
Trigger count: take this many measurements before sending results.
Definition THM1176Types.h:429
MTL::Instrument::THM1176Types::sInputTrigger::Source
eInputTriggerSource Source
Trigger source.
Definition THM1176Types.h:427
MTL::Instrument::THM1176Types::sInputTrigger::Period_s
ParmType< F64 > Period_s
Trigger period, for timed trigger.
Definition THM1176Types.h:428
MTL::Instrument::THM1176Types::sMeasurementConditions
Summary of the parameters used to make a measurement.
Definition THM1176Types.h:619
MTL::Instrument::THM1176Types::sMeasurementConditions::UseCalibration
bool UseCalibration
Use calibration data.
Definition THM1176Types.h:622
MTL::Instrument::THM1176Types::sMeasurementConditions::Range
tFlux Range
Current range setting.
Definition THM1176Types.h:623
MTL::Instrument::THM1176Types::sMeasurementConditions::operator!=
bool operator!=(sMeasurementConditions other) const
Inequality operator.
Definition THM1176Types.cpp:525
MTL::Instrument::THM1176Types::sMeasurementConditions::sMeasurementConditions
sMeasurementConditions(sAveraging< uParm > AvgParms={ }, sInputTrigger< uParm > TrigParms={ }, bool UseCal=false, tFlux RangeIn=0.)
Constructor.
Definition THM1176Types.h:631
MTL::Instrument::THM1176Types::sMeasurementConditions::clear
void clear()
Clear to default values.
Definition THM1176Types.cpp:509
MTL::Instrument::THM1176Types::sMeasurementConditions::AveragingParms
sAveraging< uParm > AveragingParms
Averaging parameters.
Definition THM1176Types.h:620
MTL::Instrument::THM1176Types::sMeasurementConditions::TriggerParms
sInputTrigger< uParm > TriggerParms
Trigger parameters.
Definition THM1176Types.h:621
MTL::Instrument::THM1176Types::sMeasurementConditions::operator==
bool operator==(sMeasurementConditions other) const
Equality operator.
Definition THM1176Types.cpp:516
MTL::Instrument::THM1176Types::sRange
Measurement range parameter.
Definition THM1176Types.h:479
MTL::Instrument::THM1176Types::sRange::Auto
bool Auto
Auto-ranging enabled.
Definition THM1176Types.h:480
MTL::Instrument::THM1176Types::sRange::Range
ParmType< tFlux > Range
Measurement range, if auto-ranging is not enabled.
Definition THM1176Types.h:481
MTL::Instrument::THM1176Types::sStatusRegister
Complete identification of a SCPI status register.
Definition THM1176Types.h:52
MTL::Instrument::THM1176Types::sStatusRegister::Set
eStatusRegisterSet Set
SCPI register set.
Definition THM1176Types.h:53
MTL::Instrument::THM1176Types::sStatusRegister::Type
eStatusRegisterType Type
SCPI register type.
Definition THM1176Types.h:54
MTL::Instrument::THM1176Types::sVersion
Major and minor version numbers.
Definition THM1176Types.h:314
MTL::Instrument::THM1176Types::sVersion::operator!=
bool operator!=(sVersion other) const
Inequality operator.
Definition THM1176Types.cpp:185
MTL::Instrument::THM1176Types::sVersion::clear
void clear(void)
Clear to default (zeroes).
Definition THM1176Types.cpp:174
MTL::Instrument::THM1176Types::sVersion::operator==
bool operator==(sVersion other) const
Equality operator.
Definition THM1176Types.cpp:179
MTL::Instrument::THM1176Types::sVersion::Minor
U8 Minor
Minor version number.
Definition THM1176Types.h:316
MTL::Instrument::THM1176Types::sVersion::sVersion
sVersion(U8 Maj=0, U8 Min=0)
Constructor.
Definition THM1176Types.h:323
MTL::Instrument::THM1176Types::sVersion::Major
U8 Major
Major version number.
Definition THM1176Types.h:315
MTL::Instrument::THM1176Types::uOPERation::sOPERation::RANGing
U16 RANGing
Changing range.
Definition THM1176Types.h:130
MTL::Instrument::THM1176Types::uOPERation::sOPERation::CALibrating
U16 CALibrating
Measuring zero-offset.
Definition THM1176Types.h:128
MTL::Instrument::THM1176Types::uOPERation::sOPERation::WaitingForTRIGger
U16 WaitingForTRIGger
Waiting for trigger.
Definition THM1176Types.h:133
MTL::Instrument::THM1176Types::uOPERation::sOPERation::MEASuring
U16 MEASuring
Measuring magnetic field strength.
Definition THM1176Types.h:132
MTL::Instrument::THM1176Types::uQUEStionable::sQUEStionable::Frequency
U16 Frequency
Acquisition buffer or the timed trigger has been overrun.
Definition THM1176Types.h:148
MTL::Instrument::THM1176Types::uQUEStionable::sQUEStionable::Overrange
U16 Overrange
Measurement was over-range.
Definition THM1176Types.h:150
MTL::Instrument::THM1176Types::uStandardEvent::sStandardEvent::CommandError
U8 CommandError
Error in preceding command.
Definition THM1176Types.h:113
MTL::Instrument::THM1176Types::uStandardEvent::sStandardEvent::DeviceDependentError
U8 DeviceDependentError
Errors specific to the THM1176, including internal errors.
Definition THM1176Types.h:111
MTL::Instrument::THM1176Types::uStandardEvent::sStandardEvent::ExecutionError
U8 ExecutionError
Error detected during command execution.
Definition THM1176Types.h:112
MTL::Instrument::THM1176Types::uStandardEvent::sStandardEvent::PowerOn
U8 PowerOn
THM1176 has been powered up.
Definition THM1176Types.h:115
MTL::Instrument::THM1176Types::uStandardEvent::sStandardEvent::OperationComplete
U8 OperationComplete
*OPC has flagged operation complete
Definition THM1176Types.h:108
MTL::Instrument::THM1176Types::uStandardEvent::sStandardEvent::QueryError
U8 QueryError
Error in preceding query.
Definition THM1176Types.h:110
MTL::Instrument::THM1176Types::uStatusByte::sStatusByte::MAV
U8 MAV
Message Available.
Definition THM1176Types.h:92
MTL::Instrument::THM1176Types::uStatusByte::sStatusByte::EAV
U8 EAV
Error Available in Error / Event Queue.
Definition THM1176Types.h:90
MTL::Instrument::THM1176Types::uStatusByte::sStatusByte::OSB
U8 OSB
OPERation status summary bit.
Definition THM1176Types.h:95
MTL::Instrument::THM1176Types::uStatusByte::sStatusByte::RQS
U8 RQS
ReQuest for Service.
Definition THM1176Types.h:94
MTL::Instrument::THM1176Types::uStatusByte::sStatusByte::ESB
U8 ESB
Standard Event Status Register summary bit.
Definition THM1176Types.h:93
MTL::Instrument::THM1176Types::uStatusByte::sStatusByte::QSB
U8 QSB
QUEStionable status summary bit.
Definition THM1176Types.h:91
MTL::Instrument::THM1176Types::uOPERation
Union to access the Operation Status Register as integer or bit fields.
Definition THM1176Types.h:120
MTL::Instrument::THM1176Types::uOPERation::OPERation
struct MTL::Instrument::THM1176Types::uOPERation::sOPERation OPERation
Access the Operation Status Register as bit fields.
MTL::Instrument::THM1176Types::uQUEStionable
Union to access the Questionable Status Register as integer or bit fields.
Definition THM1176Types.h:139
MTL::Instrument::THM1176Types::uQUEStionable::QUEStionable
struct MTL::Instrument::THM1176Types::uQUEStionable::sQUEStionable QUEStionable
Access the Questionable Status Register as bit fields.
MTL::Instrument::THM1176Types::uStandardEvent
Union to access the Standard Event Status Register as integer or bit fields.
Definition THM1176Types.h:100
MTL::Instrument::THM1176Types::uStandardEvent::StandardEvent
struct MTL::Instrument::THM1176Types::uStandardEvent::sStandardEvent StandardEvent
Access the Standard Event Status Register as bit fields.
MTL::Instrument::THM1176Types::uStatusByte
Union to access the Status Byte as integer or bit fields.
Definition THM1176Types.h:81
MTL::Instrument::THM1176Types::uStatusByte::StatusByte
struct MTL::Instrument::THM1176Types::uStatusByte::sStatusByte StatusByte
Access the Status Byte as bit fields.