SopasBase.hpp
Go to the documentation of this file.
1 //
2 // SopasBase.h
3 //
4 // Created on: 18.07.2011
5 // Author: sick
6 //
7 
8 #ifndef SOPASBASE_H
9 #define SOPASBASE_H
10 
12 // #include "sick_scan/tcp/datatypes/Scan.hpp"
13 #include "sick_scan/tcp/interfaces/tcp.hpp"
14 
15 #include "colaa.hpp"
16 #include "colab.hpp"
17 #include <map> // for std::map
18 #include "sick_scan/tcp/tools/Mutex.hpp"
19 
20 namespace devices
21 {
22 
23 class SopasEventMessage;
24 class SopasAnswer;
25 
35 class SopasBase
36 {
37 public:
38  static const std::string EVENTNAME_SUBSCRIBE_EVALCASES;
39  static const std::string EVENTNAME_SUBSCRIBE_SCANS;
40  static const std::string METHODNAME_LOGIN;
41  static const std::string METHODNAME_LOGOUT;
42  static const std::string METHODNAME_SET_SCANCONFIG;
43  static const std::string METHODNAME_START_MEASURE;
44  static const std::string METHODNAME_STOP_MEASURE;
45  static const std::string VARIABLENAME_DEVICEIDENT;
46  static const std::string VARIABLENAME_SCANCONFIG;
47  static const std::string VARIABLENAME_DATAOUTPUTRANGE;
48  static const std::string VARIABLENAME_SCANDATACONFIG;
49 
50  // sopas commands
51  static const std::string COMMAND_Read_Variable_ByIndex;
52  static const std::string COMMAND_Write_Variable_ByIndex;
53  static const std::string COMMAND_Invoke_Method_ByIndex;
54  static const std::string COMMAND_Method_Result_ByIndex;
55  static const std::string COMMAND_Register_Event_ByIndex;
56  static const std::string COMMAND_Send_Event_ByIndex; // receive data event
57 
58  static const std::string COMMAND_Read_Variable_Answer;
59  static const std::string COMMAND_Write_Variable_Answer;
60  static const std::string COMMAND_Invoke_Method_Answer;
61  static const std::string COMMAND_Method_Result_Answer;
62  static const std::string COMMAND_Register_Event_Answer;
63  static const std::string COMMAND_Event_Acknowledge;
64 
65  static const std::string COMMAND_Read_Variable_ByName;
66  static const std::string COMMAND_Write_Variable_ByName;
67  static const std::string COMMAND_Invoke_Method_ByName;
68  static const std::string COMMAND_Method_Result_ByName;
69  static const std::string COMMAND_Register_Event_ByName;
70  static const std::string COMMAND_Send_Event_ByName; // receive data event
71 
72  static const UINT16 INDEX_DEVICE_IDENT;
73 
75  {
78  };
79 
81  {
84  };
85 
88  {
90  // MSG_READ_VARIABLE, ///< Read Variable
91  // MSG_WRITE_VARIABLE, ///< Write Variable
92  // MSG_INVOKE_METHOD, ///< Invoke Method
93  // MSG_METHOD_RESULT, ///< Method Result
94  // MSG_REGISTER_EVENT, ///< Register Event
104  };
105 
106  typedef void (*DecoderFunction)(SopasEventMessage& frame); // Decoder for events
107 
109  SopasBase();
110 
112  virtual ~SopasBase();
113 
115 
127  virtual bool init(SopasProtocol protocol,
128  std::string ipAddress,
129  UINT16 portNumber,
130  bool weWantScanData,
131  bool weWantFieldData,
132  bool readOnlyMode,
133  Tcp::DisconnectFunction disconnectFunction,
134  void* obj);
135 
137  bool connect();
138 
140  bool isConnected();
141 
149  bool disconnect();
150 
157 
158 
159  void setReadOnlyMode(bool mode);
160 
161  bool isReadOnly();
162 
171  bool invokeMethod(const std::string& methodeName, BYTE* parameters, UINT16 parametersLength, SopasAnswer*& answer);
172 
181  bool invokeMethod(UINT16 index, BYTE* parameters, UINT16 parametersLength, SopasAnswer*& answer);
182 
189  bool readVariable(const std::string& variableName, SopasAnswer*& answer);
190 
197  bool readVariable(UINT16 index, SopasAnswer*& answer);
198 
206  bool writeVariable(const std::string& variableName, BYTE* parameters, UINT16 parametersLength);
207 
215  bool writeVariable(UINT16 index, BYTE* parameters, UINT16 parametersLength);
216 
222  bool registerEvent(const std::string& eventName);
223 
229  bool registerEvent(UINT16 index);
230 
236  bool unregisterEvent(const std::string& eventName);
237 
243  bool unregisterEvent(UINT16 index);
244 
250  void setEventCallbackFunction(DecoderFunction decoderFunction, const std::string& eventName)
251  {
252  m_decoderFunctionMapByName[eventName] = decoderFunction;
253  }
254 
260  void setEventCallbackFunction(DecoderFunction decoderFunction, UINT16 eventIndex)
261  {
262  m_decoderFunctionMapByIndex[eventIndex] = decoderFunction;
263  }
264 
265 
266  double makeAngleValid(double angle);
267 
268  const std::string& getScannerName() const { return m_scannerName; }
269  const std::string& getScannerVersion() const { return m_scannerVersion; }
270 
271  // Convert a SOPAS error code to readable text
272  static std::string convertSopasErrorCodeToText(UINT16 errorCode);
273 
274 protected:
275 
277  {
279  RI = 1,
280  WI = 2,
281  MI = 3,
282  AI = 4,
283  EI = 5,
284  SI = 6,
285  RA = 7,
286  WA = 8,
287  MA = 9,
288  AA = 10,
289  EA = 11,
290  SA = 12,
291  RN = 20,
292  AN = 21,
293  SN = 22,
294  FA = 50
296  };
297 
298  enum State
299  {
304  ,
308  // , RUNNING
309  };
310 
321  bool receiveAnswer(SopasCommand cmd, std::string name, UINT32 timeout, SopasAnswer*& answer);
322  bool receiveAnswer_CoLa_A(SopasCommand cmd, std::string name, UINT32 timeout, SopasAnswer*& answer );
323  bool receiveAnswer_CoLa_B(SopasCommand cmd, std::string name, UINT32 timeout, SopasAnswer*& answer );
324  bool receiveAnswer(SopasCommand cmd, UINT16 index, UINT32 timeout, SopasAnswer*& answer );
327 
333  void sendCommandBuffer(UINT8* buffer, UINT16 len);
334 
335  SopasCommand colaA_decodeCommand(std::string* rxData);
336 
338  SopasCommand stringToSopasCommand(const std::string& cmdString);
339  std::string sopasCommandToString(SopasCommand cmd);
340 
341 protected:
342  // Decoder functions that need to be overwritten by derived classes
343  virtual void evalCaseResultDecoder(SopasEventMessage& msg) = 0;
344  virtual void scanDataDecoder(SopasEventMessage& msg) = 0;
345 
350 
353  std::string m_scannerName;
354  std::string m_scannerVersion;
355 
356  bool m_beVerbose; // true = Show extended status traces
357 
359 
360 private:
361  // TCP
362  bool openTcpConnection();
363  void closeTcpConnection();
364 
366  static void readCallbackFunctionS(void* obj, UINT8* buffer, UINT32& numOfBytes);
367  void readCallbackFunction(UINT8* buffer, UINT32& numOfBytes);
368 
371 
373  void processFrame(SopasEventMessage& frame);
376  void copyFrameToResposeBuffer(UINT32 frameLength);
377  void removeFrameFromReceiveBuffer(UINT32 frameLength);
378 
379  // SOPAS / Cola
382  void colaA_decodeScannerTypeAndVersion(std::string* rxData);
384 
385 private:
386  typedef std::map<std::string, DecoderFunction> DecoderFunctionMapByName;
387  typedef std::map<UINT16, DecoderFunction> DecoderFunctionMapByIndex;
390 
391 // DecoderFunction m_scanDecoderFunction;
392 // DecoderFunction m_evalCaseDecoderFunction;
393 
394  typedef std::map<UINT16, std::string> IndexToNameMap;
396 
397  // Response buffer
401 
402  // Receive buffer
405 
406  // TCP
408  std::string m_ipAddress;
410 
412 };
413 
414 
417 {
418 public:
421 
424 
432  SopasEventMessage(BYTE* buffer, SopasBase::SopasProtocol protocol, UINT32 frameLength);
433 
435  {
436  return m_protocol;
437  }
438 
440  {
441  return m_encoding;
442  }
443 
445  {
446  return m_messageType;
447  }
448 
449  UINT32 size() const
450  {
451  return m_frameLength;
452  }
453 
455  UINT32 getPayLoadLength() const;
456 
457  std::string getCommandString() const;
458 
460  BYTE* getPayLoad();
461 
464 
466  std::string getVariableName();
467 
468  bool isValid() const { return (m_buffer != NULL); }
469 
470 private:
471  void detectEncoding();
472 
473  void detectMessageType();
474 
475 private:
481 };
482 
485 {
486 public:
488  SopasAnswer(const BYTE* answer, UINT32 answerLength);
489 
491  ~SopasAnswer();
492 
494 
495  UINT32 size() { return m_answerLength; }
496 
497  bool isValid() { return (m_answerBuffer != NULL); }
498 
499 private:
502 };
503 
504 } // namespace devices
505 
506 #endif // SOPASBASE_H
devices::SopasBase::VARIABLENAME_DEVICEIDENT
static const std::string VARIABLENAME_DEVICEIDENT
Definition: SopasBase.hpp:45
devices::SopasBase::WA
@ WA
Write Variable Answer.
Definition: SopasBase.hpp:286
UINT16
uint16_t UINT16
Definition: BasicDatatypes.hpp:27
UINT8
uint8_t UINT8
Definition: BasicDatatypes.hpp:29
devices::SopasBase::CoLa_A
@ CoLa_A
Command Language ASCI.
Definition: SopasBase.hpp:76
devices::SopasBase::invokeMethod
bool invokeMethod(const std::string &methodeName, BYTE *parameters, UINT16 parametersLength, SopasAnswer *&answer)
Invoke a method on the sensor.
Definition: SopasBase.cpp:1648
devices::SopasBase::CONNECTED
@ CONNECTED
Definition: SopasBase.hpp:305
devices::SopasBase::m_numberOfBytesInResponseBuffer
UINT32 m_numberOfBytesInResponseBuffer
Number of bytes in buffer.
Definition: SopasBase.hpp:398
devices::SopasBase::COMMAND_Event_Acknowledge
static const std::string COMMAND_Event_Acknowledge
Definition: SopasBase.hpp:63
devices::SopasBase::WI
@ WI
Write Variable.
Definition: SopasBase.hpp:280
devices::SopasBase::unregisterEvent
bool unregisterEvent(const std::string &eventName)
Unregisters an event by name.
Definition: SopasBase.cpp:2102
devices::SopasEventMessage::m_frameLength
UINT32 m_frameLength
Definition: SopasBase.hpp:478
devices::SopasEventMessage::m_encoding
SopasBase::SopasEncoding m_encoding
Definition: SopasBase.hpp:479
devices::SopasAnswer::m_answerLength
UINT32 m_answerLength
Definition: SopasBase.hpp:500
devices::SopasBase::IndexToNameMap
std::map< UINT16, std::string > IndexToNameMap
Definition: SopasBase.hpp:394
devices::SopasBase::RN
@ RN
Read Variable (by name)
Definition: SopasBase.hpp:291
devices::SopasBase::SI
@ SI
Send Event.
Definition: SopasBase.hpp:284
devices::SopasBase::SopasCommand
SopasCommand
Definition: SopasBase.hpp:276
devices::SopasBase::m_numberOfBytesInReceiveBuffer
UINT32 m_numberOfBytesInReceiveBuffer
Number of bytes in buffer.
Definition: SopasBase.hpp:403
devices::SopasEventMessage::getProtocolType
SopasBase::SopasProtocol getProtocolType() const
Definition: SopasBase.hpp:434
devices::SopasAnswer::size
UINT32 size()
Definition: SopasBase.hpp:495
devices::SopasEventMessage::getMessageType
SopasBase::SopasMessageType getMessageType() const
Definition: SopasBase.hpp:444
devices::SopasAnswer::~SopasAnswer
~SopasAnswer()
Destructor. Frees the memory for the copied buffer.
Definition: SopasBase.cpp:2358
devices::SopasBase::connect
bool connect()
Connects to a sensor via tcp and reads the device name.
Definition: SopasBase.cpp:122
devices::SopasBase::COMMAND_Write_Variable_ByIndex
static const std::string COMMAND_Write_Variable_ByIndex
Definition: SopasBase.hpp:52
devices::SopasBase::METHODNAME_SET_SCANCONFIG
static const std::string METHODNAME_SET_SCANCONFIG
Definition: SopasBase.hpp:42
devices::SopasBase::MSG_READ_VARIABLE_ANSWER
@ MSG_READ_VARIABLE_ANSWER
Read Variable Answer.
Definition: SopasBase.hpp:96
devices::SopasBase::processFrame_CoLa_B
void processFrame_CoLa_B(SopasEventMessage &frame)
Definition: SopasBase.cpp:1234
BasicDatatypes.hpp
devices::SopasBase::CoLa_B
@ CoLa_B
Command Language binary.
Definition: SopasBase.hpp:77
devices::SopasBase::COMMAND_Method_Result_ByName
static const std::string COMMAND_Method_Result_ByName
Definition: SopasBase.hpp:68
devices::SopasBase::m_scannerVersion
std::string m_scannerVersion
Read from scanner.
Definition: SopasBase.hpp:354
devices::SopasBase::COMMAND_Register_Event_Answer
static const std::string COMMAND_Register_Event_Answer
Definition: SopasBase.hpp:62
devices::SopasBase::SopasBase
SopasBase()
Default constructor.
Definition: SopasBase.cpp:57
devices
Definition: SopasBase.cpp:14
BYTE
unsigned char BYTE
devices::SopasBase::COMMAND_Read_Variable_ByName
static const std::string COMMAND_Read_Variable_ByName
Definition: SopasBase.hpp:65
devices::SopasBase::COMMAND_Read_Variable_Answer
static const std::string COMMAND_Read_Variable_Answer
Definition: SopasBase.hpp:58
devices::SopasAnswer::SopasAnswer
SopasAnswer(const BYTE *answer, UINT32 answerLength)
Constructor. Copies the content of the answer into the buffer of this object.
Definition: SopasBase.cpp:2345
devices::SopasBase::MSG_INVOKE_METHOD_ANSWER
@ MSG_INVOKE_METHOD_ANSWER
Invoke Method Answer.
Definition: SopasBase.hpp:98
devices::SopasEventMessage::m_protocol
SopasBase::SopasProtocol m_protocol
Definition: SopasBase.hpp:477
Tcp::DisconnectFunction
void(* DisconnectFunction)(void *obj)
Definition: tcp.hpp:53
devices::SopasBase::findFrameInReceiveBuffer
SopasEventMessage findFrameInReceiveBuffer()
Depending on the protocol the start and end of a frame will be found.
Definition: SopasBase.cpp:331
devices::SopasBase::registerEvent
bool registerEvent(const std::string &eventName)
Registers an event by name.
Definition: SopasBase.cpp:1961
devices::SopasBase::colaA_decodeScannerTypeAndVersion
void colaA_decodeScannerTypeAndVersion(std::string *rxData)
Definition: SopasBase.cpp:1596
devices::SopasBase::openTcpConnection
bool openTcpConnection()
Definition: SopasBase.cpp:219
devices::SopasAnswer::getBuffer
BYTE * getBuffer()
Definition: SopasBase.hpp:493
devices::SopasBase::COMMAND_Invoke_Method_ByIndex
static const std::string COMMAND_Invoke_Method_ByIndex
Definition: SopasBase.hpp:53
devices::SopasEventMessage::detectMessageType
void detectMessageType()
Definition: SopasBase.cpp:2311
devices::SopasBase::COMMAND_Write_Variable_ByName
static const std::string COMMAND_Write_Variable_ByName
Definition: SopasBase.hpp:66
devices::SopasBase::readCallbackFunction
void readCallbackFunction(UINT8 *buffer, UINT32 &numOfBytes)
Definition: SopasBase.cpp:259
devices::SopasBase::METHODNAME_LOGIN
static const std::string METHODNAME_LOGIN
Definition: SopasBase.hpp:40
devices::SopasBase::stringToSopasCommand
SopasCommand stringToSopasCommand(const std::string &cmdString)
Converts strings in sopas answer buffer to SopasCommand enum.
Definition: SopasBase.cpp:1375
devices::SopasBase::MI
@ MI
Invoke Method.
Definition: SopasBase.hpp:281
devices::SopasBase::ByIndex
@ ByIndex
read/write variable, invoke methods by index (indexes will be generated !!!)
Definition: SopasBase.hpp:83
devices::SopasBase::COMMAND_Read_Variable_ByIndex
static const std::string COMMAND_Read_Variable_ByIndex
Definition: SopasBase.hpp:51
devices::SopasBase::RA
@ RA
Read Variable Answer.
Definition: SopasBase.hpp:285
devices::SopasEventMessage::getPayLoadLength
UINT32 getPayLoadLength() const
contains 's' + command string(2 byte) + content(payload length - 3)
Definition: SopasBase.cpp:2172
INT32
int32_t INT32
Definition: BasicDatatypes.hpp:25
devices::SopasBase::makeAngleValid
double makeAngleValid(double angle)
Definition: SopasBase.cpp:2146
devices::SopasBase::COMMAND_Send_Event_ByIndex
static const std::string COMMAND_Send_Event_ByIndex
Definition: SopasBase.hpp:56
devices::SopasBase::m_tcp
Tcp m_tcp
Definition: SopasBase.hpp:407
devices::SopasBase::MSG_WRITE_VARIABLE_ANSWER
@ MSG_WRITE_VARIABLE_ANSWER
Write Variable Answer.
Definition: SopasBase.hpp:97
devices::SopasBase::COMMAND_Register_Event_ByIndex
static const std::string COMMAND_Register_Event_ByIndex
Definition: SopasBase.hpp:55
devices::SopasBase::COMMAND_Invoke_Method_Answer
static const std::string COMMAND_Invoke_Method_Answer
Definition: SopasBase.hpp:60
devices::SopasBase::CMD_UNKNOWN
@ CMD_UNKNOWN
Unknown command.
Definition: SopasBase.hpp:278
devices::SopasAnswer::isValid
bool isValid()
Definition: SopasBase.hpp:497
devices::SopasEventMessage::getVariableName
std::string getVariableName()
Returns the name of a variable (answer to read variable by name). In case of error an empty value wil...
Definition: SopasBase.cpp:2261
devices::SopasEventMessage::m_buffer
BYTE * m_buffer
Definition: SopasBase.hpp:476
devices::SopasBase::MA
@ MA
Invoke Method Answer.
Definition: SopasBase.hpp:287
devices::SopasEventMessage::getPayLoad
BYTE * getPayLoad()
contains 's' + command string(2 byte) + content(payload length - 3)
Definition: SopasBase.cpp:2212
devices::SopasBase::receiveAnswer
bool receiveAnswer(SopasCommand cmd, std::string name, UINT32 timeout, SopasAnswer *&answer)
Take answer from read thread and decode it. Waits for a certain answer by name. Event data (scans) ar...
Definition: SopasBase.cpp:539
devices::SopasBase::COMMAND_Write_Variable_Answer
static const std::string COMMAND_Write_Variable_Answer
Definition: SopasBase.hpp:59
colab.hpp
devices::SopasBase::CONSTRUCTED
@ CONSTRUCTED
Object has been constructed. Use init() to go into CONNECTED state.
Definition: SopasBase.hpp:301
devices::SopasBase::getScannerName
const std::string & getScannerName() const
Definition: SopasBase.hpp:268
devices::SopasBase::colaB_decodeScannerTypeAndVersion
void colaB_decodeScannerTypeAndVersion(UINT8 *buffer, UINT16 pos)
Definition: SopasBase.cpp:1626
devices::SopasBase::action_getScannerTypeAndVersion
bool action_getScannerTypeAndVersion()
Reads the scanner type and version variable from the sensor and stores it in the member variables....
Definition: SopasBase.cpp:1548
devices::SopasBase::m_decoderFunctionMapByIndex
DecoderFunctionMapByIndex m_decoderFunctionMapByIndex
Definition: SopasBase.hpp:389
devices::SopasBase::m_responseBuffer
UINT8 m_responseBuffer[1024]
Receive buffer for everything except scan data and eval case data.
Definition: SopasBase.hpp:399
devices::SopasAnswer::m_answerBuffer
BYTE * m_answerBuffer
Definition: SopasBase.hpp:501
devices::SopasBase::isConnected
bool isConnected()
Returns true if the tcp connection is established.
Definition: SopasBase.cpp:177
devices::SopasBase::m_receiveDataMutex
Mutex m_receiveDataMutex
Access mutex for buffer.
Definition: SopasBase.hpp:400
devices::SopasBase::closeTcpConnection
void closeTcpConnection()
Definition: SopasBase.cpp:238
devices::SopasBase::m_encoding
SopasEncoding m_encoding
ByName or ByIndex.
Definition: SopasBase.hpp:381
devices::SopasEventMessage
Class that represents a message that was sent by a sensor. (Event message)
Definition: SopasBase.hpp:416
devices::SopasBase::VARIABLENAME_DATAOUTPUTRANGE
static const std::string VARIABLENAME_DATAOUTPUTRANGE
Definition: SopasBase.hpp:47
devices::SopasBase::m_decoderFunctionMapByName
DecoderFunctionMapByName m_decoderFunctionMapByName
Definition: SopasBase.hpp:388
devices::SopasBase::MSG_ERROR
@ MSG_ERROR
Error.
Definition: SopasBase.hpp:102
devices::SopasBase::State
State
Definition: SopasBase.hpp:298
devices::SopasBase::ByName
@ ByName
read/write variable, invoke methods by name
Definition: SopasBase.hpp:82
devices::SopasBase::SopasEncoding
SopasEncoding
Definition: SopasBase.hpp:80
devices::SopasBase::sendCommandBuffer
void sendCommandBuffer(UINT8 *buffer, UINT16 len)
Sends the content of the buffer via TCP to the sensor.
Definition: SopasBase.cpp:505
devices::SopasBase::FA
@ FA
Error.
Definition: SopasBase.hpp:294
devices::SopasBase::sopasCommandToString
std::string sopasCommandToString(SopasCommand cmd)
Definition: SopasBase.cpp:1460
devices::SopasBase::MSG_EVENT_ACKNOWLEDGE
@ MSG_EVENT_ACKNOWLEDGE
Event Acknowledge -Answer to register event.
Definition: SopasBase.hpp:101
devices::SopasEventMessage::getCommandString
std::string getCommandString() const
Definition: SopasBase.cpp:2190
devices::SopasBase::isReadOnly
bool isReadOnly()
Definition: SopasBase.cpp:207
devices::SopasBase::DecoderFunctionMapByIndex
std::map< UINT16, DecoderFunction > DecoderFunctionMapByIndex
Definition: SopasBase.hpp:387
devices::SopasBase::MSG_SEND_EVENT
@ MSG_SEND_EVENT
Send Event.
Definition: SopasBase.hpp:95
Mutex
Definition: Mutex.hpp:15
devices::SopasBase::m_portNumber
UINT16 m_portNumber
Definition: SopasBase.hpp:409
devices::SopasAnswer
Class that encapsulates a buffer that was sent as return to a sync call. (variable / method)
Definition: SopasBase.hpp:484
devices::SopasBase::METHODNAME_LOGOUT
static const std::string METHODNAME_LOGOUT
Definition: SopasBase.hpp:41
devices::SopasBase::receiveAnswer_CoLa_B
bool receiveAnswer_CoLa_B(SopasCommand cmd, std::string name, UINT32 timeout, SopasAnswer *&answer)
Definition: SopasBase.cpp:781
devices::SopasBase::COMMAND_Register_Event_ByName
static const std::string COMMAND_Register_Event_ByName
Definition: SopasBase.hpp:69
Tcp
Definition: tcp.hpp:30
devices::SopasBase::getScannerVersion
const std::string & getScannerVersion() const
Definition: SopasBase.hpp:269
devices::SopasBase::AN
@ AN
Method Result (ny name)
Definition: SopasBase.hpp:292
devices::SopasBase::AA
@ AA
Method Result Answer.
Definition: SopasBase.hpp:288
devices::SopasBase::m_scannerName
std::string m_scannerName
Read from scanner.
Definition: SopasBase.hpp:353
devices::SopasBase::~SopasBase
virtual ~SopasBase()
Destructor.
Definition: SopasBase.cpp:67
devices::SopasEventMessage::isValid
bool isValid() const
Definition: SopasBase.hpp:468
devices::SopasBase::readVariable
bool readVariable(const std::string &variableName, SopasAnswer *&answer)
Reads a variable from the sensor by name.
Definition: SopasBase.cpp:1754
devices::SopasBase::METHODNAME_STOP_MEASURE
static const std::string METHODNAME_STOP_MEASURE
Definition: SopasBase.hpp:44
devices::SopasBase::scanDataDecoder
virtual void scanDataDecoder(SopasEventMessage &msg)=0
devices::SopasBase::m_isLoggedIn
bool m_isLoggedIn
Definition: SopasBase.hpp:358
devices::SopasBase::m_readOnlyMode
bool m_readOnlyMode
Definition: SopasBase.hpp:411
devices::SopasBase::m_indexToNameMap
IndexToNameMap m_indexToNameMap
Definition: SopasBase.hpp:395
devices::SopasBase::COMMAND_Method_Result_ByIndex
static const std::string COMMAND_Method_Result_ByIndex
Definition: SopasBase.hpp:54
devices::SopasBase::EVENTNAME_SUBSCRIBE_SCANS
static const std::string EVENTNAME_SUBSCRIBE_SCANS
Definition: SopasBase.hpp:39
devices::SopasBase
Definition: SopasBase.hpp:35
devices::SopasBase::receiveAnswer_CoLa_A
bool receiveAnswer_CoLa_A(SopasCommand cmd, std::string name, UINT32 timeout, SopasAnswer *&answer)
Definition: SopasBase.cpp:685
devices::SopasEventMessage::detectEncoding
void detectEncoding()
Definition: SopasBase.cpp:2299
devices::SopasBase::writeVariable
bool writeVariable(const std::string &variableName, BYTE *parameters, UINT16 parametersLength)
Write a variable to the sensor by name.
Definition: SopasBase.cpp:1834
devices::SopasBase::m_fieldEventIsRegistered
bool m_fieldEventIsRegistered
Definition: SopasBase.hpp:347
devices::SopasBase::disconnect
bool disconnect()
Closes the connection to the LMS. This is the opposite of init().
Definition: SopasBase.cpp:185
devices::SopasBase::setEventCallbackFunction
void setEventCallbackFunction(DecoderFunction decoderFunction, UINT16 eventIndex)
Definition: SopasBase.hpp:260
devices::SopasBase::AI
@ AI
Method Result.
Definition: SopasBase.hpp:282
devices::SopasEventMessage::size
UINT32 size() const
Definition: SopasBase.hpp:449
devices::SopasBase::m_weWantScanData
bool m_weWantScanData
Flag to enable/disable scan data reception.
Definition: SopasBase.hpp:348
devices::SopasBase::m_protocol
SopasProtocol m_protocol
Used protocol (ColaA oder ColaB)
Definition: SopasBase.hpp:380
colaa.hpp
devices::SopasBase::copyFrameToResposeBuffer
void copyFrameToResposeBuffer(UINT32 frameLength)
Definition: SopasBase.cpp:1315
devices::SopasEventMessage::m_messageType
SopasBase::SopasMessageType m_messageType
Definition: SopasBase.hpp:480
devices::SopasBase::readCallbackFunctionS
static void readCallbackFunctionS(void *obj, UINT8 *buffer, UINT32 &numOfBytes)
Function that will be called on incomming data via tcp.
Definition: SopasBase.cpp:249
devices::SopasBase::processFrame_CoLa_A
void processFrame_CoLa_A(SopasEventMessage &frame)
Definition: SopasBase.cpp:1145
devices::SopasBase::SA
@ SA
Event Acknowledge.
Definition: SopasBase.hpp:290
sick_generic_device_finder.timeout
timeout
Definition: sick_generic_device_finder.py:113
devices::SopasBase::setEventCallbackFunction
void setEventCallbackFunction(DecoderFunction decoderFunction, const std::string &eventName)
Definition: SopasBase.hpp:250
devices::SopasBase::COMMAND_Invoke_Method_ByName
static const std::string COMMAND_Invoke_Method_ByName
Definition: SopasBase.hpp:67
devices::SopasBase::EVENTNAME_SUBSCRIBE_EVALCASES
static const std::string EVENTNAME_SUBSCRIBE_EVALCASES
Definition: SopasBase.hpp:38
devices::SopasBase::RI
@ RI
Read Variable.
Definition: SopasBase.hpp:279
SopasAnswer
Class that encapsulates a buffer that was sent as return to a sync call. (variable / method)
Definition: sick_scan_common_nw.h:191
devices::SopasBase::m_state
State m_state
Device info.
Definition: SopasBase.hpp:352
devices::SopasBase::colaA_decodeCommand
SopasCommand colaA_decodeCommand(std::string *rxData)
Definition: SopasBase.cpp:1368
UINT32
uint32_t UINT32
Definition: BasicDatatypes.hpp:26
devices::SopasEventMessage::SopasEventMessage
SopasEventMessage()
Default constructor.
Definition: SopasBase.cpp:2156
devices::SopasBase::m_weWantFieldData
bool m_weWantFieldData
Flag to enable/disable protection field data reception.
Definition: SopasBase.hpp:349
devices::SopasBase::EA
@ EA
Register Event Answer.
Definition: SopasBase.hpp:289
devices::SopasBase::COMMAND_Method_Result_Answer
static const std::string COMMAND_Method_Result_Answer
Definition: SopasBase.hpp:61
devices::SopasBase::SopasMessageType
SopasMessageType
types of answers of the sensor
Definition: SopasBase.hpp:87
devices::SopasBase::removeFrameFromReceiveBuffer
void removeFrameFromReceiveBuffer(UINT32 frameLength)
Definition: SopasBase.cpp:1341
devices::SopasBase::MSG_METHOD_RESULT_ANSWER
@ MSG_METHOD_RESULT_ANSWER
Method Result Answer.
Definition: SopasBase.hpp:99
devices::SopasEventMessage::~SopasEventMessage
~SopasEventMessage()
Destructor.
Definition: SopasBase.hpp:423
devices::SopasBase::INDEX_DEVICE_IDENT
static const UINT16 INDEX_DEVICE_IDENT
Definition: SopasBase.hpp:72
devices::SopasBase::SN
@ SN
Send Event (by name, receive)
Definition: SopasBase.hpp:293
devices::SopasBase::SopasProtocol
SopasProtocol
Definition: SopasBase.hpp:74
devices::SopasBase::DecoderFunction
void(* DecoderFunction)(SopasEventMessage &frame)
Definition: SopasBase.hpp:106
devices::SopasBase::evalCaseResultDecoder
virtual void evalCaseResultDecoder(SopasEventMessage &msg)=0
devices::SopasEventMessage::getEncodingType
SopasBase::SopasEncoding getEncodingType() const
Definition: SopasBase.hpp:439
devices::SopasBase::m_ipAddress
std::string m_ipAddress
Definition: SopasBase.hpp:408
devices::SopasBase::VARIABLENAME_SCANCONFIG
static const std::string VARIABLENAME_SCANCONFIG
Definition: SopasBase.hpp:46
devices::SopasBase::setReadOnlyMode
void setReadOnlyMode(bool mode)
Definition: SopasBase.cpp:200
devices::SopasBase::m_scanEventIsRegistered
bool m_scanEventIsRegistered
Definition: SopasBase.hpp:346
devices::SopasEventMessage::getVariableIndex
INT32 getVariableIndex()
Returns the index of a variable (answer to read variable by index). In case of error a negative value...
Definition: SopasBase.cpp:2231
devices::SopasBase::COMMAND_Send_Event_ByName
static const std::string COMMAND_Send_Event_ByName
Definition: SopasBase.hpp:70
devices::SopasBase::init
virtual bool init(SopasProtocol protocol, std::string ipAddress, UINT16 portNumber, bool weWantScanData, bool weWantFieldData, bool readOnlyMode, Tcp::DisconnectFunction disconnectFunction, void *obj)
Initialization.
Definition: SopasBase.cpp:94
SopasEventMessage
Class that represents a message that was sent by a sensor. (Event message)
Definition: sick_scan_common_nw.h:130
devices::SopasBase::m_receiveBuffer
UINT8 m_receiveBuffer[25000]
Low-Level receive buffer for all data (25000 should be enough for NAV300 Events)
Definition: SopasBase.hpp:404
devices::SopasBase::MSG_REGISTER_EVENT_ANSWER
@ MSG_REGISTER_EVENT_ANSWER
Register Event Answer.
Definition: SopasBase.hpp:100
devices::SopasBase::EI
@ EI
Register Event.
Definition: SopasBase.hpp:283
devices::SopasBase::convertSopasErrorCodeToText
static std::string convertSopasErrorCodeToText(UINT16 errorCode)
Definition: SopasBase.cpp:916
devices::SopasBase::MSG_UNKNOWN
@ MSG_UNKNOWN
Unknown message.
Definition: SopasBase.hpp:89
devices::SopasBase::VARIABLENAME_SCANDATACONFIG
static const std::string VARIABLENAME_SCANDATACONFIG
Definition: SopasBase.hpp:48
devices::SopasBase::processFrame
void processFrame(SopasEventMessage &frame)
Reads one frame from receive buffer and decodes it.
Definition: SopasBase.cpp:1123
devices::SopasBase::m_beVerbose
bool m_beVerbose
Definition: SopasBase.hpp:356
devices::SopasBase::DecoderFunctionMapByName
std::map< std::string, DecoderFunction > DecoderFunctionMapByName
Definition: SopasBase.hpp:386
devices::SopasBase::METHODNAME_START_MEASURE
static const std::string METHODNAME_START_MEASURE
Definition: SopasBase.hpp:43


sick_scan
Author(s): Michael Lehning , Jochen Sprickerhof , Martin Günther
autogenerated on Thu Sep 8 2022 02:30:19