C++ Instrument Catalog
MFCDevice.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 "Helpers.h"
13 #include "InstrumentCatalog.h"
14 
15 using namespace MTL;
16 using namespace MTL::Instrument;
17 
18 namespace MTL {
19 
20  //--------------------------------------------------------------------------//
21  // MFC Device
22  //--------------------------------------------------------------------------//
23 
24  class CMFCDevice
25  {
26  //----------------------------------------------------------------------//
27  // Types //
28  //----------------------------------------------------------------------//
29  public:
30  struct sMFCDeviceError {
31  enum eLevel {
32  kFatal = 1, // Fatal error. Should not occur, program may crash
33  kError = 2, // Error. The requested operation cannot keep executing
34  kWarning = 3, // Warning. An error occured but requested operation will continue to execute
35  kNoError = 4 // No error
36  } Level;
37  std::string Description;
38  std::string Location;
40  : Level(kError), Description(""), Location("")
41  {}
42  sMFCDeviceError(eLevel ErrLevel, std::string ErrDesc = "", std::string Loc = "")
43  : Level(ErrLevel), Description(ErrDesc), Location(Loc)
44  {}
45  bool HasError()
46  {
47  return (kNoError != Level);
48  }
49  operator bool() const // return true if no Error!
50  {
51  return (kNoError == Level);
52  }
53  };
54 
55  //--------------------------------------------------------------------------//
56  // Constructor / Destructor
57  //--------------------------------------------------------------------------//
58  public:
59  virtual ~CMFCDevice();
60 
61  //--------------------------------------------------------------------------//
62  // Utilities
63  //--------------------------------------------------------------------------//
64  public:
65  bool Is(const CMFCDevice * pDevice);
66  virtual bool AbortInstrument() = 0;
67  virtual bool IsInstrumentConnected() =0 ;
68 
69  //--------------------------------------------------------------------------//
70  // Available Operations
71  //--------------------------------------------------------------------------//
72  public:
73  virtual sMFCDeviceError Connect( CInstrumentCatalog::sInstrumentInformation & rInstrInfo) = 0;
74  virtual sMFCDeviceError ScanPA( CInstrumentCatalog::sProbeArrayInformation & rPAInfo,
75  CInstrumentCatalog::sInstrumentConfiguration & rInstrConfig, bool &rPaInfoChanged) = 0;
76  virtual sMFCDeviceError Search(const CInstrumentCatalog::sInstrumentState & rInstrState) = 0;
77  virtual sMFCDeviceError Measure(const CInstrumentCatalog::sInstrumentState & rInstrState) = 0;
78  virtual sMFCDeviceError NewNormalizationRequest( const CInstrumentCatalog::sNormalization & rNewNormalizationRequest,
79  CInstrumentCatalog::sNormalization & rReturnedNormalization) = 0;
80  virtual sMFCDeviceError GetNormalizationDate(CInstrumentCatalog::tISO8601DateTime & rNormDate)=0;
81  virtual sMFCDeviceError SetRBBusyLedState(const CInstrumentCatalog::eRemoteBoxBusyLedState & rRBBusyLedState) = 0;
82  virtual sMFCDeviceError RemoteBoxButtonStatus(bool & rRemoteStartPressed) = 0;
83  virtual sMFCDeviceError ChangeSerialParmsOnConnectedInstr(const CInstrumentCatalog::sMFC3045SerialPortSettings & rNewSerialSetting) = 0;
84 
85  }; // class
86 
87 } // namespace MTL
MTL::CInstrumentCatalog::tISO8601DateTime
std::string tISO8601DateTime
Definition: InstrumentCatalog.h:28
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::CMFCDevice::sMFCDeviceError::sMFCDeviceError
sMFCDeviceError()
Definition: MFCDevice.h:39
MTL::Instrument
Definition: MFC3045.h:25
MTL::CMFCDevice
Definition: MFCDevice.h:24
MTL::CInstrumentCatalog::eRemoteBoxBusyLedState
eRemoteBoxBusyLedState
Definition: InstrumentCatalog.h:242
MTL::CMFCDevice::sMFCDeviceError::Description
std::string Description
Definition: MFCDevice.h:37
MTL::CMFCDevice::sMFCDeviceError::Location
std::string Location
Definition: MFCDevice.h:38
MTL::CInstrumentCatalog::sProbeArrayInformation
Definition: InstrumentCatalog.h:145
MTL::CMFCDevice::sMFCDeviceError::HasError
bool HasError()
Definition: MFCDevice.h:45
InstrumentCatalog.h
MTL::CMFCDevice::sMFCDeviceError::eLevel
eLevel
Definition: MFCDevice.h:31
VISAInstrument.h
C++ wrapper for NI-VISA: interface definition.
MTL::CInstrumentCatalog::sInstrumentInformation
Definition: InstrumentCatalog.h:106
MTL::CMFCDevice::sMFCDeviceError::sMFCDeviceError
sMFCDeviceError(eLevel ErrLevel, std::string ErrDesc="", std::string Loc="")
Definition: MFCDevice.h:42
MTL::CInstrumentCatalog::sInstrumentConfiguration
Definition: InstrumentCatalog.h:116
MTL::CInstrumentCatalog::sNormalization
Definition: InstrumentCatalog.h:282