SopasBase.hpp
Go to the documentation of this file.
1 #include "sick_scan/sick_scan_base.h" /* Base definitions included in all header files, added by add_sick_scan_base_header.py. Do not edit this line. */
2 //
3 // SopasBase.h
4 //
5 // Created on: 18.07.2011
6 // Author: sick
7 //
8 
9 #ifndef SOPASBASE_H
10 #define SOPASBASE_H
11 
13 // #include "sick_scan/tcp/datatypes/Scan.hpp"
14 #include "sick_scan/tcp/interfaces/tcp.hpp"
15 
16 #include "colaa.hpp"
17 #include "colab.hpp"
18 #include <map> // for std::map
19 #include "sick_scan/tcp/tools/Mutex.hpp"
20 
21 namespace devices
22 {
23 
24 class SopasEventMessage;
25 class SopasAnswer;
26 
36 class SopasBase
37 {
38 public:
39  static const std::string EVENTNAME_SUBSCRIBE_EVALCASES;
40  static const std::string EVENTNAME_SUBSCRIBE_SCANS;
41  static const std::string METHODNAME_LOGIN;
42  static const std::string METHODNAME_LOGOUT;
43  static const std::string METHODNAME_SET_SCANCONFIG;
44  static const std::string METHODNAME_START_MEASURE;
45  static const std::string METHODNAME_STOP_MEASURE;
46  static const std::string VARIABLENAME_DEVICEIDENT;
47  static const std::string VARIABLENAME_SCANCONFIG;
48  static const std::string VARIABLENAME_DATAOUTPUTRANGE;
49  static const std::string VARIABLENAME_SCANDATACONFIG;
50 
51  // sopas commands
52  static const std::string COMMAND_Read_Variable_ByIndex;
53  static const std::string COMMAND_Write_Variable_ByIndex;
54  static const std::string COMMAND_Invoke_Method_ByIndex;
55  static const std::string COMMAND_Method_Result_ByIndex;
56  static const std::string COMMAND_Register_Event_ByIndex;
57  static const std::string COMMAND_Send_Event_ByIndex; // receive data event
58 
59  static const std::string COMMAND_Read_Variable_Answer;
60  static const std::string COMMAND_Write_Variable_Answer;
61  static const std::string COMMAND_Invoke_Method_Answer;
62  static const std::string COMMAND_Method_Result_Answer;
63  static const std::string COMMAND_Register_Event_Answer;
64  static const std::string COMMAND_Event_Acknowledge;
65 
66  static const std::string COMMAND_Read_Variable_ByName;
67  static const std::string COMMAND_Write_Variable_ByName;
68  static const std::string COMMAND_Invoke_Method_ByName;
69  static const std::string COMMAND_Method_Result_ByName;
70  static const std::string COMMAND_Register_Event_ByName;
71  static const std::string COMMAND_Send_Event_ByName; // receive data event
72 
73  static const UINT16 INDEX_DEVICE_IDENT;
74 
76  {
79  };
80 
82  {
85  };
86 
89  {
91  // MSG_READ_VARIABLE, ///< Read Variable
92  // MSG_WRITE_VARIABLE, ///< Write Variable
93  // MSG_INVOKE_METHOD, ///< Invoke Method
94  // MSG_METHOD_RESULT, ///< Method Result
95  // MSG_REGISTER_EVENT, ///< Register Event
105  };
106 
107  typedef void (*DecoderFunction)(SopasEventMessage& frame); // Decoder for events
108 
110  SopasBase();
111 
113  virtual ~SopasBase();
114 
116 
128  virtual bool init(SopasProtocol protocol,
129  std::string ipAddress,
130  UINT16 portNumber,
131  bool weWantScanData,
132  bool weWantFieldData,
133  bool readOnlyMode,
134  Tcp::DisconnectFunction disconnectFunction,
135  void* obj);
136 
138  bool connect();
139 
141  bool isConnected();
142 
150  bool disconnect();
151 
158 
159 
160  void setReadOnlyMode(bool mode);
161 
162  bool isReadOnly();
163 
172  bool invokeMethod(const std::string& methodeName, BYTE* parameters, UINT16 parametersLength, SopasAnswer*& answer);
173 
182  bool invokeMethod(UINT16 index, BYTE* parameters, UINT16 parametersLength, SopasAnswer*& answer);
183 
190  bool readVariable(const std::string& variableName, SopasAnswer*& answer);
191 
198  bool readVariable(UINT16 index, SopasAnswer*& answer);
199 
207  bool writeVariable(const std::string& variableName, BYTE* parameters, UINT16 parametersLength);
208 
216  bool writeVariable(UINT16 index, BYTE* parameters, UINT16 parametersLength);
217 
223  bool registerEvent(const std::string& eventName);
224 
230  bool registerEvent(UINT16 index);
231 
237  bool unregisterEvent(const std::string& eventName);
238 
244  bool unregisterEvent(UINT16 index);
245 
251  void setEventCallbackFunction(DecoderFunction decoderFunction, const std::string& eventName)
252  {
253  m_decoderFunctionMapByName[eventName] = decoderFunction;
254  }
255 
261  void setEventCallbackFunction(DecoderFunction decoderFunction, UINT16 eventIndex)
262  {
263  m_decoderFunctionMapByIndex[eventIndex] = decoderFunction;
264  }
265 
266 
267  double makeAngleValid(double angle);
268 
269  const std::string& getScannerName() const { return m_scannerName; }
270  const std::string& getScannerVersion() const { return m_scannerVersion; }
271 
272  // Returns a timestamp in nanoseconds of the last received tcp message (or 0 if no message received)
274 
275  // Convert a SOPAS error code to readable text
276  static std::string convertSopasErrorCodeToText(UINT16 errorCode);
277 
278 protected:
279 
281  {
283  RI = 1,
284  WI = 2,
285  MI = 3,
286  AI = 4,
287  EI = 5,
288  SI = 6,
289  RA = 7,
290  WA = 8,
291  MA = 9,
292  AA = 10,
293  EA = 11,
294  SA = 12,
295  RN = 20,
296  AN = 21,
297  SN = 22,
298  FA = 50
300  };
301 
302  enum State
303  {
308  ,
312  // , RUNNING
313  };
314 
325  bool receiveAnswer(SopasCommand cmd, std::string name, UINT32 timeout, SopasAnswer*& answer);
326  bool receiveAnswer_CoLa_A(SopasCommand cmd, std::string name, UINT32 timeout, SopasAnswer*& answer );
327  bool receiveAnswer_CoLa_B(SopasCommand cmd, std::string name, UINT32 timeout, SopasAnswer*& answer );
328  bool receiveAnswer(SopasCommand cmd, UINT16 index, UINT32 timeout, SopasAnswer*& answer );
331 
337  bool sendCommandBuffer(UINT8* buffer, UINT16 len);
338 
339  SopasCommand colaA_decodeCommand(std::string* rxData);
340 
342  SopasCommand stringToSopasCommand(const std::string& cmdString);
343  std::string sopasCommandToString(SopasCommand cmd);
344 
345 protected:
346  // Decoder functions that need to be overwritten by derived classes
347  virtual void evalCaseResultDecoder(SopasEventMessage& msg) = 0;
348  virtual void scanDataDecoder(SopasEventMessage& msg) = 0;
349 
354 
357  std::string m_scannerName;
358  std::string m_scannerVersion;
359 
360  bool m_beVerbose; // true = Show extended status traces
361 
363 
364 private:
365  // TCP
366  bool openTcpConnection();
367  void closeTcpConnection();
368 
370  static void readCallbackFunctionS(void* obj, UINT8* buffer, UINT32& numOfBytes);
371  void readCallbackFunction(UINT8* buffer, UINT32& numOfBytes);
372 
375 
377  void processFrame(SopasEventMessage& frame);
380  void copyFrameToResposeBuffer(UINT32 frameLength);
381  void removeFrameFromReceiveBuffer(UINT32 frameLength);
382 
383  // SOPAS / Cola
386  void colaA_decodeScannerTypeAndVersion(std::string* rxData);
388 
389 private:
390  typedef std::map<std::string, DecoderFunction> DecoderFunctionMapByName;
391  typedef std::map<UINT16, DecoderFunction> DecoderFunctionMapByIndex;
394 
395 // DecoderFunction m_scanDecoderFunction;
396 // DecoderFunction m_evalCaseDecoderFunction;
397 
398  typedef std::map<UINT16, std::string> IndexToNameMap;
400 
401  // Response buffer
405 
406  // Receive buffer
409 
410  // TCP
412  std::string m_ipAddress;
414 
416 };
417 
418 
421 {
422 public:
425 
428 
436  SopasEventMessage(BYTE* buffer, SopasBase::SopasProtocol protocol, UINT32 frameLength);
437 
439  {
440  return m_protocol;
441  }
442 
444  {
445  return m_encoding;
446  }
447 
449  {
450  return m_messageType;
451  }
452 
453  UINT32 size() const
454  {
455  return m_frameLength;
456  }
457 
459  UINT32 getPayLoadLength() const;
460 
461  std::string getCommandString() const;
462 
464  BYTE* getPayLoad();
465 
468 
470  std::string getVariableName();
471 
472  bool isValid() const { return (m_buffer != NULL); }
473 
474 private:
475  void detectEncoding();
476 
477  void detectMessageType();
478 
479 private:
485 };
486 
489 {
490 public:
492  SopasAnswer(const BYTE* answer, UINT32 answerLength);
493 
495  ~SopasAnswer();
496 
498 
499  UINT32 size() { return m_answerLength; }
500 
501  bool isValid() { return (m_answerBuffer != NULL); }
502 
503 private:
506 };
507 
508 } // namespace devices
509 
510 #endif // SOPASBASE_H
devices::SopasBase::VARIABLENAME_DEVICEIDENT
static const std::string VARIABLENAME_DEVICEIDENT
Definition: SopasBase.hpp:46
devices::SopasBase::WA
@ WA
Write Variable Answer.
Definition: SopasBase.hpp:290
UINT16
uint16_t UINT16
Definition: BasicDatatypes.hpp:73
UINT8
uint8_t UINT8
Definition: BasicDatatypes.hpp:75
devices::SopasBase::CoLa_A
@ CoLa_A
Command Language ASCI.
Definition: SopasBase.hpp:77
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:309
devices::SopasBase::m_numberOfBytesInResponseBuffer
UINT32 m_numberOfBytesInResponseBuffer
Number of bytes in buffer.
Definition: SopasBase.hpp:402
devices::SopasBase::COMMAND_Event_Acknowledge
static const std::string COMMAND_Event_Acknowledge
Definition: SopasBase.hpp:64
devices::SopasBase::WI
@ WI
Write Variable.
Definition: SopasBase.hpp:284
devices::SopasBase::unregisterEvent
bool unregisterEvent(const std::string &eventName)
Unregisters an event by name.
Definition: SopasBase.cpp:2138
devices::SopasEventMessage::m_frameLength
UINT32 m_frameLength
Definition: SopasBase.hpp:482
devices::SopasEventMessage::m_encoding
SopasBase::SopasEncoding m_encoding
Definition: SopasBase.hpp:483
devices::SopasAnswer::m_answerLength
UINT32 m_answerLength
Definition: SopasBase.hpp:504
devices::SopasBase::IndexToNameMap
std::map< UINT16, std::string > IndexToNameMap
Definition: SopasBase.hpp:398
devices::SopasBase::RN
@ RN
Read Variable (by name)
Definition: SopasBase.hpp:295
NULL
#define NULL
devices::SopasBase::SI
@ SI
Send Event.
Definition: SopasBase.hpp:288
devices::SopasBase::SopasCommand
SopasCommand
Definition: SopasBase.hpp:280
devices::SopasBase::m_numberOfBytesInReceiveBuffer
UINT32 m_numberOfBytesInReceiveBuffer
Number of bytes in buffer.
Definition: SopasBase.hpp:407
devices::SopasEventMessage::getProtocolType
SopasBase::SopasProtocol getProtocolType() const
Definition: SopasBase.hpp:438
devices::SopasAnswer::size
UINT32 size()
Definition: SopasBase.hpp:499
devices::SopasEventMessage::getMessageType
SopasBase::SopasMessageType getMessageType() const
Definition: SopasBase.hpp:448
devices::SopasAnswer::~SopasAnswer
~SopasAnswer()
Destructor. Frees the memory for the copied buffer.
Definition: SopasBase.cpp:2405
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:53
devices::SopasBase::METHODNAME_SET_SCANCONFIG
static const std::string METHODNAME_SET_SCANCONFIG
Definition: SopasBase.hpp:43
devices::SopasBase::MSG_READ_VARIABLE_ANSWER
@ MSG_READ_VARIABLE_ANSWER
Read Variable Answer.
Definition: SopasBase.hpp:97
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:78
devices::SopasBase::COMMAND_Method_Result_ByName
static const std::string COMMAND_Method_Result_ByName
Definition: SopasBase.hpp:69
devices::SopasBase::m_scannerVersion
std::string m_scannerVersion
Read from scanner.
Definition: SopasBase.hpp:358
devices::SopasBase::COMMAND_Register_Event_Answer
static const std::string COMMAND_Register_Event_Answer
Definition: SopasBase.hpp:63
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:66
devices::SopasBase::COMMAND_Read_Variable_Answer
static const std::string COMMAND_Read_Variable_Answer
Definition: SopasBase.hpp:59
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:2392
devices::SopasBase::MSG_INVOKE_METHOD_ANSWER
@ MSG_INVOKE_METHOD_ANSWER
Invoke Method Answer.
Definition: SopasBase.hpp:99
devices::SopasEventMessage::m_protocol
SopasBase::SopasProtocol m_protocol
Definition: SopasBase.hpp:481
Tcp::DisconnectFunction
void(* DisconnectFunction)(void *obj)
Definition: tcp.hpp:59
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:1985
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:497
devices::SopasBase::COMMAND_Invoke_Method_ByIndex
static const std::string COMMAND_Invoke_Method_ByIndex
Definition: SopasBase.hpp:54
devices::SopasEventMessage::detectMessageType
void detectMessageType()
Definition: SopasBase.cpp:2358
devices::SopasBase::COMMAND_Write_Variable_ByName
static const std::string COMMAND_Write_Variable_ByName
Definition: SopasBase.hpp:67
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:41
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:285
devices::SopasBase::ByIndex
@ ByIndex
read/write variable, invoke methods by index (indexes will be generated !!!)
Definition: SopasBase.hpp:84
devices::SopasBase::COMMAND_Read_Variable_ByIndex
static const std::string COMMAND_Read_Variable_ByIndex
Definition: SopasBase.hpp:52
devices::SopasBase::RA
@ RA
Read Variable Answer.
Definition: SopasBase.hpp:289
devices::SopasEventMessage::getPayLoadLength
UINT32 getPayLoadLength() const
contains 's' + command string(2 byte) + content(payload length - 3)
Definition: SopasBase.cpp:2219
INT32
int32_t INT32
Definition: BasicDatatypes.hpp:71
devices::SopasBase::makeAngleValid
double makeAngleValid(double angle)
Definition: SopasBase.cpp:2193
devices::SopasBase::COMMAND_Send_Event_ByIndex
static const std::string COMMAND_Send_Event_ByIndex
Definition: SopasBase.hpp:57
devices::SopasBase::m_tcp
Tcp m_tcp
Definition: SopasBase.hpp:411
devices::SopasBase::MSG_WRITE_VARIABLE_ANSWER
@ MSG_WRITE_VARIABLE_ANSWER
Write Variable Answer.
Definition: SopasBase.hpp:98
devices::SopasBase::COMMAND_Register_Event_ByIndex
static const std::string COMMAND_Register_Event_ByIndex
Definition: SopasBase.hpp:56
devices::SopasBase::COMMAND_Invoke_Method_Answer
static const std::string COMMAND_Invoke_Method_Answer
Definition: SopasBase.hpp:61
devices::SopasBase::CMD_UNKNOWN
@ CMD_UNKNOWN
Unknown command.
Definition: SopasBase.hpp:282
devices::SopasAnswer::isValid
bool isValid()
Definition: SopasBase.hpp:501
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:2308
devices::SopasEventMessage::m_buffer
BYTE * m_buffer
Definition: SopasBase.hpp:480
devices::SopasBase::MA
@ MA
Invoke Method Answer.
Definition: SopasBase.hpp:291
devices::SopasEventMessage::getPayLoad
BYTE * getPayLoad()
contains 's' + command string(2 byte) + content(payload length - 3)
Definition: SopasBase.cpp:2259
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:60
devices::SopasBase::getNanosecTimestampLastTcpMessageReceived
uint64_t getNanosecTimestampLastTcpMessageReceived(void)
Definition: SopasBase.cpp:2184
colab.hpp
devices::SopasBase::CONSTRUCTED
@ CONSTRUCTED
Object has been constructed. Use init() to go into CONNECTED state.
Definition: SopasBase.hpp:305
devices::SopasBase::getScannerName
const std::string & getScannerName() const
Definition: SopasBase.hpp:269
devices::SopasBase::colaB_decodeScannerTypeAndVersion
void colaB_decodeScannerTypeAndVersion(UINT8 *buffer, UINT16 pos)
Definition: SopasBase.cpp:1626
api.setup.name
name
Definition: python/api/setup.py:12
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:393
devices::SopasBase::m_responseBuffer
UINT8 m_responseBuffer[1024]
Receive buffer for everything except scan data and eval case data.
Definition: SopasBase.hpp:403
devices::SopasAnswer::m_answerBuffer
BYTE * m_answerBuffer
Definition: SopasBase.hpp:505
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:404
devices::SopasBase::closeTcpConnection
void closeTcpConnection()
Definition: SopasBase.cpp:238
devices::SopasBase::m_encoding
SopasEncoding m_encoding
ByName or ByIndex.
Definition: SopasBase.hpp:385
devices::SopasEventMessage
Class that represents a message that was sent by a sensor. (Event message)
Definition: SopasBase.hpp:420
devices::SopasBase::VARIABLENAME_DATAOUTPUTRANGE
static const std::string VARIABLENAME_DATAOUTPUTRANGE
Definition: SopasBase.hpp:48
devices::SopasBase::m_decoderFunctionMapByName
DecoderFunctionMapByName m_decoderFunctionMapByName
Definition: SopasBase.hpp:392
devices::SopasBase::MSG_ERROR
@ MSG_ERROR
Error.
Definition: SopasBase.hpp:103
devices::SopasBase::State
State
Definition: SopasBase.hpp:302
devices::SopasBase::ByName
@ ByName
read/write variable, invoke methods by name
Definition: SopasBase.hpp:83
devices::SopasBase::SopasEncoding
SopasEncoding
Definition: SopasBase.hpp:81
devices::SopasBase::FA
@ FA
Error.
Definition: SopasBase.hpp:298
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:102
devices::SopasEventMessage::getCommandString
std::string getCommandString() const
Definition: SopasBase.cpp:2237
multiscan_receiver.mode
string mode
Definition: multiscan_receiver.py:348
devices::SopasBase::isReadOnly
bool isReadOnly()
Definition: SopasBase.cpp:207
devices::SopasBase::DecoderFunctionMapByIndex
std::map< UINT16, DecoderFunction > DecoderFunctionMapByIndex
Definition: SopasBase.hpp:391
devices::SopasBase::MSG_SEND_EVENT
@ MSG_SEND_EVENT
Send Event.
Definition: SopasBase.hpp:96
Mutex
Definition: Mutex.hpp:19
devices::SopasBase::m_portNumber
UINT16 m_portNumber
Definition: SopasBase.hpp:413
devices::SopasAnswer
Class that encapsulates a buffer that was sent as return to a sync call. (variable / method)
Definition: SopasBase.hpp:488
devices::SopasBase::METHODNAME_LOGOUT
static const std::string METHODNAME_LOGOUT
Definition: SopasBase.hpp:42
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:70
Tcp
Definition: tcp.hpp:36
devices::SopasBase::getScannerVersion
const std::string & getScannerVersion() const
Definition: SopasBase.hpp:270
devices::SopasBase::AN
@ AN
Method Result (ny name)
Definition: SopasBase.hpp:296
devices::SopasBase::AA
@ AA
Method Result Answer.
Definition: SopasBase.hpp:292
devices::SopasBase::m_scannerName
std::string m_scannerName
Read from scanner.
Definition: SopasBase.hpp:357
devices::SopasBase::~SopasBase
virtual ~SopasBase()
Destructor.
Definition: SopasBase.cpp:67
devices::SopasEventMessage::isValid
bool isValid() const
Definition: SopasBase.hpp:472
devices::SopasBase::readVariable
bool readVariable(const std::string &variableName, SopasAnswer *&answer)
Reads a variable from the sensor by name.
Definition: SopasBase.cpp:1762
devices::SopasBase::sendCommandBuffer
bool sendCommandBuffer(UINT8 *buffer, UINT16 len)
Sends the content of the buffer via TCP to the sensor.
Definition: SopasBase.cpp:505
devices::SopasBase::METHODNAME_STOP_MEASURE
static const std::string METHODNAME_STOP_MEASURE
Definition: SopasBase.hpp:45
devices::SopasBase::scanDataDecoder
virtual void scanDataDecoder(SopasEventMessage &msg)=0
devices::SopasBase::m_isLoggedIn
bool m_isLoggedIn
Definition: SopasBase.hpp:362
devices::SopasBase::m_readOnlyMode
bool m_readOnlyMode
Definition: SopasBase.hpp:415
devices::SopasBase::m_indexToNameMap
IndexToNameMap m_indexToNameMap
Definition: SopasBase.hpp:399
devices::SopasBase::COMMAND_Method_Result_ByIndex
static const std::string COMMAND_Method_Result_ByIndex
Definition: SopasBase.hpp:55
devices::SopasBase::EVENTNAME_SUBSCRIBE_SCANS
static const std::string EVENTNAME_SUBSCRIBE_SCANS
Definition: SopasBase.hpp:40
devices::SopasBase
Definition: SopasBase.hpp:36
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:2346
devices::SopasBase::writeVariable
bool writeVariable(const std::string &variableName, BYTE *parameters, UINT16 parametersLength)
Write a variable to the sensor by name.
Definition: SopasBase.cpp:1850
devices::SopasBase::m_fieldEventIsRegistered
bool m_fieldEventIsRegistered
Definition: SopasBase.hpp:351
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:261
devices::SopasBase::AI
@ AI
Method Result.
Definition: SopasBase.hpp:286
devices::SopasEventMessage::size
UINT32 size() const
Definition: SopasBase.hpp:453
devices::SopasBase::m_weWantScanData
bool m_weWantScanData
Flag to enable/disable scan data reception.
Definition: SopasBase.hpp:352
devices::SopasBase::m_protocol
SopasProtocol m_protocol
Used protocol (ColaA oder ColaB)
Definition: SopasBase.hpp:384
colaa.hpp
devices::SopasBase::copyFrameToResposeBuffer
void copyFrameToResposeBuffer(UINT32 frameLength)
Definition: SopasBase.cpp:1315
devices::SopasEventMessage::m_messageType
SopasBase::SopasMessageType m_messageType
Definition: SopasBase.hpp:484
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:294
sick_scan_base.h
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:251
devices::SopasBase::COMMAND_Invoke_Method_ByName
static const std::string COMMAND_Invoke_Method_ByName
Definition: SopasBase.hpp:68
devices::SopasBase::EVENTNAME_SUBSCRIBE_EVALCASES
static const std::string EVENTNAME_SUBSCRIBE_EVALCASES
Definition: SopasBase.hpp:39
devices::SopasBase::RI
@ RI
Read Variable.
Definition: SopasBase.hpp:283
SopasAnswer
Class that encapsulates a buffer that was sent as return to a sync call. (variable / method)
Definition: sick_scan_common_nw.h:195
devices::SopasBase::m_state
State m_state
Device info.
Definition: SopasBase.hpp:356
devices::SopasBase::colaA_decodeCommand
SopasCommand colaA_decodeCommand(std::string *rxData)
Definition: SopasBase.cpp:1368
UINT32
uint32_t UINT32
Definition: BasicDatatypes.hpp:72
devices::SopasEventMessage::SopasEventMessage
SopasEventMessage()
Default constructor.
Definition: SopasBase.cpp:2203
devices::SopasBase::m_weWantFieldData
bool m_weWantFieldData
Flag to enable/disable protection field data reception.
Definition: SopasBase.hpp:353
devices::SopasBase::EA
@ EA
Register Event Answer.
Definition: SopasBase.hpp:293
devices::SopasBase::COMMAND_Method_Result_Answer
static const std::string COMMAND_Method_Result_Answer
Definition: SopasBase.hpp:62
devices::SopasBase::SopasMessageType
SopasMessageType
types of answers of the sensor
Definition: SopasBase.hpp:88
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:100
devices::SopasEventMessage::~SopasEventMessage
~SopasEventMessage()
Destructor.
Definition: SopasBase.hpp:427
devices::SopasBase::INDEX_DEVICE_IDENT
static const UINT16 INDEX_DEVICE_IDENT
Definition: SopasBase.hpp:73
devices::SopasBase::SN
@ SN
Send Event (by name, receive)
Definition: SopasBase.hpp:297
devices::SopasBase::SopasProtocol
SopasProtocol
Definition: SopasBase.hpp:75
devices::SopasBase::DecoderFunction
void(* DecoderFunction)(SopasEventMessage &frame)
Definition: SopasBase.hpp:107
devices::SopasBase::evalCaseResultDecoder
virtual void evalCaseResultDecoder(SopasEventMessage &msg)=0
devices::SopasEventMessage::getEncodingType
SopasBase::SopasEncoding getEncodingType() const
Definition: SopasBase.hpp:443
devices::SopasBase::m_ipAddress
std::string m_ipAddress
Definition: SopasBase.hpp:412
devices::SopasBase::VARIABLENAME_SCANCONFIG
static const std::string VARIABLENAME_SCANCONFIG
Definition: SopasBase.hpp:47
devices::SopasBase::setReadOnlyMode
void setReadOnlyMode(bool mode)
Definition: SopasBase.cpp:200
devices::SopasBase::m_scanEventIsRegistered
bool m_scanEventIsRegistered
Definition: SopasBase.hpp:350
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:2278
devices::SopasBase::COMMAND_Send_Event_ByName
static const std::string COMMAND_Send_Event_ByName
Definition: SopasBase.hpp:71
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:134
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:408
devices::SopasBase::MSG_REGISTER_EVENT_ANSWER
@ MSG_REGISTER_EVENT_ANSWER
Register Event Answer.
Definition: SopasBase.hpp:101
devices::SopasBase::EI
@ EI
Register Event.
Definition: SopasBase.hpp:287
devices::SopasBase::convertSopasErrorCodeToText
static std::string convertSopasErrorCodeToText(UINT16 errorCode)
Definition: SopasBase.cpp:916
devices::SopasBase::MSG_UNKNOWN
@ MSG_UNKNOWN
Unknown message.
Definition: SopasBase.hpp:90
devices::SopasBase::VARIABLENAME_SCANDATACONFIG
static const std::string VARIABLENAME_SCANDATACONFIG
Definition: SopasBase.hpp:49
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:360
devices::SopasBase::DecoderFunctionMapByName
std::map< std::string, DecoderFunction > DecoderFunctionMapByName
Definition: SopasBase.hpp:390
devices::SopasBase::METHODNAME_START_MEASURE
static const std::string METHODNAME_START_MEASURE
Definition: SopasBase.hpp:44


sick_scan_xd
Author(s): Michael Lehning , Jochen Sprickerhof , Martin Günther
autogenerated on Fri Oct 25 2024 02:47:12