LdmrsSopasLayer.hpp
Go to the documentation of this file.
1 //
2 // LdmrsSopasLayer.hpp
3 //
4 #ifndef LDMRSSOPASLAYER_HPP
5 #define LDMRSSOPASLAYER_HPP
6 
7 #include "../BasicDatatypes.hpp"
8 #include "../manager.hpp"
9 #include "../interfaces/tcp.hpp"
10 #include "SopasBase.hpp"
11 #include "../datatypes/EvalCase.hpp"
12 #include "../datatypes/EvalCases.hpp"
13 #include "../datatypes/EvalCaseResults.hpp"
14 #include "../datatypes/FieldParameter.hpp"
15 #include "../datatypes/Fields.hpp"
16 #include "../datatypes/SensorStateInfo.hpp"
17 
18 // Note that this is not a device, but a device helper class
19 namespace devices
20 {
21 
22 using namespace datatypes;
23 
24 // *********************** LDMRSSopasLayer **************************** //
25 
26 
28 {
29 public:
30  LdmrsSopasLayer(Manager* manager,
31  const UINT8 deviceID,
32  std::string ipAddress,
33  UINT16 portNumber,
34  bool weWantFieldData,
35  bool weWantScanData,
36  bool readOnlyMode);
37 
38  virtual ~LdmrsSopasLayer();
39 
40  bool init(Tcp::DisconnectFunction function, void* obj); // UINT32 ipAddress, UINT16 portNumber, bool weWantFieldData, bool readOnlyMode, Tcp::DisconnectFunction function);
41  bool run();
42 
43  // commands supported by LD-MRS
44  bool action_login();
45  bool action_logout();
46  bool action_subscribeEvalCaseResults();
47  bool action_unSubscribeEvalCaseResults();
48  bool action_subscribeScanData();
49  bool action_unSubscribeScanData();
50  bool action_startMeasure();
51  bool action_stopMeasure();
52  bool action_readFields();
53  bool action_readEvalCases();
54  bool action_readSerialNumber();
55  bool action_readScanConfig();
56  bool action_writeField(UINT16 fieldNum, const FieldParameter& para);
57  bool action_writeEvalCases(const EvalCases& evalCases);
58  bool action_flashFieldParameters();
59  bool action_flashMrsParameters();
60  bool isFieldDataSubscribed() const
61  {
62  return m_fieldEventIsRegistered;
63  }
64 
65 // SensorStateInfo getSensorStateInfo();
66 
67 protected:
68 
70  {
71  ScanFreq1250 = 0,
72  ScanFreq2500 = 1,
73  ScanFreq5000 = 2
74  };
75 
76  // ATTENTION: Assignment can be wrong after protocol change (see SRT/VarRep.h)
78  {
79  index_var_DeviceIdent = 0x00,
80  index_var_SOPASVersion = 0x01,
81  index_var_LocationName = 0x02,
82  index_var_SerialNumber = 0x03,
83  index_var_FirmwareVersion = 0x04,
84  index_var_Scanning = 0x05,
85  index_var_SopasInfo = 0x06,
86  index_var_InternalFeedback = 0x07,
87  index_var_TestScanFrequency = 0x08,
88  index_var_CIDChecksum = 0x09,
89  index_var_TestScanActive = 0x0a,
90  index_var_ScanDataConfig = 0x0b,
91  index_var_AngleDataConfig = 0x0c,
92  index_var_LayerEchoConfig = 0x0d,
93  index_var_ScanConfig = 0x0e,
94  index_var_MeasMode = 0x0f,
95  index_var_ApplRange = 0x10,
96  index_var_DataOutputRange = 0x11,
97  index_var_AutoStartMeasure = 0x12,
98  index_var_field000 = 0x003d,
99  index_var_field001 = 0x003e,
100  index_var_field002 = 0x003f,
101  index_var_field003 = 0x0040,
102  index_var_field004 = 0x0041,
103  index_var_field005 = 0x0042,
104  index_var_field006 = 0x0043,
105  index_var_field007 = 0x0044,
106  index_var_field008 = 0x0045,
107  index_var_field009 = 0x0046,
108  index_var_field010 = 0x0047,
109  index_var_field011 = 0x0048,
110  index_var_field012 = 0x0049,
111  index_var_field013 = 0x004a,
112  index_var_field014 = 0x004b,
113  index_var_field015 = 0x004c,
114  index_var_numOfParamFields = 0x004d,
115  index_var_evalCaseParam = 0x004e
116  };
117 
118  static const UINT16 MAX_NUM_OF_FIELDS = 16;
119 
120  // Data taken from generated file S_Methds.c
122  {
123  index_meth_SetAccessMode = 0x0000,
124  index_meth_GetAccessMode = 0x0001,
125  index_meth_Run = 0x0002,
126  index_meth_FlashFieldParameters = 0x0003,
127  index_meth_GetDescription = 0x0004,
128  index_meth_CheckPassword = 0x0005,
129  index_meth_MthdFlashLUXParameters = 0x0006,
130  index_meth_mStartMeasure = 0x000b,
131  index_meth_mStopMeasure = 0x000c
132  };
133 
135  {
136  index_event_Scanning = 0x0000,
137  index_event_ScanDataMonitor = 0x0011,
138  index_event_aEvalCaseResult = 0x0029
139  };
140 
141 private:
142  SensorStateInfo getSensorStateInfo();
143 
144  UINT32 colaB_fieldEncoder(BYTE* buffer, const FieldParameter& fieldPara);
145  FieldParameter* colaB_fieldDecoder(SopasAnswer* answer);
146  void evalCaseResultDecoder(SopasEventMessage& frame);
147  void scanDataDecoder(SopasEventMessage& frame);
148  EvalCases colaB_evalCaseDecoder(SopasAnswer* answer);
149  UINT32 colaB_evalCaseEncoder(BYTE* buffer, const EvalCases& evalCases);
150  double angleToRad(INT32 angle);
151 
155 
159 
163  double m_scanFreq;
164 
165  // Local storage
166  std::string m_ipAddress;
169 };
170 
171 } // namespace devices
172 
173 
174 #endif // LDMRSSOPASLAYER_HPP
unsigned char BYTE
Class that encapsulates a buffer that was sent as return to a sync call. (variable / method) ...
Definition: SopasBase.hpp:484
uint16_t UINT16
EvalCaseResults m_lastEvalCaseResults
Class that represents a message that was sent by a sensor. (Event message)
Definition: SopasBase.hpp:416
void(* DisconnectFunction)(void *obj)
Definition: tcp.hpp:53
uint32_t UINT32
int32_t INT32
bool isFieldDataSubscribed() const
uint8_t UINT8


libsick_ldmrs
Author(s): SICK AG , Martin Günther , Jochen Sprickerhof
autogenerated on Mon Oct 26 2020 03:27:30