Go to the documentation of this file.
117 unsigned short portNumber,
187 if (success ==
false)
230 bool beVerboseHere =
false;
232 "SickScanCommonNw::readCallbackFunction(): Called with " +
toString(numOfBytes) +
" available bytes.",
237 UINT32 bytesToBeTransferred = numOfBytes;
238 if (remainingSpace < numOfBytes)
240 bytesToBeTransferred = remainingSpace;
250 if (bytesToBeTransferred > 0)
268 printInfoMessage(
"SickScanCommonNw::readCallbackFunction(): No complete frame in input buffer, we are done.",
278 "SickScanCommonNw::readCallbackFunction(): Processing a frame of length " + ::
toString(frame.
size()) +
279 " bytes.", beVerboseHere);
371 if (magicWord != 0x02020202)
378 if (magicWord == 0x02020202)
405 printInfoMessage(
"SickScanCommonNw::findFrameInReceiveBuffer: Frame cannot be decoded yet, only " +
412 payloadlength = colab::getIntegerFromBuffer<UINT32>(
m_receiveBuffer, pos);
414 "SickScanCommonNw::findFrameInReceiveBuffer: Decoded payload length is " + ::
toString(payloadlength) +
422 "SickScanCommonNw::findFrameInReceiveBuffer: Frame too big for receive buffer. Frame discarded with length:"
431 "SickScanCommonNw::findFrameInReceiveBuffer: Frame not complete yet. Waiting for the rest of it (" +
437 frameLen = payloadlength + 9;
451 for (
UINT16 j = 8; j < (frameLen - 1); j++)
455 temp_xor = temp_xor ^ temp;
459 if (temp_xor != checkSum)
461 printWarning(
"SickScanCommonNw::findFrameInReceiveBuffer: Wrong checksum, Frame discarded.");
496 "SickScanCommonNw::processFrame: Calling processFrame_CoLa_A() with " + ::
toString(frame.
size()) +
" bytes.",
503 "SickScanCommonNw::processFrame: Calling processFrame_CoLa_B() with " + ::
toString(frame.
size()) +
" bytes.",
529 printError(
"SickScanCommonNw::copyFrameToResposeBuffer: Failed to copy frame (Length=" + ::
toString(frameLength) +
530 " bytes) to response buffer because the response buffer is too small (buffer size=" +
548 " bytes from the input buffer. New length is " + ::
toString(newLen) +
" bytes.",
m_beVerbose);
555 printInfoMessage(
"SickScanCommonNw::removeFrameFromReceiveBuffer: Done, no more data in input buffer.",
566 m_buffer(
NULL), m_protocol(
CoLa_A), m_frameLength(0)
572 m_buffer(buffer), m_protocol(protocol), m_frameLength(frameLength)
592 return payLoadLength;
604 std::string commandString;
609 commandString = std::string((
char *) &
m_buffer[2], 2);
612 commandString = std::string((
char *) &
m_buffer[9], 2);
615 return commandString;
673 printError(
"SopasEventMessage::getVariableIndex: Unknown protocol!");
BYTE * getPayLoad()
contains 's' + command string(2 byte) + content(payload length - 3)
bool sendCommandBuffer(UINT8 *buffer, UINT16 len)
bool connect()
Connects to a sensor via tcp and reads the device name.
Mutex m_receiveDataMutex
Access mutex for buffer.
UINT32 m_numberOfBytesInReceiveBuffer
Number of bytes in buffer.
void readCallbackFunction(UINT8 *buffer, UINT32 &numOfBytes)
UINT32 m_numberOfBytesInResponseBuffer
Number of bytes in buffer.
bool disconnect()
Closes the connection to the LMS. This is the opposite of init().
void(* DisconnectFunction)(void *obj)
void(* ReadFunction)(void *obj, UINT8 *inputBuffer, UINT32 &numBytes)
void removeFrameFromReceiveBuffer(UINT32 frameLength)
#define printInfoMessage(a, b)
@ CoLa_A
Command Language ASCI.
void printWarning(std::string message)
BYTE * getRawData()
get SOPAS raw data include header and CRC
bool write(UINT8 *buffer, UINT32 numberOfBytes)
void setDisconnectCallbackFunction(DisconnectFunction discFunction, void *obj)
static void readCallbackFunctionS(void *obj, UINT8 *buffer, UINT32 &numOfBytes)
Function that will be called on incomming data via tcp.
UINT8 m_receiveBuffer[25000]
Low-Level receive buffer for all data (25000 should be enough for NAV300 Events)
UINT16 decodeUINT16(BYTE *buffer)
bool init(std::string ipAddress, unsigned short portNumber, Tcp::DisconnectFunction disconnectFunction, void *obj)
void printError(std::string message)
UINT8 m_responseBuffer[1024]
Receive buffer for everything except scan data and eval case data.
void setReadCallbackFunction(ReadFunction readFunction, void *obj)
SopasEventMessage findFrameInReceiveBuffer()
uint64_t getNanosecTimestampLastTcpMessageReceived(void)
void closeTcpConnection()
UINT32 getPayLoadLength() const
contains 's' + command string(2 byte) + content(payload length - 3)
bool setReadCallbackFunction(Tcp::ReadFunction readFunction, void *obj)
SopasEventMessage()
Default constructor.
void processFrame(SopasEventMessage &frame)
@ CoLa_B
Command Language binary.
bool isConnected()
Returns true if the tcp connection is established.
@ CONSTRUCTED
Object has been constructed. Use init() to go into CONNECTED state.
UINT16 decodeUINT16(BYTE *buffer)
INT32 getVariableIndex()
Returns the index of a variable (answer to read variable by index). In case of error a negative value...
Class that represents a message that was sent by a sensor. (Event message)
uint64_t getNanosecTimestampLastTcpMessageReceived(void)
std::string getCommandString() const
Returns two character long command.
void copyFrameToResposeBuffer(UINT32 frameLength)
bool open(std::string ipAddress, UINT16 port, bool enableVerboseDebugOutput=false)
sick_scan_xd
Author(s): Michael Lehning
, Jochen Sprickerhof , Martin Günther
autogenerated on Fri Oct 25 2024 02:47:10