C++ Instrument Catalog
PT2026.h
Go to the documentation of this file.
1 
8 
9 #pragma once
10 
11 // Standard includes
12 #include <ctime>
13 #include <queue>
14 
15 // Personal includes
16 #include "VISAInstrument.h"
17 #include "PT2026Types.h"
18 
19 // Version
20 #define PT2026_CPP_DRIVER_BCD_VERSION 0x0104
21 
22 using namespace MTL::Instrument::PT2026Types;
23 
24 namespace MTL {
25  namespace Instrument {
26 
29  {
30  //----------------------------------------------------------------------//
31  // Private Attributes //
32  //----------------------------------------------------------------------//
33  private:
34  // General
35  ViUInt32 m_Timeout_ms;
36  std::queue<sError> m_ErrorList;
37  CVISABuffer m_ReadBuffer;
38  //----------------------------------------------------------------------//
39  // Utilities //
40  //----------------------------------------------------------------------//
41  private:
42  bool l_GetErrorList(const std::string & rContext);
43  bool l_WriteAndRead(const std::string & rWriteStr, CVISABuffer & rReadBuffer, bool WaitForMAV = false);
44 
45  //----------------------------------------------------------------------//
46  // PT2026 Interface //
47  //----------------------------------------------------------------------//
48  public:
52 
53  //----------------------------------------------------------------------//
54  // Constructors / destructors
56  virtual ~CPT2026Instrument();
57 
63 
64  //----------------------------------------------------------------------//
65  // General Information
66  const std::vector<sError> ErrorList();
67 
69 
75 
76  //----------------------------------------------------------------------//
77  // Open / Close
78  bool Connect(U32 InitialTimeout_ms);
79  void Disconnect();
80 
82 
91 
92  //----------------------------------------------------------------------//
93  // Interface lock
94  bool LockInterface();
95  bool UnlockInterface();
96 
98 
104 
105  //----------------------------------------------------------------------//
106  // Channels
107  bool ChannelsGetList(MTL::SCPI::tChannelList & rChanList);
108  bool ChannelsGetList(CExtendedChannelList & rChanList);
109  bool ChannelsGetState(MTL::SCPI::tChannelList & rSelChanList, MTL::SCPI::tChannelList & rActiveChan);
110  bool ChannelsSetLimitedListState(bool State);
111  bool ChannelsGetLimitedListState(bool & rState);
112  bool ChannelsSelect(const MTL::SCPI::tChannelList & rChanList);
113  bool ChannelsGetInfo(const MTL::SCPI::tChannelList & rChanList, std::vector<sChannelIformation> & rChanInfo);
114  bool ChannelsGetLimits(const MTL::SCPI::tChannelList & rChanList, std::vector<F64> & rLowLimit_UNITS, std::vector<F64> & rHighLimit_UNITS);
115 
116  bool ChannelGetRawHall(sProbeRawHall & rRawHall);
117  bool ChannelGetHall(sProbeHall & rHall);
118 
119  bool ChannelGetRemoteLEDMode(eRemoteBusyLEDmode & rMode);
120  bool ChannelSetRemoteLEDMode(eRemoteBusyLEDmode Mode);
121 
123 
124  //----------------------------------------------------------------------//
125  // Parameters
126 
139 
140  // Search
141  bool ParmSearchSet(const sSearch<uParm> & rSearch);
142  bool ParmSearchGet(sSearch<uParm> & rSearch);
143  bool ParmSearchGet(sSearch<sBoundedParm> & rSearch);
144 
145  bool ParmSearchSetManualValue(F64 ManualValue_UNITS);
146  bool ParmSearchSetLimits(F64 LowLimit_UNITS, F64 HighLimit_UNITS);
147  bool ParmSearchSetHallEnable(bool Enabled);
148  bool ParmSearchGetHallEnable(bool & rEnabled);
149 
155 
156  // Measure
157  bool ParmMeasureSet(const sMeasure<uParm> & rMeasure);
158  bool ParmMeasureGet(sMeasure<uParm> & rMeasure);
159  bool ParmMeasureGet(sMeasure<sBoundedParm> & rMeasure);
160 
173 
174  // Averaging
175  bool ParmAveragingSignalSet(const sSignalAveraging<uParm> & rSigAvg);
176  bool ParmAveragingSignalGet(sSignalAveraging<uParm> & rSigAvg);
177  bool ParmAveragingSignalGet(sSignalAveraging<sBoundedParm> & rSigAvg);
178  bool ParmAveragingMeasurementSet(const sMeasurementAveraging<uParm> & rMeasAvg);
179  bool ParmAveragingMeasurementGet(sMeasurementAveraging<uParm> & rMeasAvg);
180  bool ParmAveragingMeasurementGet(sMeasurementAveraging<sBoundedParm> & rMeasAvg);
181 
189 
190  // Input Trigger
191  bool ParmTriggerInputSet(const sInputTrigger<uParm> & rInputTrig);
192  bool ParmTriggerInputGet(sInputTrigger<uParm> & rInputTrig);
193  bool ParmTriggerInputGet(sInputTrigger<sBoundedParm> & rInputTrig);
194 
203 
204  // Output Trigger
205  bool ParmTriggerOutputSet(const sOutputTrigger<uParm> & rOutputTrig);
206  bool ParmTriggerOutputGet(sOutputTrigger<uParm> & rOutputTrig);
207  bool ParmTriggerOutputGet(sOutputTrigger<sBoundedParm> & rOutputTrig);
208 
218 
219  // RF Pulse
220  bool ParmRFPulseSet(const sPulse<uParm> & rPulse);
221  bool ParmRFPulseGet(sPulse<uParm> & rPulse);
222  bool ParmRFPulseGet(sPulse<sBoundedParm> & rPulse);
223 
232 
233  // Digitization
234  bool ParmDigitizationSet(const sDigitization<uParm> & rDigitization);
235  bool ParmDigitizationGet(sDigitization<uParm> & rDigitization);
236  bool ParmDigitizationGet(sDigitization<sBoundedParm> & rDigitization);
237 
245 
246  // Matching / Tuning
247  bool ParmMatchingTuningSet(const sMatchingTuning<uParm> & rMatchingTuning);
248  bool ParmMatchingTuningGet(sMatchingTuning<uParm> & rMatchingTuning);
249  bool ParmMatchingTuningGet(sMatchingTuning<sBoundedParm> & rMatchingTuning);
250 
260 
261  // Units
262  bool ParmUnitsSet(eUnits Units);
263  bool ParmUnitsSetPPMRef(tPPMReference_UNITS Ref);
264  bool ParmUnitsGet(eUnits & rUnits, tPPMReference_UNITS & rRef);
265 
272 
273  // Ref Clock
274  bool ParmRefClockSet(eReferenceClock RefClock);
275  bool ParmRefClockGet(eReferenceClock & rRefClock);
276 
278 
284 
285  // Communication : USB
286  bool ParmComUsbSet(bool Enabled);
287  bool ParmComUsbGet(bool & rEnabled);
288 
295 
296  // Communication : Ethernet
297  bool ParmComEthernetSet(const sEthernet & rSettings);
298  bool ParmComEthernetGet(sEthernet & rSettings);
299 
306 
307  // Communication : VXI11
308  bool ParmComVXI11Set(bool Enabled);
309  bool ParmComVXI11Get(bool & rEnabled);
310 
313 
314  // Settings / Files
318 
319  //----------------------------------------------------------------------//
320  // Settings / Files
321  bool ReadFileDirectory(U32 & rUsedBytes, U32 & rAvailableBytes, tFileList & rFileList);
322  bool ReadFile(std::string Path, std::string & rContent);
323  bool WriteFile(std::string Path, const std::string & rContent);
324  bool DeleteFile(std::string Path);
325  bool GetSettingFileList(std::vector<std::string> & rSettingFileList);
326  bool SaveSettings(eSettingType Type, std::string Name);
327  bool RecallSettings(std::string Name);
328 
330 
335 
336  //----------------------------------------------------------------------//
337  // Initiate / Abort / Trigger
338  bool Initiate(bool Continuous = false);
339  bool Abort(bool CancelContinuous = true);
340  bool SendBusTrigger();
341  bool ForceOutputTrigger();
342 
344 
348 
349  //----------------------------------------------------------------------//
350  // Measurements / Data
351  bool MeasurementsGet(U32 NoMeasurements, std::vector<tFlux> & rFlux, eUnits & rUnits);
352  bool MeasurementsGet(U32 NoMeasurements, sArbitraryMeasurements ArbSelect, sAllMeasurements & rMeas, eUnits & rUnits);
353  bool GetSearchProgress(U8 & rSPR, F64 & rHallMeasurement_UNITS);
354  bool SetFormat(eCommunicationFormat Format);
355 
357 
358  //----------------------------------------------------------------------//
359  // High Level Measurement
360  //bool Measure(tFlux & rFlux, MTL::SCPI::tChannelList ChanList, F64 ExpectedField = 0, unsigned int NoDigits = 0);
361  //bool Measure(std::vector<tFlux> & rFluxArray, unsigned int NoMeasurements, MTL::SCPI::tChannelList ChanList, F64 ExpectedField = 0, unsigned int NoDigits = 0);
362 
367 
368  //----------------------------------------------------------------------//
369  // Status Handling
370  bool StatusPreset();
371  bool StatusGet(sStatusRegister Reg, U16 & rStatus);
372  bool StatusGet(std::vector<sStatusRegister> Regs, std::vector<U16> & rStatus);
373  bool StatusSetEnableRegister(eStatusRegisterSet Set, U16 DisableMask, U16 EnableMask);
374  bool StatusSetTransitionFilter(eStatusRegisterSet Set, eTransition Transition, U16 ClearMask, U16 SetMask);
375  bool StandardStatusSetEnableRegister(eStandardStatusRegister Set, U16 DisableMask, U16 EnableMask);
376 
378 
381 
382  //----------------------------------------------------------------------//
383  // Utilities
384  bool GetIdentification(std::string & rIdentification);
385  bool PowerOff(bool Reboot = false);
386  bool Reset();
387  bool ReadCaseTemperature(F32 & rTemperatureDegC);
388  bool SwitchToDFUMode();
389  bool ReadDebugLog(std::string & rDebugLog);
390  bool ReadInformationDates(std::string & rSManufacturingDate, std::time_t & rManufacturingDate, std::string & rSCalibrationDate, std::time_t & rCalibrationDate);
391 
393 
394  // Low Level Utilities
397 
398  //----------------------------------------------------------------------//
399  // Low Level Utilities
400  bool DeviceROMRead(const MTL::SCPI::tChannel & rChannel, std::vector<U8> & rROMContent);
401  bool DeviceROMWrite(const MTL::SCPI::tChannel & rChannel, const std::vector<U8> & rROMContent);
402  bool NormalizationGet(const MTL::SCPI::tChannel & rChannel, tNormalizationTable & rNormalizationTable);
403  bool NormalizationSet(const MTL::SCPI::tChannel & rChannel, const tNormalizationTable & rNormalizationTable);
404  bool LowLevelTransfer(const std::vector<U8> & rDataToSend, std::vector<U8> & rRcvdData, U8 & rReturnedStatus);
405  bool WriteCustomCommand(const std::string & rWriteStr);
406 
408  };
409 
410  } // namespace Instrument
411 } // namespace MTL
MTL::Instrument::PT2026Types::sDigitization
Definition: PT2026Types.h:229
MTL::Instrument::PT2026Types::sStatusRegister
Definition: PT2026Types.h:34
MTL::Instrument::PT2026Types::sProbeHall
Definition: PT2026Types.h:479
MTL::SCPI::tChannelList
std::vector< tChannel > tChannelList
SCPI channel list
Definition: SCPIParsing.h:26
MTL::Instrument::PT2026Types::sEthernet
Definition: PT2026Types.h:371
MTL::Instrument::PT2026Types::eSettingType
eSettingType
Definition: PT2026Types.h:525
MTL::Instrument::PT2026Types
Definition: PT2026TypeConversions.h:13
MTL::Instrument::PT2026Types::eStatusRegisterSet
eStatusRegisterSet
Definition: PT2026Types.h:22
MTL::Instrument::PT2026Types::sSearch
Definition: PT2026Types.h:333
MTL::Instrument::PT2026Types::eReferenceClock
eReferenceClock
Definition: PT2026Types.h:348
MTL::Instrument::PT2026Types::eUnits
eUnits
Definition: PT2026Types.h:156
MTL::Instrument::CPT2026Instrument
PT2026 instrument class.
Definition: PT2026.h:28
MTL::Instrument::PT2026Types::sMeasurementAveraging
Definition: PT2026Types.h:217
MTL::Instrument::PT2026Types::sMatchingTuning
Definition: PT2026Types.h:306
MTL::SCPI::tChannel
std::vector< unsigned char > tChannel
SCPI channel
Definition: SCPIParsing.h:25
MTL::Instrument::PT2026Types::sOutputTrigger
Definition: PT2026Types.h:268
MTL::Instrument::PT2026Types::eCommunicationFormat
eCommunicationFormat
Definition: PT2026Types.h:355
MTL::Instrument::PT2026Types::sPulse
Definition: PT2026Types.h:319
MTL::Instrument::PT2026Types::eTransition
eTransition
Definition: PT2026Types.h:40
MTL::Instrument::PT2026Types::sSignalAveraging
Definition: PT2026Types.h:205
MTL
Definition: CPT2026PeripheralROM.h:19
MTL::Instrument::PT2026Types::tFileList
std::vector< sFile > tFileList
Definition: PT2026Types.h:524
MTL::Instrument::PT2026Types::eRemoteBusyLEDmode
eRemoteBusyLEDmode
Definition: PT2026Types.h:507
MTL::Instrument::PT2026Types::sArbitraryMeasurements
Definition: PT2026Types.h:617
PT2026Types.h
MTL::Instrument::PT2026Types::sAllMeasurements
Definition: PT2026Types.h:633
MTL::Instrument::PT2026Types::tPPMReference_UNITS
F64 tPPMReference_UNITS
Definition: PT2026Types.h:344
MTL::Instrument::tResourceName
std::string tResourceName
Definition: VISAInstrumentTypes.h:21
MTL::Instrument::CVISABuffer
Definition: VISAInstrumentBuffer.h:37
MTL::Instrument::PT2026Types::sMeasure
Definition: PT2026Types.h:289
VISAInstrument.h
C++ wrapper for NI-VISA: interface definition.
MTL::Instrument::PT2026Types::CExtendedChannelList
Definition: PT2026Types.h:446
MTL::Instrument::CVISAInstrument
VISA instrument class.
Definition: VISAInstrument.h:60
MTL::Instrument::PT2026Types::eStandardStatusRegister
eStandardStatusRegister
Definition: PT2026Types.h:18
MTL::Instrument::PT2026Types::sProbeRawHall
Definition: PT2026Types.h:492
MTL::Instrument::CVISAResourceManager
VISA Resource Manager class.
Definition: VISAInstrument.h:35
MTL::Instrument::PT2026Types::tNormalizationTable
std::vector< tNormalizationFactor_Hz > tNormalizationTable
Definition: PT2026Types.h:667
MTL::Instrument::PT2026Types::sInputTrigger
Definition: PT2026Types.h:250