C++ Instrument Catalog
MFC2x46Device.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 // Standard includes
9 #include <string>
10 // Personal includes
11 #include "VISAInstrument.h"
12 #include "PT2026.h"
13 #include "MFCDevice.h"
14 #include "InstrumentCatalog.h"
15 #include "MFCController.h"
16 #include "Helpers.h"
17 
18 
19 using namespace MTL;
20 using namespace MTL::Instrument;
21 
22 namespace MTL {
23 
24  //--------------------------------------------------------------------------//
25  // MFC2x46 Device (PT2026 + MFC9046 or MFC9146)
26  //--------------------------------------------------------------------------//
27 
28  class CMFC2x46Device: public CMFCDevice
29  {
30  //--------------------------------------------------------------------------//
31  // Attributes
32  //--------------------------------------------------------------------------//
33  private:
34  CMFCController & m_rMFCController;
35  CPT2026Instrument m_PT2026;
36  CExtendedChannelList m_ChanList;
37  SCPI::tChannel m_PAChannel;
38  U8 m_NbOfSearchHeads = 0;
39  U8 m_NbOfMeasHeads = 0;
40  U8 m_NbOfMeasurementsToFetch = 0;
41  CInstrumentCatalog::sInstrumentState m_LastConfigured;
42 
43  std::string m_DefaultPAConfScriptFilePath; // Path of the default PA configuration script (if no specific file exists)
44  std::string m_CustomPAConfScriptDirectory; // Directory containing PA specific configuration scripts
45 
46  //constants:
47  const int SEARCH_POLLING_PERIOD_MS = 100;
48  const int MEAS_POLLING_PERIOD_MS = 50;
49  const eUnits UNITS = kMHz;
50 
51  //--------------------------------------------------------------------------//
52  // Constructor / Destructor
53  //--------------------------------------------------------------------------//
54  public:
55  CMFC2x46Device (CMFCController & rMFCController, CVISAResourceManager & rRM, tResourceName Rsrc,
56  const std::string & rDefaultPAConfScriptFilePath,
57  const std::string & rCustomPAConfScriptDir);
58  virtual ~CMFC2x46Device ();
59 
60  //--------------------------------------------------------------------------//
61  // Utilities
62  //--------------------------------------------------------------------------//
63  private:
64  bool l_UtcToStrDateISO8601(const std::time_t & rUtcDate, std::string & rStrDate);
65  bool l_ExecuteConfigurationScript (U16 Model, U32 SN, CMFC2x46Device::sMFCDeviceError & rError);
66  bool l_ConfigurationChanged (CInstrumentCatalog::sInstrumentState lastcfg, CInstrumentCatalog::sInstrumentState newcfg);
67  bool l_ConfigureForOperation (const CInstrumentCatalog::sInstrumentState & rInstrState, CMFC2x46Device::sMFCDeviceError & rError);
68  void l_ComputeAveraging (const std::vector<tFlux> & rFluxList, F64 & rReturnedAveraging, F64 & rReturnedStdDev);
69  public:
70  bool AbortInstrument ();
71  bool IsInstrumentConnected();
72 
73  //--------------------------------------------------------------------------//
74  // Available Operations
75  //--------------------------------------------------------------------------//
76  public:
79  CInstrumentCatalog::sInstrumentConfiguration & rInstrConfig, bool & rPaInfoChanged);
80  sMFCDeviceError Search (const CInstrumentCatalog::sInstrumentState & rInstrState);
81  sMFCDeviceError Measure (const CInstrumentCatalog::sInstrumentState & rInstrState);
82  sMFCDeviceError NewNormalizationRequest ( const CInstrumentCatalog::sNormalization & rNewNormalizationRequest,
83  CInstrumentCatalog::sNormalization & rReturnedNormalization);
84  sMFCDeviceError GetNormalizationDate(CInstrumentCatalog::tISO8601DateTime & rNormDate);
85  sMFCDeviceError SetRBBusyLedState (const CInstrumentCatalog::eRemoteBoxBusyLedState & rRBBusyLedState);
86  sMFCDeviceError RemoteBoxButtonStatus (bool & rRemoteStartPressed);
87  sMFCDeviceError ChangeSerialParmsOnConnectedInstr(const CInstrumentCatalog::sMFC3045SerialPortSettings & rNewSerialSetting); //We don't use it for M2x46Device
88 
89  }; // class
90 } // namespace MTL
MTL::CInstrumentCatalog::tISO8601DateTime
std::string tISO8601DateTime
Definition: InstrumentCatalog.h:28
MTL::Instrument::PT2026Types::eUnits
eUnits
Definition: PT2026Types.h:156
PT2026.h
Interface definition for C++ API for Metrolab PT2026.
MTL::Instrument::CPT2026Instrument
PT2026 instrument class.
Definition: PT2026.h:28
MTL::SCPI::tChannel
std::vector< unsigned char > tChannel
SCPI channel
Definition: SCPIParsing.h:25
Helpers.h
Collection of utility macros for error messages.
MTL::CInstrumentCatalog::sInstrumentState
Definition: InstrumentCatalog.h:212
MTL::CMFCDevice::sMFCDeviceError
Definition: MFCDevice.h:30
MTL::CInstrumentCatalog::sMFC3045SerialPortSettings
Definition: InstrumentCatalog.h:81
MTL
Definition: CPT2026PeripheralROM.h:19
MTL::Instrument
Definition: MFC3045.h:25
MTL::CMFCDevice
Definition: MFCDevice.h:24
MTL::CInstrumentCatalog::eRemoteBoxBusyLedState
eRemoteBoxBusyLedState
Definition: InstrumentCatalog.h:242
MTL::CInstrumentCatalog::sProbeArrayInformation
Definition: InstrumentCatalog.h:145
InstrumentCatalog.h
MFCController.h
MTL::Instrument::tResourceName
std::string tResourceName
Definition: VISAInstrumentTypes.h:21
MTL::CMFCController
Definition: MFCController.h:34
MTL::CMFC2x46Device
Definition: MFC2x46Device.h:28
VISAInstrument.h
C++ wrapper for NI-VISA: interface definition.
MTL::Instrument::PT2026Types::kMHz
@ kMHz
Definition: PT2026Types.h:157
MTL::Instrument::PT2026Types::CExtendedChannelList
Definition: PT2026Types.h:446
MTL::CInstrumentCatalog::sInstrumentInformation
Definition: InstrumentCatalog.h:106
MTL::Instrument::CVISAResourceManager
VISA Resource Manager class.
Definition: VISAInstrument.h:35
MTL::CInstrumentCatalog::sInstrumentConfiguration
Definition: InstrumentCatalog.h:116
MTL::CInstrumentCatalog::sNormalization
Definition: InstrumentCatalog.h:282
MFCDevice.h