| THM1176InstrumentManager 1.2 Qt Object abstraction for Metrolab THM1176

Loading...
Searching...
No Matches
THM1176IM_Test03_Parameters.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 <thread>
9#include <chrono>
10#include <iostream>
11
12#include <QtTest>
13#include <QSignalSpy>
14
15#include "CTHM1176InstrumentManager.h"
16
17 using namespace MTL;
18
19#define THM1176_PROMPT_TIME 10 // s
20#define THM1176_BOOT_N_SCAN_TIME 15000 // ms
21#define THM1176_CONNECT_TIME 5000 // ms
22#define THM1176_CHANGE_PARM_TIME 1000 // ms
23#define THM1176_RESET_TIME 1000 // ms
24#define THM1176_MEASURE_TIME 2000 // ms
25
26 static CTHM1176InstrumentManager Manager;
27
28//----------------------------------------------------------------------//
29// Utility functions //
30//----------------------------------------------------------------------//
31 static void PromptAndWait(std::string Prompt)
32{
33 std::string l_Space = ("" == Prompt) ? "" : " ";
34 std::string l_Message = ">>> " + Prompt + l_Space + "(Will continue in " + std::to_string(THM1176_PROMPT_TIME) + " seconds) <<<";
35 QWARN(" ");
36 QWARN(l_Message.c_str());
37 QThread::currentThread()->sleep(THM1176_PROMPT_TIME);
38}
39
40//----------------------------------------------------------------------//
41// Test class definition //
42//----------------------------------------------------------------------//
43 class THM1176IM_Test03_Parameters: public QObject
44{
45 Q_OBJECT
46
47 public:
48 THM1176IM_Test03_Parameters();
49 ~THM1176IM_Test03_Parameters();
50
51 private:
52 // Qt argument variant
53 QList<QVariant> m_Arguments;
54
55 // Basic instrument control:
56 CResourceList m_ResourceList;
57 tResourceName m_THM1176Selected;
58 eTHM1176OperatingMode m_OperatingMode;
59 CMeasurement m_Measurement;
60 CErrorList m_LatestErrors;
61
62 // Instrument information and parameter bounds:
63 sIdentifier m_Identification;
64 CFluxList m_RangeList;
65 CTHM1176UnitsList m_UnitsList;
66 CDivisorList m_DivisorList;
67 sAveraging<sBoundedParm> m_AveragingBounds;
68 sInputTrigger<sBoundedParm> m_TriggerBounds;
69 sRange<sBoundedParm> m_RangeBounds;
70
71 // Parameters:
72 sAveraging<uParm> m_AveragingParms;
73 sInputTrigger<uParm> m_Trigger;
74 sArbitraryMeasurements m_OutputSelect;
75 bool m_SleepParm;
76 eTHM1176Units m_Units;
77 bool m_UseCalibration;
78 sRange<uParm> m_RangeParms;
79 eCommunicationFormat m_CommFormat;
80
81 private slots:
82
84 void initTestCase(void);
85
87 void cleanupTestCase(void);
88
90 void TestGetEqualsInitialNotify(void);
91
93 void TestSetEqualsNotifyAndGet(void);
94
96 void TestNotifyAndGetAfterReset(void);
97
99 void TestGetAfterSetError(void);
100
102 void TestSetTriggerDuringContinuousMeasurement(void);
103
105 void TestSetAndGetAfterDisconnect(void);
106
107};
108
109//----------------------------------------------------------------------//
110// Test case constructor and destructor //
111//----------------------------------------------------------------------//
112 THM1176IM_Test03_Parameters::THM1176IM_Test03_Parameters()
113{
114
115}
116
117 THM1176IM_Test03_Parameters::~THM1176IM_Test03_Parameters()
118{
119
120}
121
122//----------------------------------------------------------------------//
123// Test case initialization and cleanup //
124//----------------------------------------------------------------------//
125 void THM1176IM_Test03_Parameters::initTestCase(void)
126{
127 QList<QVariant> m_Arguments;
128
129 // Start the Instrument Manager.
130 Manager.Start();
131
132 // Create Signal Spies to retrieve instrument list, instrument info, parameters, and possible errors.
133 QSignalSpy l_NotifyInstrumentListSpy(&Manager, SIGNAL(NotifyInstrumentList(CResourceList)));
134 QSignalSpy l_NotifyCurrentInstrumentSpy(&Manager, SIGNAL(NotifyCurrentInstrument(tResourceName)));
135
136 QSignalSpy l_NotifyIdentificationSpy(&Manager, SIGNAL(NotifyIdentification(sIdentifier)));
137 QSignalSpy l_NotifyRangeListSpy(&Manager, SIGNAL(NotifyRangeList(CFluxList)));
138 QSignalSpy l_NotifyUnitsListSpy(&Manager, SIGNAL(NotifyUnitsList(CTHM1176UnitsList)));
139 QSignalSpy l_NotifyDivisorListSpy(&Manager, SIGNAL(NotifyDivisorList(CDivisorList)));
140 QSignalSpy l_NotifyAveragingParmBoundsSpy(&Manager, SIGNAL(NotifyAveragingParmBounds(sAveraging<sBoundedParm>)));
141 QSignalSpy l_NotifyTriggerParmBoundsSpy(&Manager, SIGNAL(NotifyTriggerParmBounds(sInputTrigger<sBoundedParm>)));
142 QSignalSpy l_NotifyRangeParmBoundsSpy(&Manager, SIGNAL(NotifyRangeParmBounds(sRange<sBoundedParm>)));
143
144 QSignalSpy l_NotifyAveragingParmsSpy(&Manager, SIGNAL(NotifyAveragingParms(sAveraging<uParm>)));
145 QSignalSpy l_NotifyTriggerParmsSpy(&Manager, SIGNAL(NotifyTriggerParms(sInputTrigger<uParm>)));
146 QSignalSpy l_NotifyOutputSelectSpy(&Manager, SIGNAL(NotifyOutputSelect(sArbitraryMeasurements)));
147 QSignalSpy l_NotifySleepParmSpy(&Manager, SIGNAL(NotifySleepParm(bool)));
148 QSignalSpy l_NotifyUnitsSpy(&Manager, SIGNAL(NotifyUnits(eTHM1176Units)));
149 QSignalSpy l_NotifyRangeParmsSpy(&Manager, SIGNAL(NotifyRangeParms(sRange<uParm>)));
150 QSignalSpy l_NotifyCommFormatSpy(&Manager, SIGNAL(NotifyCommFormat(eCommunicationFormat)));
151
152 QSignalSpy l_NotifyOperatingModeSpy(&Manager, SIGNAL(NotifyOperatingMode(eTHM1176OperatingMode)));
153 QSignalSpy l_NotifyErrorListSpy(&Manager, SIGNAL(NotifyErrorList(CErrorList)));
154
155 // Plug in the THM.
156 PromptAndWait("Please plug in a THM");
157 l_NotifyInstrumentListSpy.wait(THM1176_BOOT_N_SCAN_TIME);
158 QCOMPARE(l_NotifyInstrumentListSpy.count(), 1);
159 m_Arguments = l_NotifyInstrumentListSpy.takeFirst();
160 m_ResourceList = qvariant_cast<CResourceList>(m_Arguments.at(0));
161 QCOMPARE(m_ResourceList.size(), 1ul);
162
163 // Select the THM.
164 Manager.SetCurrentInstrument(m_ResourceList[0]);
165
166 // The last thing to happen should be setting the Operating Mode to Idle.
167 l_NotifyOperatingModeSpy.wait(THM1176_CONNECT_TIME);
168 QCOMPARE(l_NotifyOperatingModeSpy.count(), 1);
169 m_Arguments = l_NotifyOperatingModeSpy.takeFirst();
170 m_OperatingMode = qvariant_cast<eTHM1176OperatingMode>(m_Arguments.at(0));
171 QCOMPARE(m_OperatingMode, kTHM1176Idle);
172
173 // Retrieve current instrument.
174 QCOMPARE(l_NotifyCurrentInstrumentSpy.count(), 1);
175 m_Arguments = l_NotifyCurrentInstrumentSpy.takeFirst();
176 m_THM1176Selected = qvariant_cast<tResourceName>(m_Arguments.at(0));
177 QCOMPARE(m_THM1176Selected, m_ResourceList[0]);
178
179 // Retrieve instrument information and parameter bounds for this THM.
180 QCOMPARE(l_NotifyIdentificationSpy.count(), 1);
181 m_Arguments = l_NotifyIdentificationSpy.takeFirst();
182 m_Identification = qvariant_cast<sIdentifier>(m_Arguments.at(0));
183 QVERIFY(!m_Identification.Manufacturer.empty() && !m_Identification.Model.empty() && m_Identification.SerialNumber != 0);
184
185 QCOMPARE(l_NotifyRangeListSpy.count(), 1);
186 m_Arguments = l_NotifyRangeListSpy.takeFirst();
187 m_RangeList = qvariant_cast<CFluxList>(m_Arguments.at(0));
188 QVERIFY(!m_RangeList.empty());
189
190 QCOMPARE(l_NotifyUnitsListSpy.count(), 1);
191 m_Arguments = l_NotifyUnitsListSpy.takeFirst();
192 m_UnitsList = qvariant_cast<CTHM1176UnitsList>(m_Arguments.at(0));
193 QVERIFY(!m_UnitsList.empty());
194
195 QCOMPARE(l_NotifyDivisorListSpy.count(), 1);
196 m_Arguments = l_NotifyDivisorListSpy.takeFirst();
197 m_DivisorList = qvariant_cast<CDivisorList>(m_Arguments.at(0));
198 QVERIFY(!m_DivisorList.empty());
199
200 QCOMPARE(l_NotifyAveragingParmBoundsSpy.count(), 1);
201 m_Arguments = l_NotifyAveragingParmBoundsSpy.takeFirst();
202 m_AveragingBounds = qvariant_cast<sAveraging<sBoundedParm>>(m_Arguments.at(0));
203 QVERIFY(m_AveragingBounds.NoPoints.Val != 0 && m_AveragingBounds.NoPoints.Min != 0 &&
204 m_AveragingBounds.NoPoints.Max != 0 && m_AveragingBounds.NoPoints.Def != 0);
205
206 QCOMPARE(l_NotifyTriggerParmBoundsSpy.count(), 1);
207 m_Arguments = l_NotifyTriggerParmBoundsSpy.takeFirst();
208 m_TriggerBounds = qvariant_cast<sInputTrigger<sBoundedParm>>(m_Arguments.at(0));
209 QVERIFY(m_TriggerBounds.Period_s.Val != 0 && m_TriggerBounds.Period_s.Min != 0 &&
210 m_TriggerBounds.Period_s.Max != 0 && m_TriggerBounds.Period_s.Def != 0 &&
211 m_TriggerBounds.Count.Val != 0 && m_TriggerBounds.Count.Min != 0 &&
212 m_TriggerBounds.Count.Max != 0 && m_TriggerBounds.Count.Def != 0);
213
214 QCOMPARE(l_NotifyRangeParmBoundsSpy.count(), 1);
215 m_Arguments = l_NotifyRangeParmBoundsSpy.takeFirst();
216 m_RangeBounds = qvariant_cast<sRange<sBoundedParm>>(m_Arguments.at(0));
217 QVERIFY(m_RangeBounds.Range.Val != 0 && m_RangeBounds.Range.Min != 0 &&
218 m_RangeBounds.Range.Max != 0 && m_RangeBounds.Range.Def != 0);
219
220 // Retrieve the current parameters for this instrument.
221 QCOMPARE(l_NotifyAveragingParmsSpy.count(), 1);
222 m_Arguments = l_NotifyAveragingParmsSpy.takeFirst();
223 m_AveragingParms = qvariant_cast<sAveraging<uParm>>(m_Arguments.at(0));
224 QVERIFY(m_AveragingParms.NoPoints > 0);
225
226 QCOMPARE(l_NotifyTriggerParmsSpy.count(), 1);
227 m_Arguments = l_NotifyTriggerParmsSpy.takeFirst();
228 m_Trigger = qvariant_cast<sInputTrigger<uParm>>(m_Arguments.at(0));
229 QVERIFY(m_Trigger.Period_s > 0. && m_Trigger.Count > 0);
230
231 QCOMPARE(l_NotifyOutputSelectSpy.count(), 1);
232 m_Arguments = l_NotifyOutputSelectSpy.takeFirst();
233 m_OutputSelect = qvariant_cast<sArbitraryMeasurements>(m_Arguments.at(0));
234
235 QCOMPARE(l_NotifySleepParmSpy.count(), 1);
236 m_Arguments = l_NotifySleepParmSpy.takeFirst();
237 m_SleepParm = qvariant_cast<bool>(m_Arguments.at(0));
238
239 QCOMPARE(l_NotifyUnitsSpy.count(), 1);
240 m_Arguments = l_NotifyUnitsSpy.takeFirst();
241 m_Units = qvariant_cast<eTHM1176Units>(m_Arguments.at(0));
242
243 QCOMPARE(l_NotifyRangeParmsSpy.count(), 1);
244 m_Arguments = l_NotifyRangeParmsSpy.takeFirst();
245 m_RangeParms = qvariant_cast<sRange<uParm>>(m_Arguments.at(0));
246
247 QCOMPARE(l_NotifyCommFormatSpy.count(), 1);
248 m_Arguments = l_NotifyCommFormatSpy.takeFirst();
249 m_CommFormat = qvariant_cast<eCommunicationFormat>(m_Arguments.at(0));
250
251 QCOMPARE(l_NotifyErrorListSpy.count(), 0);
252
253 std::cout << "- Connected to " << m_Identification.Model << ", S/N " << m_Identification.SerialNumber << std::endl;
254
255} // THM1176IM_Test03_Parameters::initTestCase
256
257 void THM1176IM_Test03_Parameters::cleanupTestCase(void)
258{
259 Manager.Stop();
260}
261
264 void THM1176IM_Test03_Parameters::TestGetEqualsInitialNotify(void)
265{
266 // Basic instrument control:
267 CResourceList l_ResourceList_temp = Manager.GetInstrumentList();
268 QVERIFY(l_ResourceList_temp == m_ResourceList);
269 tResourceName l_THM1176Selected_temp = Manager.GetCurrentInstrument();
270 QVERIFY(l_THM1176Selected_temp == m_THM1176Selected);
271 eTHM1176OperatingMode l_OperatingMode_temp = Manager.GetOperatingMode();
272 QVERIFY(l_OperatingMode_temp == m_OperatingMode);
273 CMeasurement l_Measurement_temp = Manager.GetMeasurement();
274 QVERIFY(l_Measurement_temp == m_Measurement);
275 CErrorList l_LatestErrors_temp = Manager.GetErrorList();
276 QVERIFY(l_LatestErrors_temp == m_LatestErrors);
277
278 // Instrument information and parameter bounds:
279 sIdentifier l_Identification_temp = Manager.GetIdentification();
280 QVERIFY(l_Identification_temp == m_Identification);
281 CFluxList l_RangeList_temp = Manager.GetRangeList();
282 QVERIFY(l_RangeList_temp == m_RangeList);
283 CTHM1176UnitsList l_UnitsList_temp = Manager.GetUnitsList();
284 QVERIFY(l_UnitsList_temp == m_UnitsList);
285 CDivisorList l_DivisorList_temp = Manager.GetDivisorList();
286 QVERIFY(l_DivisorList_temp == m_DivisorList);
287 sAveraging<sBoundedParm> l_AveragingBounds_temp = Manager.GetAveragingParmBounds();
288 QVERIFY(l_AveragingBounds_temp == m_AveragingBounds);
289 sInputTrigger<sBoundedParm> l_TriggerBounds_temp = Manager.GetTriggerParmBounds();
290 QVERIFY(l_TriggerBounds_temp == m_TriggerBounds);
291 sRange<sBoundedParm> l_RangeBounds_temp = Manager.GetRangeParmBounds();
292 QVERIFY(l_RangeBounds_temp == m_RangeBounds);
293
294 // Parameters:
295 sAveraging<uParm> l_AveragingParms_temp = Manager.GetAveragingParms();
296 QVERIFY(l_AveragingParms_temp == m_AveragingParms);
297 sInputTrigger<uParm> l_Trigger_temp = Manager.GetTriggerParms();
298 QVERIFY(l_Trigger_temp == m_Trigger);
299 sArbitraryMeasurements l_OutputSelect_temp = Manager.GetOutputSelect();
300 QVERIFY(l_OutputSelect_temp == m_OutputSelect);
301 bool l_SleepParm_temp = Manager.GetSleepParm();
302 QVERIFY(l_SleepParm_temp == m_SleepParm);
303 eTHM1176Units l_Units_temp = Manager.GetUnits();
304 QVERIFY(l_Units_temp == m_Units);
305 sRange<uParm> l_RangeParms_temp = Manager.GetRangeParms();
306 QVERIFY(l_RangeParms_temp == m_RangeParms);
307 eCommunicationFormat l_CommFormat_temp = Manager.GetCommFormat();
308 QVERIFY(l_CommFormat_temp == m_CommFormat);
309
310} // THM1176IM_Test03_Parameters::TestGetEqualsInitialNotify
311
314 void THM1176IM_Test03_Parameters::TestSetEqualsNotifyAndGet(void)
315{
316 // Create Signal Spies to reset and retrieve parameters and possible errors.
317 QSignalSpy l_NotifyOperatingModeSpy(&Manager, SIGNAL(NotifyOperatingMode(eTHM1176OperatingMode)));
318
319 QSignalSpy l_NotifyAveragingParmsSpy(&Manager, SIGNAL(NotifyAveragingParms(sAveraging<uParm>)));
320 QSignalSpy l_NotifyTriggerParmsSpy(&Manager, SIGNAL(NotifyTriggerParms(sInputTrigger<uParm>)));
321 QSignalSpy l_NotifyOutputSelectSpy(&Manager, SIGNAL(NotifyOutputSelect(sArbitraryMeasurements)));
322 QSignalSpy l_NotifySleepParmSpy(&Manager, SIGNAL(NotifySleepParm(bool)));
323 QSignalSpy l_NotifyUnitsSpy(&Manager, SIGNAL(NotifyUnits(eTHM1176Units)));
324 QSignalSpy l_NotifyRangeParmsSpy(&Manager, SIGNAL(NotifyRangeParms(sRange<uParm>)));
325 QSignalSpy l_NotifyCommFormatSpy(&Manager, SIGNAL(NotifyCommFormat(eCommunicationFormat)));
326
327 QSignalSpy l_NotifyErrorListSpy(&Manager, SIGNAL(NotifyErrorList(CErrorList)));
328
329 // Perform reset to guarantee a known state.
330 Manager.SetOperatingMode(kTHM1176Reset);
331
332 l_NotifyOperatingModeSpy.wait(THM1176_RESET_TIME);
333 QVERIFY(l_NotifyOperatingModeSpy.count() > 0);
334 m_Arguments = l_NotifyOperatingModeSpy.takeFirst();
335 m_OperatingMode = qvariant_cast<eTHM1176OperatingMode>(m_Arguments.at(0));
336 QCOMPARE(m_OperatingMode, kTHM1176Reset);
337 if (l_NotifyOperatingModeSpy.count() <= 0)
338 {
339 l_NotifyOperatingModeSpy.wait(THM1176_RESET_TIME);
340 QCOMPARE(l_NotifyOperatingModeSpy.count(), 1);
341 }
342 m_Arguments = l_NotifyOperatingModeSpy.takeFirst();
343 m_OperatingMode = qvariant_cast<eTHM1176OperatingMode>(m_Arguments.at(0));
344 QCOMPARE(m_OperatingMode, kTHM1176Idle);
345
346 // Ignore any notifications.
347 l_NotifyAveragingParmsSpy.clear();
348 l_NotifyTriggerParmsSpy.clear();
349 l_NotifyOutputSelectSpy.clear();
350 l_NotifySleepParmSpy.clear();
351 l_NotifyUnitsSpy.clear();
352 l_NotifyRangeParmsSpy.clear();
353 l_NotifyCommFormatSpy.clear();
354
355 // Averaging parameters.
356 sAveraging<uParm> l_AveragingParms_temp = { 123 };
357 Manager.SetAveragingParms(l_AveragingParms_temp);
358
359 l_NotifyAveragingParmsSpy.wait(THM1176_CHANGE_PARM_TIME);
360 QCOMPARE(l_NotifyAveragingParmsSpy.count(), 1);
361 m_Arguments = l_NotifyAveragingParmsSpy.takeFirst();
362 m_AveragingParms = qvariant_cast<sAveraging<uParm>>(m_Arguments.at(0));
363 QVERIFY(l_AveragingParms_temp == m_AveragingParms);
364
365 l_AveragingParms_temp = Manager.GetAveragingParms();
366 QVERIFY(l_AveragingParms_temp == m_AveragingParms);
367
368 QCOMPARE(l_NotifyErrorListSpy.count(), 0);
369
370 // Trigger parameters.
371 sInputTrigger<uParm> l_Trigger_temp = { kInputTrigSrcTimer, 0.123, 123 };
372 Manager.SetTriggerParms(l_Trigger_temp);
373
374 l_NotifyTriggerParmsSpy.wait(THM1176_CHANGE_PARM_TIME);
375 QCOMPARE(l_NotifyTriggerParmsSpy.count(), 1);
376 m_Arguments = l_NotifyTriggerParmsSpy.takeFirst();
377 m_Trigger = qvariant_cast<sInputTrigger<uParm>>(m_Arguments.at(0));
378 QVERIFY(l_Trigger_temp == m_Trigger);
379
380 l_Trigger_temp = Manager.GetTriggerParms();
381 QVERIFY(l_Trigger_temp == m_Trigger);
382
383 QCOMPARE(l_NotifyErrorListSpy.count(), 0);
384
385 // Output selection parameters.
386 sArbitraryMeasurements l_OutputSelect_temp = { false, true, false, true, false, 123 };
387 Manager.SetOutputSelect(l_OutputSelect_temp);
388
389 l_NotifyOutputSelectSpy.wait(THM1176_CHANGE_PARM_TIME);
390 QCOMPARE(l_NotifyOutputSelectSpy.count(), 1);
391 m_Arguments = l_NotifyOutputSelectSpy.takeFirst();
392 m_OutputSelect = qvariant_cast<sArbitraryMeasurements>(m_Arguments.at(0));
393 QVERIFY(l_OutputSelect_temp == m_OutputSelect);
394
395 l_OutputSelect_temp = Manager.GetOutputSelect();
396 QVERIFY(l_OutputSelect_temp == m_OutputSelect);
397
398 QCOMPARE(l_NotifyErrorListSpy.count(), 0);
399
400 // Sleep parameter.
401 bool l_SleepParm_temp = !m_SleepParm;
402 Manager.SetSleepParm(l_SleepParm_temp);
403
404 l_NotifySleepParmSpy.wait(THM1176_CHANGE_PARM_TIME);
405 QCOMPARE(l_NotifySleepParmSpy.count(), 1);
406 m_Arguments = l_NotifySleepParmSpy.takeFirst();
407 m_SleepParm = qvariant_cast<bool>(m_Arguments.at(0));
408 QVERIFY(l_SleepParm_temp == m_SleepParm);
409
410 l_SleepParm_temp = Manager.GetSleepParm();
411 QVERIFY(l_SleepParm_temp == m_SleepParm);
412
413 QCOMPARE(l_NotifyErrorListSpy.count(), 0);
414
415 // Units.
416 eTHM1176Units l_Units_temp = m_UnitsList.back();
417 Manager.SetUnits(l_Units_temp);
418
419 l_NotifyUnitsSpy.wait(THM1176_CHANGE_PARM_TIME);
420 QCOMPARE(l_NotifyUnitsSpy.count(), 1);
421 m_Arguments = l_NotifyUnitsSpy.takeFirst();
422 m_Units = qvariant_cast<eTHM1176Units>(m_Arguments.at(0));
423 QVERIFY(l_Units_temp == m_Units);
424
425 l_Units_temp = Manager.GetUnits();
426 QVERIFY(l_Units_temp == m_Units);
427
428 QCOMPARE(l_NotifyErrorListSpy.count(), 0);
429
430 // Range parameters.
431 sRange<uParm> l_RangeParms_temp = { !m_RangeParms.Auto, m_RangeList.front()};
432 Manager.SetRangeParms(l_RangeParms_temp);
433
434 l_NotifyRangeParmsSpy.wait(THM1176_CHANGE_PARM_TIME);
435 QCOMPARE(l_NotifyRangeParmsSpy.count(), 1);
436 m_Arguments = l_NotifyRangeParmsSpy.takeFirst();
437 m_RangeParms = qvariant_cast<sRange<uParm>>(m_Arguments.at(0));
438 QVERIFY(l_RangeParms_temp == m_RangeParms);
439
440 l_RangeParms_temp = Manager.GetRangeParms();
441 QVERIFY(l_RangeParms_temp == m_RangeParms);
442
443 QCOMPARE(l_NotifyErrorListSpy.count(), 0);
444
445 // Communication Format parameter.
446 eCommunicationFormat l_CommFormat_temp = kComFormatPacked1Byte;
447 Manager.SetCommFormat(l_CommFormat_temp);
448
449 l_NotifyCommFormatSpy.wait(THM1176_CHANGE_PARM_TIME);
450 QCOMPARE(l_NotifyCommFormatSpy.count(), 1);
451 m_Arguments = l_NotifyCommFormatSpy.takeFirst();
452 m_CommFormat = qvariant_cast<eCommunicationFormat>(m_Arguments.at(0));
453 QVERIFY(l_CommFormat_temp == m_CommFormat);
454
455 l_CommFormat_temp = Manager.GetCommFormat();
456 QVERIFY(l_CommFormat_temp == m_CommFormat);
457
458 QCOMPARE(l_NotifyErrorListSpy.count(), 0);
459
460} // THM1176IM_Test03_Parameters::TestSetEqualsNotifyAndGet
461
464 void THM1176IM_Test03_Parameters::TestNotifyAndGetAfterReset(void)
465{
466 // Create Signal Spies to reset and retrieve parameters and possible errors.
467 QSignalSpy l_NotifyOperatingModeSpy(&Manager, SIGNAL(NotifyOperatingMode(eTHM1176OperatingMode)));
468
469 QSignalSpy l_NotifyAveragingParmsSpy(&Manager, SIGNAL(NotifyAveragingParms(sAveraging<uParm>)));
470 QSignalSpy l_NotifyTriggerParmsSpy(&Manager, SIGNAL(NotifyTriggerParms(sInputTrigger<uParm>)));
471 QSignalSpy l_NotifyOutputSelectSpy(&Manager, SIGNAL(NotifyOutputSelect(sArbitraryMeasurements)));
472 QSignalSpy l_NotifySleepParmSpy(&Manager, SIGNAL(NotifySleepParm(bool)));
473 QSignalSpy l_NotifyUnitsSpy(&Manager, SIGNAL(NotifyUnits(eTHM1176Units)));
474 QSignalSpy l_NotifyRangeParmsSpy(&Manager, SIGNAL(NotifyRangeParms(sRange<uParm>)));
475 QSignalSpy l_NotifyCommFormatSpy(&Manager, SIGNAL(NotifyCommFormat(eCommunicationFormat)));
476
477 QSignalSpy l_NotifyErrorListSpy(&Manager, SIGNAL(NotifyErrorList(CErrorList)));
478
479 // Perform reset.
480 Manager.SetOperatingMode(kTHM1176Reset);
481
482 l_NotifyOperatingModeSpy.wait(THM1176_RESET_TIME);
483 QVERIFY(l_NotifyOperatingModeSpy.count() > 0);
484 m_Arguments = l_NotifyOperatingModeSpy.takeFirst();
485 m_OperatingMode = qvariant_cast<eTHM1176OperatingMode>(m_Arguments.at(0));
486 QCOMPARE(m_OperatingMode, kTHM1176Reset);
487 if (l_NotifyOperatingModeSpy.count() <= 0)
488 {
489 l_NotifyOperatingModeSpy.wait(THM1176_RESET_TIME);
490 QCOMPARE(l_NotifyOperatingModeSpy.count(), 1);
491 }
492 m_Arguments = l_NotifyOperatingModeSpy.takeFirst();
493 m_OperatingMode = qvariant_cast<eTHM1176OperatingMode>(m_Arguments.at(0));
494 QCOMPARE(m_OperatingMode, kTHM1176Idle);
495
496 // Should have no errors.
497 QCOMPARE(l_NotifyErrorListSpy.count(), 0);
498
499 // Averaging parameters.
500 sAveraging<uParm> l_AveragingParms_temp = { 1 };
501 if (l_AveragingParms_temp != m_AveragingParms)
502 {
503 QCOMPARE(l_NotifyAveragingParmsSpy.count(), 1);
504 m_Arguments = l_NotifyAveragingParmsSpy.takeFirst();
505 m_AveragingParms = qvariant_cast<sAveraging<uParm>>(m_Arguments.at(0));
506 QVERIFY(l_AveragingParms_temp == m_AveragingParms);
507 }
508 l_AveragingParms_temp = Manager.GetAveragingParms();
509 QVERIFY(l_AveragingParms_temp == m_AveragingParms);
510
511 // Trigger parameters.
512 sInputTrigger<uParm> l_Trigger_temp = { kInputTrigSrcImmediate, 0.1, 1 };
513 if (l_Trigger_temp != m_Trigger)
514 {
515 QCOMPARE(l_NotifyTriggerParmsSpy.count(), 1);
516 m_Arguments = l_NotifyTriggerParmsSpy.takeFirst();
517 m_Trigger = qvariant_cast<sInputTrigger<uParm>>(m_Arguments.at(0));
518 QVERIFY(l_Trigger_temp == m_Trigger);
519 }
520 l_Trigger_temp = Manager.GetTriggerParms();
521 QVERIFY(l_Trigger_temp == m_Trigger);
522
523 // Output selection parameters.
524 sArbitraryMeasurements l_OutputSelect_temp = { true, true, true, true, true, 1 };
525 if (l_OutputSelect_temp != m_OutputSelect)
526 {
527 QCOMPARE(l_NotifyOutputSelectSpy.count(), 1);
528 m_Arguments = l_NotifyOutputSelectSpy.takeFirst();
529 m_OutputSelect = qvariant_cast<sArbitraryMeasurements>(m_Arguments.at(0));
530 QVERIFY(l_OutputSelect_temp == m_OutputSelect);
531 }
532 l_OutputSelect_temp = Manager.GetOutputSelect();
533 QVERIFY(l_OutputSelect_temp == m_OutputSelect);
534
535 // Sleep parameter.
536 bool l_SleepParm_temp = false;
537 if (l_SleepParm_temp != m_SleepParm)
538 {
539 QCOMPARE(l_NotifySleepParmSpy.count(), 1);
540 m_Arguments = l_NotifySleepParmSpy.takeFirst();
541 m_SleepParm = qvariant_cast<bool>(m_Arguments.at(0));
542 QVERIFY(l_SleepParm_temp == m_SleepParm);
543 }
544 l_SleepParm_temp = Manager.GetSleepParm();
545 QVERIFY(l_SleepParm_temp == m_SleepParm);
546
547 // Units.
548 eTHM1176Units l_Units_temp = MTL::kT;
549 if (l_Units_temp != m_Units)
550 {
551 QCOMPARE(l_NotifyUnitsSpy.count(), 1);
552 m_Arguments = l_NotifyUnitsSpy.takeFirst();
553 m_Units = qvariant_cast<eTHM1176Units>(m_Arguments.at(0));
554 QVERIFY(l_Units_temp == m_Units);
555 }
556 l_Units_temp = Manager.GetUnits();
557 QVERIFY(l_Units_temp == m_Units);
558
559 // Range parameters.
560 sRange<uParm> l_RangeParms_temp = { true, m_RangeList.back()};
561 if (l_RangeParms_temp != m_RangeParms)
562 {
563 QCOMPARE(l_NotifyRangeParmsSpy.count(), 1);
564 m_Arguments = l_NotifyRangeParmsSpy.takeFirst();
565 m_RangeParms = qvariant_cast<sRange<uParm>>(m_Arguments.at(0));
566 QVERIFY(l_RangeParms_temp == m_RangeParms);
567 }
568 l_RangeParms_temp = Manager.GetRangeParms();
569 QVERIFY(l_RangeParms_temp == m_RangeParms);
570
571 // Communication Format parameter.
572 eCommunicationFormat l_CommFormat_temp = kComFormatAscii;
573 if (l_CommFormat_temp != m_CommFormat)
574 {
575 QCOMPARE(l_NotifyCommFormatSpy.count(), 1);
576 m_Arguments = l_NotifyCommFormatSpy.takeFirst();
577 m_CommFormat = qvariant_cast<eCommunicationFormat>(m_Arguments.at(0));
578 QVERIFY(l_CommFormat_temp == m_CommFormat);
579 }
580 l_CommFormat_temp = Manager.GetCommFormat();
581 QVERIFY(l_CommFormat_temp == m_CommFormat);
582
583} // THM1176IM_Test03_Parameters::TestNotifyAndGetAfterReset
584
587 void THM1176IM_Test03_Parameters::TestGetAfterSetError(void)
588{
589 // Create Signal Spies to reset and retrieve parameters and possible errors.
590 QSignalSpy l_NotifyOperatingModeSpy(&Manager, SIGNAL(NotifyOperatingMode(eTHM1176OperatingMode)));
591
592 QSignalSpy l_NotifyAveragingParmsSpy(&Manager, SIGNAL(NotifyAveragingParms(sAveraging<uParm>)));
593 QSignalSpy l_NotifyTriggerParmsSpy(&Manager, SIGNAL(NotifyTriggerParms(sInputTrigger<uParm>)));
594 QSignalSpy l_NotifyOutputSelectSpy(&Manager, SIGNAL(NotifyOutputSelect(sArbitraryMeasurements)));
595 QSignalSpy l_NotifySleepParmSpy(&Manager, SIGNAL(NotifySleepParm(bool)));
596 QSignalSpy l_NotifyUnitsSpy(&Manager, SIGNAL(NotifyUnits(eTHM1176Units)));
597 QSignalSpy l_NotifyRangeParmsSpy(&Manager, SIGNAL(NotifyRangeParms(sRange<uParm>)));
598 QSignalSpy l_NotifyCommFormatSpy(&Manager, SIGNAL(NotifyCommFormat(eCommunicationFormat)));
599
600 QSignalSpy l_NotifyErrorListSpy(&Manager, SIGNAL(NotifyErrorList(CErrorList)));
601
602 // Perform reset to guarantee a known state.
603 Manager.SetOperatingMode(kTHM1176Reset);
604
605 l_NotifyOperatingModeSpy.wait(THM1176_RESET_TIME);
606 QVERIFY(l_NotifyOperatingModeSpy.count() > 0);
607 m_Arguments = l_NotifyOperatingModeSpy.takeFirst();
608 m_OperatingMode = qvariant_cast<eTHM1176OperatingMode>(m_Arguments.at(0));
609 QCOMPARE(m_OperatingMode, kTHM1176Reset);
610 if (l_NotifyOperatingModeSpy.count() <= 0)
611 {
612 l_NotifyOperatingModeSpy.wait(THM1176_RESET_TIME);
613 QCOMPARE(l_NotifyOperatingModeSpy.count(), 1);
614 }
615 m_Arguments = l_NotifyOperatingModeSpy.takeFirst();
616 m_OperatingMode = qvariant_cast<eTHM1176OperatingMode>(m_Arguments.at(0));
617 QCOMPARE(m_OperatingMode, kTHM1176Idle);
618
619 // Ignore any notifications.
620 l_NotifyAveragingParmsSpy.clear();
621 l_NotifyTriggerParmsSpy.clear();
622 l_NotifyOutputSelectSpy.clear();
623 l_NotifySleepParmSpy.clear();
624 l_NotifyUnitsSpy.clear();
625 l_NotifyRangeParmsSpy.clear();
626 l_NotifyCommFormatSpy.clear();
627 l_NotifyErrorListSpy.clear();
628
629 // Retrieve the parameter values via Get...
630 m_AveragingParms = Manager.GetAveragingParms();
631 m_Trigger = Manager.GetTriggerParms();
632 m_OutputSelect = Manager.GetOutputSelect();
633 m_SleepParm = Manager.GetSleepParm();
634 m_Units = Manager.GetUnits();
635 m_RangeParms = Manager.GetRangeParms();
636 m_CommFormat = Manager.GetCommFormat();
637
638 // Averaging parameters: too low.
639 sAveraging<uParm> l_AveragingParms_temp = { 0 };
640 Manager.SetAveragingParms(l_AveragingParms_temp);
641 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
642 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
643 l_NotifyErrorListSpy.clear();
644 QCOMPARE(l_NotifyAveragingParmsSpy.count(), 0);
645 l_AveragingParms_temp = Manager.GetAveragingParms();
646 QVERIFY(l_AveragingParms_temp == m_AveragingParms);
647
648 // Averaging parameters: too high.
649 l_AveragingParms_temp = { static_cast<U16>(m_AveragingBounds.NoPoints.Max + 1) };
650 Manager.SetAveragingParms(l_AveragingParms_temp);
651 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
652 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
653 l_NotifyErrorListSpy.clear();
654 QCOMPARE(l_NotifyAveragingParmsSpy.count(), 0);
655 l_AveragingParms_temp = Manager.GetAveragingParms();
656 QVERIFY(l_AveragingParms_temp == m_AveragingParms);
657
658 // Trigger parameters: count too low.
659 sInputTrigger<uParm> l_Trigger_temp = { kInputTrigSrcTimer, 0.1, 0 };
660 Manager.SetTriggerParms(l_Trigger_temp);
661 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
662 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
663 l_NotifyErrorListSpy.clear();
664 QCOMPARE(l_NotifyTriggerParmsSpy.count(), 0);
665 l_Trigger_temp = Manager.GetTriggerParms();
666 QVERIFY(l_Trigger_temp == m_Trigger);
667
668 // Trigger parameters: count too high.
669 l_Trigger_temp = { kInputTrigSrcTimer, 0.1, static_cast<U16>(m_TriggerBounds.Count.Max + 1) };
670 Manager.SetTriggerParms(l_Trigger_temp);
671 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
672 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
673 l_NotifyErrorListSpy.clear();
674 QCOMPARE(l_NotifyTriggerParmsSpy.count(), 0);
675 l_Trigger_temp = Manager.GetTriggerParms();
676 QVERIFY(l_Trigger_temp == m_Trigger);
677
678 // Trigger parameters: period too low.
679 l_Trigger_temp = { kInputTrigSrcTimer, 0, 1 };
680 Manager.SetTriggerParms(l_Trigger_temp);
681 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
682 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
683 l_NotifyErrorListSpy.clear();
684 QCOMPARE(l_NotifyTriggerParmsSpy.count(), 0);
685 l_Trigger_temp = Manager.GetTriggerParms();
686 QVERIFY(l_Trigger_temp == m_Trigger);
687
688 // Trigger parameters: period too high.
689 l_Trigger_temp = { kInputTrigSrcTimer, 2. * m_TriggerBounds.Period_s.Max, 1 };
690 Manager.SetTriggerParms(l_Trigger_temp);
691 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
692 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
693 l_NotifyErrorListSpy.clear();
694 QCOMPARE(l_NotifyTriggerParmsSpy.count(), 0);
695 l_Trigger_temp = Manager.GetTriggerParms();
696 QVERIFY(l_Trigger_temp == m_Trigger);
697
698 // Output selection parameters: count too low.
699 sArbitraryMeasurements l_OutputSelect_temp = { false, true, false, true, false, 0 };
700 Manager.SetOutputSelect(l_OutputSelect_temp);
701 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
702 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
703 l_NotifyErrorListSpy.clear();
704 QCOMPARE(l_NotifyOutputSelectSpy.count(), 0);
705 l_OutputSelect_temp = Manager.GetOutputSelect();
706 QVERIFY(l_OutputSelect_temp == m_OutputSelect);
707
708 // Output selection parameters: count too high.
709 l_OutputSelect_temp = { false, true, false, true, false, 2 };
710 Manager.SetOutputSelect(l_OutputSelect_temp);
711 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
712 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
713 l_NotifyErrorListSpy.clear();
714 QCOMPARE(l_NotifyOutputSelectSpy.count(), 0);
715 l_OutputSelect_temp = Manager.GetOutputSelect();
716 QVERIFY(l_OutputSelect_temp == m_OutputSelect);
717
718 // Units: not supported by this instrument.
719 eTHM1176Units l_Units_temp = MTL::kT;
720 std::set<eTHM1176Units> l_SupportedUnits;
721 for (auto l_pUnits = m_UnitsList.begin(); l_pUnits < m_UnitsList.end(); l_pUnits++)
722 l_SupportedUnits.insert(*l_pUnits);
723 for (int i = MTL::kT; i <= MTL::kMHzp; i++)
724 {
725 eTHM1176Units m_Units = static_cast<eTHM1176Units>(i);
726 if (l_SupportedUnits.count(m_Units) == 0)
727 l_Units_temp = m_Units;
728 }
729 Manager.SetUnits(l_Units_temp);
730 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
731 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
732 l_NotifyErrorListSpy.clear();
733 QCOMPARE(l_NotifyUnitsSpy.count(), 0);
734 l_Units_temp = Manager.GetUnits();
735 QVERIFY(l_Units_temp == m_Units);
736
737 // Range parameters: invalid range.
738 sRange<uParm> l_RangeParms_temp = { false, 0.};
739 Manager.SetRangeParms(l_RangeParms_temp);
740 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
741 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
742 l_NotifyErrorListSpy.clear();
743 QCOMPARE(l_NotifyRangeParmsSpy.count(), 0);
744 l_RangeParms_temp = Manager.GetRangeParms();
745 QVERIFY(l_RangeParms_temp == m_RangeParms);
746
747} // THM1176IM_Test03_Parameters::TestGetAfterSetError
748
751 void THM1176IM_Test03_Parameters::TestSetTriggerDuringContinuousMeasurement(void)
752{
753 // Create Signal Spies to retrieve measurement result, operating mode, and possible errors.
754 QSignalSpy l_NotifyMeasurementSpy(&Manager, SIGNAL(NotifyMeasurement(CMeasurement)));
755 QSignalSpy l_NotifyOperatingModeSpy(&Manager, SIGNAL(NotifyOperatingMode(eTHM1176OperatingMode)));
756 QSignalSpy l_NotifyTriggerParmsSpy(&Manager, SIGNAL(NotifyTriggerParms(sInputTrigger<uParm>)));
757 QSignalSpy l_NotifyErrorListSpy(&Manager, SIGNAL(NotifyErrorList(CErrorList)));
758
759 // Reset the instrument. This sets Trigger Parms to Immediate,1.
760 Manager.SetOperatingMode(kTHM1176Reset);
761
762 l_NotifyOperatingModeSpy.wait(THM1176_RESET_TIME);
763 QVERIFY(l_NotifyOperatingModeSpy.count() > 0);
764 m_Arguments = l_NotifyOperatingModeSpy.takeFirst();
765 m_OperatingMode = qvariant_cast<eTHM1176OperatingMode>(m_Arguments.at(0));
766 QCOMPARE(m_OperatingMode, kTHM1176Reset);
767 if (l_NotifyOperatingModeSpy.count() <= 0)
768 {
769 l_NotifyOperatingModeSpy.wait(THM1176_RESET_TIME);
770 QCOMPARE(l_NotifyOperatingModeSpy.count(), 1);
771 }
772 m_Arguments = l_NotifyOperatingModeSpy.takeFirst();
773 m_OperatingMode = qvariant_cast<eTHM1176OperatingMode>(m_Arguments.at(0));
774 QCOMPARE(m_OperatingMode, kTHM1176Idle);
775
776 // Set SetTriggerParms to Bus,1: should receive a notification.
777 sInputTrigger<uParm> l_Trigger_temp = { kInputTrigSrcBus, 0.1, 1 };
778 Manager.SetTriggerParms(l_Trigger_temp);
779
780 l_NotifyTriggerParmsSpy.wait(THM1176_CHANGE_PARM_TIME);
781 QCOMPARE(l_NotifyTriggerParmsSpy.count(), 1);
782 m_Arguments = l_NotifyTriggerParmsSpy.takeFirst();
783 m_Trigger = qvariant_cast<sInputTrigger<uParm>>(m_Arguments.at(0));
784 QVERIFY(l_Trigger_temp == m_Trigger);
785 QCOMPARE(l_NotifyErrorListSpy.count(), 0);
786
787 // Set Operating Mode to Measure,Continuous.
788 Manager.SetOperatingMode(kTHM1176MeasureContinuously);
789
790 l_NotifyOperatingModeSpy.wait(THM1176_MEASURE_TIME);
791 QCOMPARE(l_NotifyOperatingModeSpy.count(), 1);
792 m_Arguments = l_NotifyOperatingModeSpy.takeFirst();
793 m_OperatingMode = qvariant_cast<eTHM1176OperatingMode>(m_Arguments.at(0));
794 QCOMPARE(m_OperatingMode, kTHM1176MeasureContinuously);
795
796 // Set SetTriggerParms to Bus,1: should succeed (even though it doesn't do anything).
797 Manager.SetTriggerParms(l_Trigger_temp);
798
799 l_NotifyTriggerParmsSpy.wait(THM1176_CHANGE_PARM_TIME);
800 QCOMPARE(l_NotifyTriggerParmsSpy.count(), 0);
801 QCOMPARE(l_NotifyErrorListSpy.count(), 0);
802
803 // Try to set SetTriggerParms to Timer,0.1,1: should fail.
804 l_Trigger_temp = { kInputTrigSrcTimer, 0.1, 1 };
805 Manager.SetTriggerParms(l_Trigger_temp);
806
807 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
808 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
809 l_NotifyErrorListSpy.clear();
810 QCOMPARE(l_NotifyTriggerParmsSpy.count(), 0);
811 l_Trigger_temp = Manager.GetTriggerParms();
812 QVERIFY(l_Trigger_temp == m_Trigger);
813
814 // Set Operating Mode to Idle.
815 Manager.SetOperatingMode(kTHM1176Idle);
816
817 l_NotifyOperatingModeSpy.wait(THM1176_MEASURE_TIME);
818 QCOMPARE(l_NotifyOperatingModeSpy.count(), 1);
819 m_Arguments = l_NotifyOperatingModeSpy.takeFirst();
820 m_OperatingMode = qvariant_cast<eTHM1176OperatingMode>(m_Arguments.at(0));
821 QCOMPARE(m_OperatingMode, kTHM1176Idle);
822
823 QCOMPARE(l_NotifyErrorListSpy.count(), 0);
824
825} // THM1176IM_Test03_Parameters::TestSetTriggerDuringContinuousMeasurement
826
829 void THM1176IM_Test03_Parameters::TestSetAndGetAfterDisconnect(void)
830{
831 // Create Signal Spies to reset and retrieve parameters and possible errors.
832 QSignalSpy l_NotifyCurrentInstrumentSpy(&Manager, SIGNAL(NotifyCurrentInstrument(tResourceName)));
833 QSignalSpy l_NotifyOperatingModeSpy(&Manager, SIGNAL(NotifyOperatingMode(eTHM1176OperatingMode)));
834
835 QSignalSpy l_NotifyIdentificationSpy(&Manager, SIGNAL(NotifyIdentification(sIdentifier)));
836 QSignalSpy l_NotifyRangeListSpy(&Manager, SIGNAL(NotifyRangeList(CFluxList)));
837 QSignalSpy l_NotifyUnitsListSpy(&Manager, SIGNAL(NotifyUnitsList(CTHM1176UnitsList)));
838 QSignalSpy l_NotifyDivisorListSpy(&Manager, SIGNAL(NotifyDivisorList(CDivisorList)));
839 QSignalSpy l_NotifyAveragingParmBoundsSpy(&Manager, SIGNAL(NotifyAveragingParmBounds(sAveraging<sBoundedParm>)));
840 QSignalSpy l_NotifyTriggerParmBoundsSpy(&Manager, SIGNAL(NotifyTriggerParmBounds(sInputTrigger<sBoundedParm>)));
841 QSignalSpy l_NotifyRangeParmBoundsSpy(&Manager, SIGNAL(NotifyRangeParmBounds(sRange<sBoundedParm>)));
842
843 QSignalSpy l_NotifyAveragingParmsSpy(&Manager, SIGNAL(NotifyAveragingParms(sAveraging<uParm>)));
844 QSignalSpy l_NotifyTriggerParmsSpy(&Manager, SIGNAL(NotifyTriggerParms(sInputTrigger<uParm>)));
845 QSignalSpy l_NotifyOutputSelectSpy(&Manager, SIGNAL(NotifyOutputSelect(sArbitraryMeasurements)));
846 QSignalSpy l_NotifySleepParmSpy(&Manager, SIGNAL(NotifySleepParm(bool)));
847 QSignalSpy l_NotifyUnitsSpy(&Manager, SIGNAL(NotifyUnits(eTHM1176Units)));
848 QSignalSpy l_NotifyRangeParmsSpy(&Manager, SIGNAL(NotifyRangeParms(sRange<uParm>)));
849 QSignalSpy l_NotifyCommFormatSpy(&Manager, SIGNAL(NotifyCommFormat(eCommunicationFormat)));
850
851 QSignalSpy l_NotifyErrorListSpy(&Manager, SIGNAL(NotifyErrorList(CErrorList)));
852
853 // Disconnect the THM.
854 // Note: this test needs to run last!
855 Manager.SetOperatingMode(kTHM1176NotConnected);
856
857 // Wait for NotifyCommFormat, which should be the last Notify signal.
858 l_NotifyCommFormatSpy.wait(THM1176_CONNECT_TIME);
859 QCOMPARE(l_NotifyCommFormatSpy.count(), 1);
860 m_Arguments = l_NotifyCommFormatSpy.takeFirst();
861 m_CommFormat = qvariant_cast<eCommunicationFormat>(m_Arguments.at(0));
862 QCOMPARE(m_CommFormat, kComFormatAscii);
863
864 // Retrieve all the other notifications.
865 QCOMPARE(l_NotifyCurrentInstrumentSpy.count(), 1);
866 m_Arguments = l_NotifyCurrentInstrumentSpy.takeFirst();
867 m_THM1176Selected = qvariant_cast<tResourceName>(m_Arguments.at(0));
868 QVERIFY(m_THM1176Selected.empty());
869
870 QCOMPARE(l_NotifyOperatingModeSpy.count(), 1);
871 m_Arguments = l_NotifyOperatingModeSpy.takeFirst();
872 m_OperatingMode = qvariant_cast<eTHM1176OperatingMode>(m_Arguments.at(0));
873 QCOMPARE(m_OperatingMode, kTHM1176NotConnected);
874
875 QCOMPARE(l_NotifyIdentificationSpy.count(), 1);
876 m_Arguments = l_NotifyIdentificationSpy.takeFirst();
877 m_Identification = qvariant_cast<sIdentifier>(m_Arguments.at(0));
878 QVERIFY(m_Identification.Manufacturer.empty() && m_Identification.Model.empty() && m_Identification.SerialNumber == 0);
879
880 QCOMPARE(l_NotifyRangeListSpy.count(), 1);
881 m_Arguments = l_NotifyRangeListSpy.takeFirst();
882 m_RangeList = qvariant_cast<CFluxList>(m_Arguments.at(0));
883 QVERIFY(m_RangeList.empty());
884
885 QCOMPARE(l_NotifyUnitsListSpy.count(), 1);
886 m_Arguments = l_NotifyUnitsListSpy.takeFirst();
887 m_UnitsList = qvariant_cast<CTHM1176UnitsList>(m_Arguments.at(0));
888 QVERIFY(m_UnitsList.empty());
889
890 QCOMPARE(l_NotifyDivisorListSpy.count(), 1);
891 m_Arguments = l_NotifyDivisorListSpy.takeFirst();
892 m_DivisorList = qvariant_cast<CDivisorList>(m_Arguments.at(0));
893 QVERIFY(m_DivisorList.empty());
894
895 QCOMPARE(l_NotifyAveragingParmBoundsSpy.count(), 1);
896 m_Arguments = l_NotifyAveragingParmBoundsSpy.takeFirst();
897 m_AveragingBounds = qvariant_cast<sAveraging<sBoundedParm>>(m_Arguments.at(0));
898 QVERIFY(m_AveragingBounds.NoPoints.Val == 0 && m_AveragingBounds.NoPoints.Min == 0 &&
899 m_AveragingBounds.NoPoints.Max == 0 && m_AveragingBounds.NoPoints.Def == 0);
900
901 QCOMPARE(l_NotifyTriggerParmBoundsSpy.count(), 1);
902 m_Arguments = l_NotifyTriggerParmBoundsSpy.takeFirst();
903 m_TriggerBounds = qvariant_cast<sInputTrigger<sBoundedParm>>(m_Arguments.at(0));
904 QVERIFY(m_TriggerBounds.Period_s.Val == 0 && m_TriggerBounds.Period_s.Min == 0 &&
905 m_TriggerBounds.Period_s.Max == 0 && m_TriggerBounds.Period_s.Def == 0 &&
906 m_TriggerBounds.Count.Val == 0 && m_TriggerBounds.Count.Min == 0 &&
907 m_TriggerBounds.Count.Max == 0 && m_TriggerBounds.Count.Def == 0);
908
909 QCOMPARE(l_NotifyRangeParmBoundsSpy.count(), 1);
910 m_Arguments = l_NotifyRangeParmBoundsSpy.takeFirst();
911 m_RangeBounds = qvariant_cast<sRange<sBoundedParm>>(m_Arguments.at(0));
912 QVERIFY(m_RangeBounds.Range.Val == 0 && m_RangeBounds.Range.Min == 0 &&
913 m_RangeBounds.Range.Max == 0 && m_RangeBounds.Range.Def == 0);
914
915 QCOMPARE(l_NotifyAveragingParmsSpy.count(), 1);
916 m_Arguments = l_NotifyAveragingParmsSpy.takeFirst();
917 m_AveragingParms = qvariant_cast<sAveraging<uParm>>(m_Arguments.at(0));
918 QVERIFY(m_AveragingParms.NoPoints == 0);
919
920 QCOMPARE(l_NotifyTriggerParmsSpy.count(), 1);
921 m_Arguments = l_NotifyTriggerParmsSpy.takeFirst();
922 m_Trigger = qvariant_cast<sInputTrigger<uParm>>(m_Arguments.at(0));
923 QVERIFY(m_Trigger.Period_s == 0. && m_Trigger.Count == 0);
924
925 QCOMPARE(l_NotifyOutputSelectSpy.count(), 1);
926 m_Arguments = l_NotifyOutputSelectSpy.takeFirst();
927 m_OutputSelect = qvariant_cast<sArbitraryMeasurements>(m_Arguments.at(0));
928 QVERIFY(m_OutputSelect.Bx && m_OutputSelect.By && m_OutputSelect.Bz &&
929 m_OutputSelect.Temperature && m_OutputSelect.Timestamp &&
930 m_OutputSelect.NoMeasurements == 1);
931
932 QCOMPARE(l_NotifySleepParmSpy.count(), 1);
933 m_Arguments = l_NotifySleepParmSpy.takeFirst();
934 m_SleepParm = qvariant_cast<bool>(m_Arguments.at(0));
935 QVERIFY(!m_SleepParm);
936
937 QCOMPARE(l_NotifyUnitsSpy.count(), 1);
938 m_Arguments = l_NotifyUnitsSpy.takeFirst();
939 m_Units = qvariant_cast<eTHM1176Units>(m_Arguments.at(0));
940 QVERIFY(m_Units == MTL::kT);
941
942 QCOMPARE(l_NotifyRangeParmsSpy.count(), 1);
943 m_Arguments = l_NotifyRangeParmsSpy.takeFirst();
944 m_RangeParms = qvariant_cast<sRange<uParm>>(m_Arguments.at(0));
945 QVERIFY(!m_RangeParms.Auto && m_RangeParms.Range == 0.f);
946
947 // Try to Get the currently selected instrument: should succeed, but be empty.
948 tResourceName l_THM1176Selected_temp = Manager.GetCurrentInstrument();
949 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
950 QCOMPARE(l_NotifyErrorListSpy.count(), 0);
951 QVERIFY(l_THM1176Selected_temp.empty());
952
953 // Try to Get the Operating Mode, should succeed, but be Not Connected.
954 eTHM1176OperatingMode l_OperatingMode_temp = Manager.GetOperatingMode();
955 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
956 QCOMPARE(l_NotifyErrorListSpy.count(), 0);
957 QCOMPARE(l_OperatingMode_temp, kTHM1176NotConnected);
958
959 // Try to Get Measurement: should fail, returning an empty measurement.
960 CMeasurement l_Measurement_temp = Manager.GetMeasurement();
961 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
962 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
963 l_NotifyErrorListSpy.clear();
964 QCOMPARE(m_Measurement.Bx.size(), 0ul);
965 QCOMPARE(m_Measurement.By.size(), 0ul);
966 QCOMPARE(m_Measurement.Bz.size(), 0ul);
967 QCOMPARE(m_Measurement.Units, MTL::kT);
968 QVERIFY(m_Measurement.Temp == 0);
969 QCOMPARE(m_Measurement.TimestampList.size(), 0ul);
970 QCOMPARE(m_Measurement.Warnings.size(), 0ul);
971
972 // Try to Get Error List: should succeed, with last "Instrument not connected" error message.
973 CErrorList l_LatestErrors_temp = Manager.GetErrorList();
974 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
975 QCOMPARE(l_NotifyErrorListSpy.count(), 0);
976 QCOMPARE(l_LatestErrors_temp.size(), 1ul);
977
978 //Try to Get Instrument Identification: should fail, returning an empty structure.
979 sIdentifier l_Identification_temp = Manager.GetIdentification();
980 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
981 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
982 l_NotifyErrorListSpy.clear();
983 QVERIFY(l_Identification_temp == m_Identification);
984
985 // Try to Get Range List: should fail, returning an empty list.
986 CFluxList l_RangeList_temp = Manager.GetRangeList();
987 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
988 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
989 l_NotifyErrorListSpy.clear();
990 QVERIFY(l_RangeList_temp == m_RangeList);
991
992 // Try to Get Units List: should fail, returning an empty list.
993 CTHM1176UnitsList l_UnitsList_temp = Manager.GetUnitsList();
994 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
995 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
996 l_NotifyErrorListSpy.clear();
997 QVERIFY(l_UnitsList_temp == m_UnitsList);
998
999 // Try to Get Divisor List: should fail, returning an empty list.
1000 CDivisorList l_DivisorList_temp = Manager.GetDivisorList();
1001 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
1002 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
1003 l_NotifyErrorListSpy.clear();
1004 QVERIFY(l_DivisorList_temp == m_DivisorList);
1005
1006 // Try to get Averaging Parameter Bounds: should fail, returning an empty structure.
1007 sAveraging<sBoundedParm> l_AveragingBounds_temp = Manager.GetAveragingParmBounds();
1008 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
1009 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
1010 l_NotifyErrorListSpy.clear();
1011 QVERIFY(l_AveragingBounds_temp == m_AveragingBounds);
1012
1013 // Try to Get Trigger Parameter Bounds: should fail, returning an empty structure.
1014 sInputTrigger<sBoundedParm> l_TriggerBounds_temp = Manager.GetTriggerParmBounds();
1015 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
1016 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
1017 l_NotifyErrorListSpy.clear();
1018 QVERIFY(l_TriggerBounds_temp == m_TriggerBounds);
1019
1020 // Try to Get Range Parameter Bounds: should fail, returning an empty structure.
1021 sRange<sBoundedParm> l_RangeBounds_temp = Manager.GetRangeParmBounds();
1022 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
1023 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
1024 l_NotifyErrorListSpy.clear();
1025 QVERIFY(l_RangeBounds_temp == m_RangeBounds);
1026
1027 // Try to Set and Get Averaging parameters: should fail, with Get returning an empty structure.
1028 sAveraging<uParm> l_AveragingParms_temp = { 1 };
1029 Manager.SetAveragingParms(l_AveragingParms_temp);
1030 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
1031 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
1032 l_NotifyErrorListSpy.clear();
1033 QCOMPARE(l_NotifyAveragingParmsSpy.count(), 0);
1034
1035 l_AveragingParms_temp = Manager.GetAveragingParms();
1036 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
1037 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
1038 l_NotifyErrorListSpy.clear();
1039 QVERIFY(l_AveragingParms_temp == m_AveragingParms);
1040
1041 // Try to Set and Get Trigger parameters: should fail, with Get returning an empty structure.
1042 sInputTrigger<uParm> l_Trigger_temp = { kInputTrigSrcImmediate, 0.1, 1 };
1043 Manager.SetTriggerParms(l_Trigger_temp);
1044 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
1045 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
1046 l_NotifyErrorListSpy.clear();
1047 QCOMPARE(l_NotifyTriggerParmsSpy.count(), 0);
1048
1049 l_Trigger_temp = Manager.GetTriggerParms();
1050 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
1051 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
1052 l_NotifyErrorListSpy.clear();
1053 QVERIFY(l_Trigger_temp == m_Trigger);
1054
1055 // Try to Set and Get Output Selection parameters: should fail, with Get returning an empty structure.
1056 sArbitraryMeasurements l_OutputSelect_temp = { true, true, true, true, true, 1 };
1057 Manager.SetOutputSelect(l_OutputSelect_temp);
1058 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
1059 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
1060 l_NotifyErrorListSpy.clear();
1061 QCOMPARE(l_NotifyOutputSelectSpy.count(), 0);
1062
1063 l_OutputSelect_temp = Manager.GetOutputSelect();
1064 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
1065 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
1066 l_NotifyErrorListSpy.clear();
1067 QVERIFY(l_OutputSelect_temp == m_OutputSelect);
1068
1069 // Try to Set and Get Sleep parameter: should fail, with Get returning an empty structure.
1070 bool l_SleepParm_temp = !m_SleepParm;
1071 Manager.SetSleepParm(l_SleepParm_temp);
1072 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
1073 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
1074 l_NotifyErrorListSpy.clear();
1075 QCOMPARE(l_NotifySleepParmSpy.count(), 0);
1076
1077 l_SleepParm_temp = Manager.GetSleepParm();
1078 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
1079 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
1080 l_NotifyErrorListSpy.clear();
1081 QVERIFY(l_SleepParm_temp == m_SleepParm);
1082
1083 // Try to Set and Get Units: should fail, with Get returning an empty structure.
1084 eTHM1176Units l_Units_temp = MTL::kT;
1085 Manager.SetUnits(l_Units_temp);
1086 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
1087 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
1088 l_NotifyErrorListSpy.clear();
1089 QCOMPARE(l_NotifyUnitsSpy.count(), 0);
1090
1091 l_Units_temp = Manager.GetUnits();
1092 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
1093 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
1094 l_NotifyErrorListSpy.clear();
1095 QVERIFY(l_Units_temp == m_Units);
1096
1097 // Try to Set and Get Range parameters: should fail, with Get returning an empty structure.
1098 sRange<uParm> l_RangeParms_temp = { true, 0};
1099 Manager.SetRangeParms(l_RangeParms_temp);
1100 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
1101 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
1102 l_NotifyErrorListSpy.clear();
1103 QCOMPARE(l_NotifyRangeParmsSpy.count(), 0);
1104
1105 l_RangeParms_temp = Manager.GetRangeParms();
1106 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
1107 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
1108 l_NotifyErrorListSpy.clear();
1109 QVERIFY(l_RangeParms_temp == m_RangeParms);
1110
1111 // Try to Set and Get Communication Format parameter: should fail, with Get returning an empty structure.
1112 eCommunicationFormat l_CommFormat_temp = kComFormatPacked1Byte;
1113 Manager.SetCommFormat(l_CommFormat_temp);
1114 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
1115 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
1116 l_NotifyErrorListSpy.clear();
1117 QCOMPARE(l_NotifyCommFormatSpy.count(), 0);
1118
1119 l_CommFormat_temp = Manager.GetCommFormat();
1120 l_NotifyErrorListSpy.wait(THM1176_CHANGE_PARM_TIME);
1121 QCOMPARE(l_NotifyErrorListSpy.count(), 1);
1122 l_NotifyErrorListSpy.clear();
1123 QVERIFY(l_CommFormat_temp == m_CommFormat);
1124
1125} // THM1176IM_Test03_Parameters::TestSetAndGetAfterDisconnect
1126
1127//----------------------------------------------------------------------//
1128// main() //
1129//----------------------------------------------------------------------//
1130QTEST_MAIN(THM1176IM_Test03_Parameters)
1131
1132#include "THM1176IM_Test03_Parameters.moc"
CTHM1176InstrumentManager.h
Interface definition for Metrolab THM1176/TFM1186 Instrument Manager.
U16
unsigned short U16
16-bit unsigned integer.
Definition OSDefines.h:30
THM1176_PROMPT_TIME
#define THM1176_PROMPT_TIME
Definition THM1176IM_Test01_Connect.cpp:18
Manager
static CTHM1176InstrumentManager Manager
Definition THM1176IM_Test01_Connect.cpp:26
THM1176_CONNECT_TIME
#define THM1176_CONNECT_TIME
Definition THM1176IM_Test01_Connect.cpp:20
THM1176_BOOT_N_SCAN_TIME
#define THM1176_BOOT_N_SCAN_TIME
Definition THM1176IM_Test01_Connect.cpp:19
THM1176_CHANGE_PARM_TIME
#define THM1176_CHANGE_PARM_TIME
Definition THM1176IM_Test03_Parameters.cpp:22
Manager
static CTHM1176InstrumentManager Manager
Definition THM1176IM_Test03_Parameters.cpp:26
THM1176_CONNECT_TIME
#define THM1176_CONNECT_TIME
Definition THM1176IM_Test03_Parameters.cpp:21
THM1176_MEASURE_TIME
#define THM1176_MEASURE_TIME
Definition THM1176IM_Test03_Parameters.cpp:24
THM1176_RESET_TIME
#define THM1176_RESET_TIME
Definition THM1176IM_Test03_Parameters.cpp:23
PromptAndWait
static void PromptAndWait(std::string Prompt)
Definition THM1176IM_Test03_Parameters.cpp:31
MTL::CMeasurement
Data returned for one measurement.
Definition THM1176InstrumentManagerTypes.h:51
MTL::CTHM1176InstrumentManager
THM1176 Instrument Manager class: public interface.
Definition CTHM1176InstrumentManager.h:539
MTL::CTHM1176InstrumentManager::SetAveragingParms
void SetAveragingParms(sAveraging< uParm > AveragingParms)
Set the averaging parameters.
Definition CTHM1176InstrumentManager.cpp:1670
MTL::CTHM1176InstrumentManager::GetErrorList
CErrorList GetErrorList(void)
Get the current error list.
Definition CTHM1176InstrumentManager.cpp:1461
MTL::CTHM1176InstrumentManager::GetOutputSelect
sArbitraryMeasurements GetOutputSelect(void)
Get the output selection parameters.
Definition CTHM1176InstrumentManager.cpp:1543
MTL::CTHM1176InstrumentManager::SetSleepParm
void SetSleepParm(bool SleepParm)
Set the sleep parameter.
Definition CTHM1176InstrumentManager.cpp:1751
MTL::CTHM1176InstrumentManager::GetUnits
eTHM1176Units GetUnits(void)
Get the measurement units.
Definition CTHM1176InstrumentManager.cpp:1559
MTL::CTHM1176InstrumentManager::GetOperatingMode
eTHM1176OperatingMode GetOperatingMode(void)
Get the current operating mode.
Definition CTHM1176InstrumentManager.cpp:1439
MTL::CTHM1176InstrumentManager::GetTriggerParmBounds
sInputTrigger< sBoundedParm > GetTriggerParmBounds(void)
Get the bounds on trigger parameters.
Definition CTHM1176InstrumentManager.cpp:1509
MTL::CTHM1176InstrumentManager::SetOutputSelect
void SetOutputSelect(sArbitraryMeasurements OutputSelect)
Set the output selection parameters.
Definition CTHM1176InstrumentManager.cpp:1725
MTL::CTHM1176InstrumentManager::GetUnitsList
CTHM1176UnitsList GetUnitsList(void)
Get the list of valid measurement units for this instrument model.
Definition CTHM1176InstrumentManager.cpp:1485
MTL::CTHM1176InstrumentManager::GetMeasurement
CMeasurement GetMeasurement(void)
Get the last set of measurements.
Definition CTHM1176InstrumentManager.cpp:1453
MTL::CTHM1176InstrumentManager::GetTriggerParms
sInputTrigger< uParm > GetTriggerParms(void)
Get the trigger parameters.
Definition CTHM1176InstrumentManager.cpp:1535
MTL::CTHM1176InstrumentManager::GetCommFormat
eCommunicationFormat GetCommFormat(void)
Get the communication format parameters.
Definition CTHM1176InstrumentManager.cpp:1575
MTL::CTHM1176InstrumentManager::GetAveragingParms
sAveraging< uParm > GetAveragingParms(void)
Get the averaging parameters.
Definition CTHM1176InstrumentManager.cpp:1527
MTL::CTHM1176InstrumentManager::GetIdentification
sIdentifier GetIdentification(void)
Get the current instrument's identification information.
Definition CTHM1176InstrumentManager.cpp:1469
MTL::CTHM1176InstrumentManager::SetRangeParms
void SetRangeParms(sRange< uParm > RangeParms)
Set the range parameters.
Definition CTHM1176InstrumentManager.cpp:1798
MTL::CTHM1176InstrumentManager::GetSleepParm
bool GetSleepParm(void)
Get the sleep parameter.
Definition CTHM1176InstrumentManager.cpp:1551
MTL::CTHM1176InstrumentManager::SetOperatingMode
void SetOperatingMode(eTHM1176OperatingMode OperatingMode)
Set a new operating mode, for example to start measuring.
Definition CTHM1176InstrumentManager.cpp:1650
MTL::CTHM1176InstrumentManager::GetInstrumentList
CResourceList GetInstrumentList(void)
Get the list of connected instruments.
Definition CTHM1176InstrumentManager.cpp:1427
MTL::CTHM1176InstrumentManager::SetTriggerParms
void SetTriggerParms(sInputTrigger< uParm > TriggerParms)
Set the trigger parameters.
Definition CTHM1176InstrumentManager.cpp:1696
MTL::CTHM1176InstrumentManager::SetCommFormat
void SetCommFormat(eCommunicationFormat CommFormat)
Set the communication format parameters.
Definition CTHM1176InstrumentManager.cpp:1830
MTL::CTHM1176InstrumentManager::GetCurrentInstrument
tResourceName GetCurrentInstrument(void)
Get VISA resource name of currently connected instrument.
Definition CTHM1176InstrumentManager.cpp:1433
MTL::CTHM1176InstrumentManager::Stop
void Stop(void)
Shut down the THM1176 Instrument Manager.
Definition CTHM1176InstrumentManager.cpp:1181
MTL::CTHM1176InstrumentManager::GetRangeParms
sRange< uParm > GetRangeParms(void)
Get the range parameters.
Definition CTHM1176InstrumentManager.cpp:1567
MTL::CTHM1176InstrumentManager::GetRangeParmBounds
sRange< sBoundedParm > GetRangeParmBounds(void)
Get the bounds on range parameters.
Definition CTHM1176InstrumentManager.cpp:1517
MTL::CTHM1176InstrumentManager::GetAveragingParmBounds
sAveraging< sBoundedParm > GetAveragingParmBounds(void)
Get the bounds on averaging parameters.
Definition CTHM1176InstrumentManager.cpp:1501
MTL::CTHM1176InstrumentManager::GetDivisorList
CDivisorList GetDivisorList(void)
Get the list of divisors associated with each measurement unit for this instrument model.
Definition CTHM1176InstrumentManager.cpp:1493
MTL::CTHM1176InstrumentManager::GetRangeList
CFluxList GetRangeList(void)
Get list of valid ranges for this instrument model.
Definition CTHM1176InstrumentManager.cpp:1477
MTL::CTHM1176InstrumentManager::SetUnits
void SetUnits(eTHM1176Units Units)
Set the measurement units.
Definition CTHM1176InstrumentManager.cpp:1770
MTL::CTHM1176UnitsList
List of measurement units.
Definition THM1176InstrumentManagerTypes.h:46
MTL::Instrument::CResourceList
List of VISA resource names.
Definition IEEE488InstrumentTypes.h:26
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
THM1176IM_Test03_Parameters
Definition THM1176IM_Test03_Parameters.cpp:44
THM1176IM_Test03_Parameters::~THM1176IM_Test03_Parameters
~THM1176IM_Test03_Parameters()
Definition THM1176IM_Test03_Parameters.cpp:117
THM1176IM_Test03_Parameters::THM1176IM_Test03_Parameters
THM1176IM_Test03_Parameters()
Definition THM1176IM_Test03_Parameters.cpp:112
MTL::Instrument::THM1176Types::eCommunicationFormat
eCommunicationFormat
Enumeration of possible formats for returned data.
Definition THM1176Types.h:466
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::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::tResourceName
std::string tResourceName
IEEE488 resource name.
Definition IEEE488InstrumentTypes.h:22
MTL
Definition CTHM1176InstrumentManager.h:179
MTL::eTHM1176OperatingMode
eTHM1176OperatingMode
Operating modes used to initiate actions or provide status.
Definition THM1176InstrumentManagerTypes.h:17
MTL::kTHM1176Reset
@ kTHM1176Reset
Reset instrument.
Definition THM1176InstrumentManagerTypes.h:19
MTL::kTHM1176NotConnected
@ kTHM1176NotConnected
Disconnect instrument.
Definition THM1176InstrumentManagerTypes.h:18
MTL::kTHM1176MeasureContinuously
@ kTHM1176MeasureContinuously
Start a continuous measurement.
Definition THM1176InstrumentManagerTypes.h:22
MTL::kTHM1176Idle
@ kTHM1176Idle
Place the instrument in idle mode.
Definition THM1176InstrumentManagerTypes.h:20
MTL::eTHM1176Units
eTHM1176Units
Enumeration of possible measurement units, including "ADC".
Definition THM1176InstrumentManagerTypes.h:29
MTL::kT
@ kT
Tesla.
Definition THM1176InstrumentManagerTypes.h:30
MTL::kMHzp
@ kMHzp
Equivalent proton NMR resonant frequency, in Mega-Hertz.
Definition THM1176InstrumentManagerTypes.h:37
MTL::Instrument::THM1176Types::sArbitraryMeasurements
Specify the measurement data to be returned.
Definition THM1176Types.h:593
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::sBoundedParm::Val
DataType Val
Current value.
Definition THM1176Types.h:247
MTL::Instrument::THM1176Types::sBoundedParm::Max
DataType Max
Upper bound.
Definition THM1176Types.h:249
MTL::Instrument::THM1176Types::sBoundedParm::Min
DataType Min
Lower bound.
Definition THM1176Types.h:248
MTL::Instrument::THM1176Types::sBoundedParm::Def
DataType Def
Default value.
Definition THM1176Types.h:250
MTL::Instrument::THM1176Types::sIdentifier
Instrument's identification string - parsed version.
Definition THM1176Types.h:353
MTL::Instrument::THM1176Types::sIdentifier::Manufacturer
std::string Manufacturer
Manufacturer name ("Metrolab Technology SA").
Definition THM1176Types.h:354
MTL::Instrument::THM1176Types::sIdentifier::SerialNumber
U32 SerialNumber
Serial number.
Definition THM1176Types.h:356
MTL::Instrument::THM1176Types::sIdentifier::Model
std::string Model
Model name (e.g. "THM1176-MF").
Definition THM1176Types.h:355
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::Period_s
ParmType< F64 > Period_s
Trigger period, for timed trigger.
Definition THM1176Types.h:428
MTL::Instrument::THM1176Types::sRange
Measurement range parameter.
Definition THM1176Types.h:479
MTL::Instrument::THM1176Types::sRange::Range
ParmType< tFlux > Range
Measurement range, if auto-ranging is not enabled.
Definition THM1176Types.h:481