Go to the documentation of this file.
17 #define SOPASBASE_VERSION "1.0.0"
95 std::string ipAddress,
153 printError(
"SopasBase::connect: Failed to read scanner type and version.");
157 if (success ==
false)
159 printWarning(
"SopasBase::connect: Initialisation failed!");
224 if (success ==
false)
226 printError(
"SopasBase::openTcpConnection: ERROR: Failed to establish TCP connection, aborting!");
251 ((
SopasBase*)obj)->readCallbackFunction(buffer, numOfBytes);
261 bool beVerboseHere =
false;
262 printInfoMessage(
"SopasBase::readCallbackFunction(): Called with " +
toString(numOfBytes) +
" available bytes.", beVerboseHere);
266 UINT32 bytesToBeTransferred = numOfBytes;
267 if (remainingSpace < numOfBytes)
269 bytesToBeTransferred = remainingSpace;
270 printWarning(
"SopasBase::readCallbackFunction(): Input buffer space is to small, transferring only " +
271 ::
toString(bytesToBeTransferred) +
" of " + ::
toString(numOfBytes) +
" bytes.");
276 " bytes from TCP to input buffer.", beVerboseHere);
279 if (bytesToBeTransferred > 0)
297 printInfoMessage(
"SopasBase::readCallbackFunction(): No complete frame in input buffer, we are done.", beVerboseHere);
305 printInfoMessage(
"SopasBase::readCallbackFunction(): Processing a frame of length " + ::
toString(frame.
size()) +
" bytes.", beVerboseHere);
318 printInfoMessage(
"SopasBase::readCallbackFunction(): Leaving. Current input buffer fill level is " +
400 if (magicWord != 0x02020202)
407 if (magicWord == 0x02020202)
434 printInfoMessage(
"SopasBase::findFrameInReceiveBuffer: Frame cannot be decoded yet, only " +
441 payloadlength = colab::getIntegerFromBuffer<UINT32>(
m_receiveBuffer, pos);
448 printWarning(
"SopasBase::findFrameInReceiveBuffer: Frame too big for receive buffer. Frame discarded with length:"
456 printInfoMessage(
"SopasBase::findFrameInReceiveBuffer: Frame not complete yet. Waiting for the rest of it (" +
462 frameLen = payloadlength + 9;
476 for (
UINT16 i = 8; i < (frameLen - 1); i++)
480 temp_xor = temp_xor ^ temp;
484 if (temp_xor != checkSum)
486 printWarning(
"SopasBase::findFrameInReceiveBuffer: Wrong checksum, Frame discarded.");
507 UINT8 sendBuffer[1024];
550 printWarning(
"SopasBase::receiveAnswer: Wrong protocol (is either not CoLa-A or CoLa-B).");
577 printWarning(
"SopasBase::receiveAnswer: Wrong protocol (is either not CoLa-A or CoLa-B).");
606 printInfoMessage(
"SopasBase::receiveAnswer_CoLa_A: Response received (len= " +
614 if (rxData.length() > 0)
619 if (
cmd == receivedCommand)
623 if (receivedCommand ==
WA)
631 if (receivedIndex == index)
642 else if (receivedCommand ==
EA)
645 printInfoMessage(
"SopasBase::receiveAnswer_CoLa_A: Event (by index) successfully (un)registered: " +
659 else if (receivedCommand ==
FA)
704 printInfoMessage(
"SopasBase::receiveAnswer_CoLa_A: Response received (len= " +
711 if (rxData.length() > 0)
716 if (
cmd == receivedCommand)
720 if (receivedCommand ==
WA)
728 if (receivedName ==
name)
739 else if (receivedCommand ==
EA)
755 else if (receivedCommand ==
FA)
757 printInfoMessage(
"SopasBase:: Error answer received: FA " + rxData +
".",
true);
787 std::string receivedName;
816 if (receivedCommand ==
FA)
821 printWarning(
"SopasBase::receiveAnswer_CoLa_B: Error from sensor! Code=" +
toString(errorCode) +
827 if (
cmd != receivedCommand)
845 if (
name != receivedName)
855 if (receivedCommand ==
WA)
863 else if (receivedCommand ==
EA)
870 else if (receivedCommand ==
AN )
877 else if (receivedCommand ==
RA)
887 printInfoMessage(
"SopasBase::receiveAnswer_CoLa_B: Unkown Sopas command.",
true);
923 return "Sopas_Error_METHODIN_ACCESSDENIED";
925 return "Sopas_Error_METHODIN_UNKNOWNINDEX";
927 return "Sopas_Error_VARIABLE_UNKNOWNINDEX";
929 return "Sopas_Error_LOCALCONDITIONFAILED";
931 return "Sopas_Error_INVALID_DATA";
933 return "Sopas_Error_UNKNOWN_ERROR";
935 return "Sopas_Error_BUFFER_OVERFLOW";
937 return "Sopas_Error_BUFFER_UNDERFLOW";
939 return "Sopas_Error_ERROR_UNKNOWN_TYPE";
941 return "Sopas_Error_VARIABLE_WRITE_ACCESSDENIED";
943 return "Sopas_Error_UNKNOWN_CMD_FOR_NAMESERVER";
945 return "Sopas_Error_UNKNOWN_COLA_COMMAND";
947 return "Sopas_Error_METHODIN_SERVER_BUSY";
949 return "Sopas_Error_FLEX_OUT_OF_BOUNDS";
951 return "Sopas_Error_EVENTREG_UNKNOWNINDEX";
953 return "Sopas_Error_COLA_A_VALUE_OVERFLOW";
955 return "Sopas_Error_COLA_A_INVALID_CHARACTER";
957 return "Sopas_Error_OSAI_NO_MESSAGE";
959 return "Sopas_Error_OSAI_NO_ANSWER_MESSAGE";
961 return "Sopas_Error_INTERNAL";
963 return "Sopas_Error_HubAddressCorrupted";
965 return "Sopas_Error_HubAddressDecoding";
967 return "Sopas_Error_HubAddressAddressExceeded";
969 return "Sopas_Error_HubAddressBlankExpected";
971 return "Sopas_Error_AsyncMethodsAreSuppressed";
973 return "Sopas_Error_ComplexArraysNotSupported";
975 return "(unknown_Sopas_error_code)";
978 return "(unknown_Sopas_error_code)";
989 printInfoMessage(
"SopasBase::receiveAnswer_CoLa_B_idx: Entering function.", beVerboseHere);
1004 printInfoMessage(
"SopasBase::receiveAnswer_CoLa_B_idx: There is something in receive buffer.", beVerboseHere);
1022 if (receivedCommand ==
FA)
1026 printWarning(
"SopasBase::receiveAnswer_CoLa_B_idx: Error from sensor! Code=" +
toString(receivedIndex) +
1032 else if (index != receivedIndex)
1037 printInfoMessage(
"SopasBase::receiveAnswer_CoLa_B_idx: This is not the index we are waiting for (expected="
1038 +
toString(index) +
", received=" +
toString(receivedIndex) +
")." , beVerboseHere);
1043 else if (
cmd != receivedCommand)
1053 else if (receivedCommand ==
WA)
1056 printInfoMessage(
"SopasBase::receiveAnswer_CoLa_B_idx: Variable successfully set.", beVerboseHere);
1061 else if (receivedCommand ==
EA)
1064 printInfoMessage(
"SopasBase::receiveAnswer_CoLa_B_idx: Event successfully (un)registered: " + ::
toString(receivedIndex) +
".", beVerboseHere);
1069 else if (receivedCommand ==
AI )
1072 printInfoMessage(
"SopasBase::receiveAnswer_CoLa_B_idx: Answer to method call with index " + ::
toString(receivedIndex) +
".", beVerboseHere);
1078 else if (receivedCommand ==
RA)
1081 printInfoMessage(
"SopasBase::receiveAnswer_CoLa_B_idx: Answer to read variable with index " + ::
toString(receivedIndex) +
".", beVerboseHere);
1090 printWarning(
"SopasBase::receiveAnswer_CoLa_B_idx: Unknown Sopas command.");
1097 printInfoMessage(
"SopasBase::receiveAnswer_CoLa_B_idx: Untreated Sopas command.", beVerboseHere);
1110 printInfoMessage(
"SopasBase::receiveAnswer_CoLa_B_idx: Leaving with timeout.", beVerboseHere);
1150 assert (
command.length() == 2);
1158 if (frame.
size() > 8)
1161 std::string eventName;
1178 printWarning(
"SopasBase::Received an unknown event! Event name is: " + eventName +
".");
1245 bool frameWasProcessed =
false;
1248 if (frame.
size() > 12)
1252 std::string eventName;
1260 eventIndex = colab::getIntegerFromBuffer<UINT16>(
m_receiveBuffer, pos);
1268 frameWasProcessed =
true;
1273 frameWasProcessed =
true;
1281 printWarning(
"SopasBase::processFrame_CoLa_B: Decoding of events by name is not implemented yet.");
1286 if (frameWasProcessed ==
false)
1289 printWarning(
"SopasBase::processFrame_CoLa_B: Don't know how to process the incoming event with the short name <" +
1290 eventName +
"> and the index " + ::
toString(eventIndex) +
", ignoring it!");
1296 printWarning(
"SopasBase::processFrame_CoLa_B: Received a very short (and unknown) event! Frame length is " + ::
toString(frame.
size()) +
" bytes.");
1329 printError(
"SopasBase::copyFrameToResposeBuffer: Failed to copy frame (Length=" + ::
toString(frameLength) +
1330 " bytes) to response buffer because the response buffer is too small (buffer size=" +
1349 " bytes from the input buffer. New length is " + ::
toString(newLen) +
" bytes.",
m_beVerbose);
1378 if (cmdString ==
"RN")
1384 else if (cmdString ==
"AN")
1389 else if (cmdString ==
"SN")
1395 if (cmdString ==
"RI")
1399 else if (cmdString ==
"WI")
1403 else if (cmdString ==
"MI")
1407 else if (cmdString ==
"AI")
1411 else if (cmdString ==
"EI")
1415 else if (cmdString ==
"SI")
1421 else if (cmdString ==
"RA")
1425 else if (cmdString ==
"WA")
1429 else if (cmdString ==
"MA")
1433 else if (cmdString ==
"AA")
1437 else if (cmdString ==
"EA")
1441 else if (cmdString ==
"SA")
1445 else if (cmdString ==
"FA")
1452 printError(
"SopasBase::stringToSopasCommand: Trying to resolve an unknown command: " + cmdString +
".");
1534 printError(
"SopasBase::sopasCommandToString: Trying to resolve an unknown command!");
1552 bool result =
false;
1561 if (result && answer !=
NULL && answer->
isValid())
1565 std::string colaaAnswer;
1569 colaaAnswer = std::string((
char*)answer->
getBuffer(), answer->
size());
1609 *rxData = rxData->substr(len + 1);
1633 fieldLength = colab::getIntegerFromBuffer<UINT16>(buffer, pos);
1637 fieldLength = colab::getIntegerFromBuffer<UINT16>(buffer, pos);
1651 BYTE cmdBuffer[128];
1658 cmdBuffer[cmdBufferLen++] =
' ';
1662 if (parametersLength > 0)
1664 cmdBuffer[cmdBufferLen++] =
' ';
1670 colab::addIntegerToBuffer<UINT16>(cmdBuffer, cmdBufferLen, methodeName.size());
1675 if (parametersLength > 0)
1678 memcpy(&cmdBuffer[cmdBufferLen], parameters, parametersLength);
1679 cmdBufferLen += parametersLength;
1685 ROS_ERROR(
"## ERROR in SopasBase::invokeMethod(): sendCommandBuffer failed")
1699 printWarning(
"SopasBase::invokeMethod: Calling of " + methodeName +
" was NOT successful.");
1712 BYTE cmdBuffer[128];
1718 printError(
"SopasBase::invokeMethod: Invoke method cola-a by index not supported.");
1724 colab::addIntegerToBuffer<UINT16>(cmdBuffer, cmdBufferLen, index);
1728 if (parametersLength > 0)
1731 memcpy(&cmdBuffer[cmdBufferLen], parameters, parametersLength);
1732 cmdBufferLen += parametersLength;
1738 ROS_ERROR(
"## ERROR in SopasBase::invokeMethod(): sendCommandBuffer failed")
1752 printWarning(
"SopasBase::invokeMethod: Calling of method with index=" + ::
toString(index) +
" was NOT successful.");
1765 BYTE cmdBuffer[128];
1771 cmdBuffer[cmdBufferLen++] =
' ';
1778 cmdBuffer[cmdBufferLen++] =
' ';
1785 ROS_ERROR(
"## ERROR in SopasBase::readVariable(): sendCommandBuffer failed")
1798 printWarning(
"SopasBase::readVariable: Answer to " + variableName +
" not successful.");
1811 BYTE cmdBuffer[128];
1817 cmdBuffer[cmdBufferLen++] =
' ';
1823 colab::addIntegerToBuffer<UINT16>(cmdBuffer, cmdBufferLen, index);
1829 ROS_ERROR(
"## ERROR in SopasBase::readVariable(): sendCommandBuffer failed")
1854 printInfoMessage(
"SopasBase::writeVariable: ReadOnly Modus - ignore writing to variable '" +
1860 BYTE cmdBuffer[128];
1866 cmdBuffer[cmdBufferLen++] =
' ';
1868 if (parametersLength > 0)
1870 cmdBuffer[cmdBufferLen++] =
' ';
1875 printError(
"SopasBase::writeVariable: Write variable cola-b by Name: NOT IMPLEMENTED");
1886 if (parametersLength > 0)
1889 memcpy(&cmdBuffer[cmdBufferLen], parameters, parametersLength);
1890 cmdBufferLen += parametersLength;
1897 ROS_ERROR(
"## ERROR in SopasBase::writeVariable(): sendCommandBuffer failed")
1932 printInfoMessage(
"SopasBase::writeVariable: ReadOnly Modus - ignore writing to variable index '" + ::
toString(variableIndex) +
1938 UINT32 cmdBufferLen = parametersLength + 4;
1939 BYTE* cmdBuffer =
new BYTE[cmdBufferLen];
1945 BYTE* buffer = &(cmdBuffer[2]);
1951 memcpy(&(cmdBuffer[4]), parameters, parametersLength);
1954 printInfoMessage(
"SopasBase::writeVariable: Sending command buffer now (payload len=" +
toString(parametersLength+4) +
" bytes).", beVerboseHere);
1957 ROS_ERROR(
"## ERROR in SopasBase::writeVariable(): sendCommandBuffer failed")
1961 printInfoMessage(
"SopasBase::writeVariable: Command sent, waiting for reply...", beVerboseHere);
1976 printWarning(
"SopasBase::writeVariable: Answer to " +
toString(variableIndex) +
" not successful!");
1979 printInfoMessage(
"SopasBase::writeVariable: All done, leaving.", beVerboseHere);
1987 BYTE cmdBuffer[128];
1993 cmdBuffer[cmdBufferLen++] =
' ';
1995 cmdBuffer[cmdBufferLen++] =
' ';
1996 cmdBuffer[cmdBufferLen++] =
'1';
2002 cmdBuffer[cmdBufferLen++] =
' ';
2004 cmdBuffer[cmdBufferLen++] =
' ';
2005 colab::addIntegerToBuffer<UINT8>(cmdBuffer, cmdBufferLen, 1);
2013 ROS_ERROR(
"## ERROR in SopasBase::registerEvent(): sendCommandBuffer failed")
2036 BYTE cmdBuffer[128];
2042 printError(
"SopasBase::register event cola-a by index not supported, aborting.");
2049 colab::addIntegerToBuffer<UINT16>(cmdBuffer, cmdBufferLen, index);
2050 colab::addIntegerToBuffer<UINT8>(cmdBuffer, cmdBufferLen, 1);
2057 ROS_ERROR(
"## ERROR in SopasBase::registerEvent(): sendCommandBuffer failed")
2078 printError(
"SopasBase::registerEvent: Calling of method with index=" + ::
toString(index) +
" was NOT successful.");
2088 BYTE cmdBuffer[128];
2094 printError(
"SopasBase::unregisterEvent: Unregister event cola-a by index not supported.");
2101 colab::addIntegerToBuffer<UINT16>(cmdBuffer, cmdBufferLen, index);
2102 colab::addIntegerToBuffer<UINT8>(cmdBuffer, cmdBufferLen, 0);
2109 ROS_ERROR(
"## ERROR in SopasBase::unregisterEvent(): sendCommandBuffer failed")
2140 BYTE cmdBuffer[128];
2146 cmdBuffer[cmdBufferLen++] =
' ';
2148 cmdBuffer[cmdBufferLen++] =
' ';
2149 cmdBuffer[cmdBufferLen++] =
'0';
2155 cmdBuffer[cmdBufferLen++] =
' ';
2157 cmdBuffer[cmdBufferLen++] =
' ';
2158 colab::addIntegerToBuffer<UINT8>(cmdBuffer, cmdBufferLen, 0);
2165 ROS_ERROR(
"## ERROR in SopasBase::unregisterEvent(): sendCommandBuffer failed")
2195 return ::normalizeRadians(
angle);
2211 m_buffer(buffer), m_protocol(protocol), m_frameLength(frameLength), m_encoding(
SopasBase::ByName)
2221 UINT32 payLoadLength = 0;
2232 return payLoadLength;
2239 std::string commandString;
2244 commandString = std::string((
char*) &
m_buffer[2], 2);
2247 commandString = std::string((
char*) &
m_buffer[9], 2);
2250 return commandString;
2285 printWarning(
"SopasEventMessage::getVariableIndex: Encoding is not ByIndex, aborting!");
2299 printError(
"SopasEventMessage::getVariableIndex: Unknown protocol!");
2319 printError(
"SopasEventMessage::getVariableName: Protocol CoLa-A is not supported, aborting!");
2394 if (answerLength > 0)
static const std::string VARIABLENAME_DEVICEIDENT
@ WA
Write Variable Answer.
@ CoLa_A
Command Language ASCI.
bool invokeMethod(const std::string &methodeName, BYTE *parameters, UINT16 parametersLength, SopasAnswer *&answer)
Invoke a method on the sensor.
UINT32 m_numberOfBytesInResponseBuffer
Number of bytes in buffer.
static const std::string COMMAND_Event_Acknowledge
bool unregisterEvent(const std::string &eventName)
Unregisters an event by name.
SopasBase::SopasEncoding m_encoding
@ RN
Read Variable (by name)
UINT32 m_numberOfBytesInReceiveBuffer
Number of bytes in buffer.
TFSIMD_FORCE_INLINE tfScalar angle(const Quaternion &q1, const Quaternion &q2)
SopasBase::SopasMessageType getMessageType() const
~SopasAnswer()
Destructor. Frees the memory for the copied buffer.
bool connect()
Connects to a sensor via tcp and reads the device name.
static const std::string COMMAND_Write_Variable_ByIndex
static const std::string METHODNAME_SET_SCANCONFIG
@ MSG_READ_VARIABLE_ANSWER
Read Variable Answer.
void processFrame_CoLa_B(SopasEventMessage &frame)
@ CoLa_B
Command Language binary.
static const std::string COMMAND_Method_Result_ByName
std::string m_scannerVersion
Read from scanner.
static const std::string COMMAND_Register_Event_Answer
SopasBase()
Default constructor.
static const std::string COMMAND_Read_Variable_ByName
void addFrameToBuffer(UINT8 *sendBuffer, UINT8 *cmdBuffer, UINT16 *len)
static const std::string COMMAND_Read_Variable_Answer
SopasAnswer(const BYTE *answer, UINT32 answerLength)
Constructor. Copies the content of the answer into the buffer of this object.
@ MSG_INVOKE_METHOD_ANSWER
Invoke Method Answer.
SopasBase::SopasProtocol m_protocol
void(* DisconnectFunction)(void *obj)
SopasEventMessage findFrameInReceiveBuffer()
Depending on the protocol the start and end of a frame will be found.
bool registerEvent(const std::string &eventName)
Registers an event by name.
void colaA_decodeScannerTypeAndVersion(std::string *rxData)
std::string getNextStringToken(std::string *rxData)
static const std::string COMMAND_Invoke_Method_ByIndex
static const std::string COMMAND_Write_Variable_ByName
void readCallbackFunction(UINT8 *buffer, UINT32 &numOfBytes)
static const std::string METHODNAME_LOGIN
SopasCommand stringToSopasCommand(const std::string &cmdString)
Converts strings in sopas answer buffer to SopasCommand enum.
@ ByIndex
read/write variable, invoke methods by index (indexes will be generated !!!)
static const std::string COMMAND_Read_Variable_ByIndex
@ RA
Read Variable Answer.
UINT32 getPayLoadLength() const
contains 's' + command string(2 byte) + content(payload length - 3)
std::string convertRxBufferToString(UINT8 *buffer, UINT16 bufferLen)
double makeAngleValid(double angle)
static const std::string COMMAND_Send_Event_ByIndex
std::string getStringFromBuffer(UINT8 *buffer, UINT16 &pos, UINT16 length)
@ MSG_WRITE_VARIABLE_ANSWER
Write Variable Answer.
static const std::string COMMAND_Register_Event_ByIndex
static const std::string COMMAND_Invoke_Method_Answer
#define printInfoMessage(a, b)
@ CMD_UNKNOWN
Unknown command.
@ CoLa_A
Command Language ASCI.
void printWarning(std::string message)
std::string getVariableName()
Returns the name of a variable (answer to read variable by name). In case of error an empty value wil...
@ MA
Invoke Method Answer.
bool write(UINT8 *buffer, UINT32 numberOfBytes)
BYTE * getPayLoad()
contains 's' + command string(2 byte) + content(payload length - 3)
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...
void setDisconnectCallbackFunction(DisconnectFunction discFunction, void *obj)
static const std::string COMMAND_Write_Variable_Answer
uint64_t getNanosecTimestampLastTcpMessageReceived(void)
void usleep(__int64 usec)
@ CONSTRUCTED
Object has been constructed. Use init() to go into CONNECTED state.
void colaB_decodeScannerTypeAndVersion(UINT8 *buffer, UINT16 pos)
bool action_getScannerTypeAndVersion()
Reads the scanner type and version variable from the sensor and stores it in the member variables....
UINT8 m_responseBuffer[1024]
Receive buffer for everything except scan data and eval case data.
bool isConnected()
Returns true if the tcp connection is established.
Mutex m_receiveDataMutex
Access mutex for buffer.
void closeTcpConnection()
Class that represents a message that was sent by a sensor. (Event message)
static const std::string VARIABLENAME_DATAOUTPUTRANGE
DecoderFunctionMapByName m_decoderFunctionMapByName
@ ByName
read/write variable, invoke methods by name
std::string sopasCommandToString(SopasCommand cmd)
@ MSG_EVENT_ACKNOWLEDGE
Event Acknowledge -Answer to register event.
std::string getCommandString() const
UINT16 decodeUINT16(BYTE *buffer)
@ MSG_SEND_EVENT
Send Event.
Class that encapsulates a buffer that was sent as return to a sync call. (variable / method)
static const std::string METHODNAME_LOGOUT
bool receiveAnswer_CoLa_B(SopasCommand cmd, std::string name, UINT32 timeout, SopasAnswer *&answer)
static const std::string COMMAND_Register_Event_ByName
void printError(std::string message)
@ AN
Method Result (ny name)
@ AA
Method Result Answer.
std::string m_scannerName
Read from scanner.
virtual ~SopasBase()
Destructor.
void setReadCallbackFunction(ReadFunction readFunction, void *obj)
bool readVariable(const std::string &variableName, SopasAnswer *&answer)
Reads a variable from the sensor by name.
bool sendCommandBuffer(UINT8 *buffer, UINT16 len)
Sends the content of the buffer via TCP to the sensor.
static const std::string METHODNAME_STOP_MEASURE
virtual void scanDataDecoder(SopasEventMessage &msg)=0
IndexToNameMap m_indexToNameMap
std::string decodeString(std::string *rxData, UINT16 len)
uint64_t getNanosecTimestampLastTcpMessageReceived(void)
static const std::string COMMAND_Method_Result_ByIndex
UINT16 addUINT32ToBuffer(UINT8 *buffer, UINT32 value)
static const std::string EVENTNAME_SUBSCRIBE_SCANS
bool receiveAnswer_CoLa_A(SopasCommand cmd, std::string name, UINT32 timeout, SopasAnswer *&answer)
bool writeVariable(const std::string &variableName, BYTE *parameters, UINT16 parametersLength)
Write a variable to the sensor by name.
bool disconnect()
Closes the connection to the LMS. This is the opposite of init().
UINT16 addStringToBuffer(UINT8 *buffer, const std::string &text)
bool m_weWantScanData
Flag to enable/disable scan data reception.
SopasProtocol m_protocol
Used protocol (ColaA oder ColaB)
void copyFrameToResposeBuffer(UINT32 frameLength)
SopasBase::SopasMessageType m_messageType
static void readCallbackFunctionS(void *obj, UINT8 *buffer, UINT32 &numOfBytes)
Function that will be called on incomming data via tcp.
void processFrame_CoLa_A(SopasEventMessage &frame)
static const std::string COMMAND_Invoke_Method_ByName
static const std::string EVENTNAME_SUBSCRIBE_EVALCASES
State m_state
Device info.
SopasCommand colaA_decodeCommand(std::string *rxData)
SopasEventMessage()
Default constructor.
bool m_weWantFieldData
Flag to enable/disable protection field data reception.
@ EA
Register Event Answer.
static const std::string COMMAND_Method_Result_Answer
void removeFrameFromReceiveBuffer(UINT32 frameLength)
@ MSG_METHOD_RESULT_ANSWER
Method Result Answer.
ROSLIB_DECL std::string command(const std::string &cmd)
Runs a rospack command of the form 'rospack <cmd>', returning the output as a single string.
static const UINT16 INDEX_DEVICE_IDENT
@ SN
Send Event (by name, receive)
virtual void evalCaseResultDecoder(SopasEventMessage &msg)=0
SopasBase::SopasEncoding getEncodingType() const
UINT16 decodeUINT16(BYTE *buffer)
static const std::string VARIABLENAME_SCANCONFIG
void setReadOnlyMode(bool mode)
void addFrameToBuffer(UINT8 *sendBuffer, UINT8 *cmdBuffer, UINT16 *len)
INT32 getVariableIndex()
Returns the index of a variable (answer to read variable by index). In case of error a negative value...
static const std::string COMMAND_Send_Event_ByName
virtual bool init(SopasProtocol protocol, std::string ipAddress, UINT16 portNumber, bool weWantScanData, bool weWantFieldData, bool readOnlyMode, Tcp::DisconnectFunction disconnectFunction, void *obj)
Initialization.
UINT8 m_receiveBuffer[25000]
Low-Level receive buffer for all data (25000 should be enough for NAV300 Events)
void addStringToBuffer(UINT8 *buffer, UINT16 &pos, const std::string &stringValue)
static std::string convertSopasErrorCodeToText(UINT16 errorCode)
@ MSG_UNKNOWN
Unknown message.
static const std::string VARIABLENAME_SCANDATACONFIG
void processFrame(SopasEventMessage &frame)
Reads one frame from receive buffer and decodes it.
std::string getCommandStringFromBuffer(UINT8 *buffer)
bool open(std::string ipAddress, UINT16 port, bool enableVerboseDebugOutput=false)
static const std::string METHODNAME_START_MEASURE
std::string getIdentifierFromBuffer(UINT8 *buffer, UINT16 &nextData, UINT16 bufferLength)
sick_scan_xd
Author(s): Michael Lehning
, Jochen Sprickerhof , Martin Günther
autogenerated on Fri Oct 25 2024 02:47:12