Go to the documentation of this file.
71 unsigned short portNumber,
141 if (success ==
false)
177 bool beVerboseHere =
false;
179 "SickScanCommonNw::readCallbackFunction(): Called with " +
toString(numOfBytes) +
" available bytes.",
184 UINT32 bytesToBeTransferred = numOfBytes;
185 if (remainingSpace < numOfBytes)
187 bytesToBeTransferred = remainingSpace;
197 if (bytesToBeTransferred > 0)
215 printInfoMessage(
"SickScanCommonNw::readCallbackFunction(): No complete frame in input buffer, we are done.",
225 "SickScanCommonNw::readCallbackFunction(): Processing a frame of length " + ::
toString(frame.
size()) +
226 " bytes.", beVerboseHere);
318 if (magicWord != 0x02020202)
325 if (magicWord == 0x02020202)
352 printInfoMessage(
"SickScanCommonNw::findFrameInReceiveBuffer: Frame cannot be decoded yet, only " +
359 payloadlength = colab::getIntegerFromBuffer<UINT32>(
m_receiveBuffer, pos);
361 "SickScanCommonNw::findFrameInReceiveBuffer: Decoded payload length is " + ::
toString(payloadlength) +
369 "SickScanCommonNw::findFrameInReceiveBuffer: Frame too big for receive buffer. Frame discarded with length:"
378 "SickScanCommonNw::findFrameInReceiveBuffer: Frame not complete yet. Waiting for the rest of it (" +
384 frameLen = payloadlength + 9;
398 for (
UINT16 i = 8; i < (frameLen - 1); i++)
402 temp_xor = temp_xor ^ temp;
406 if (temp_xor != checkSum)
408 printWarning(
"SickScanCommonNw::findFrameInReceiveBuffer: Wrong checksum, Frame discarded.");
443 "SickScanCommonNw::processFrame: Calling processFrame_CoLa_A() with " + ::
toString(frame.
size()) +
" bytes.",
450 "SickScanCommonNw::processFrame: Calling processFrame_CoLa_B() with " + ::
toString(frame.
size()) +
" bytes.",
476 printError(
"SickScanCommonNw::copyFrameToResposeBuffer: Failed to copy frame (Length=" + ::
toString(frameLength) +
477 " bytes) to response buffer because the response buffer is too small (buffer size=" +
495 " bytes from the input buffer. New length is " + ::
toString(newLen) +
" bytes.",
m_beVerbose);
502 printInfoMessage(
"SickScanCommonNw::removeFrameFromReceiveBuffer: Done, no more data in input buffer.",
513 m_buffer(NULL), m_protocol(
CoLa_A), m_frameLength(0)
519 m_buffer(buffer), m_protocol(protocol), m_frameLength(frameLength)
539 return payLoadLength;
551 std::string commandString;
556 commandString = std::string((
char *) &
m_buffer[2], 2);
559 commandString = std::string((
char *) &
m_buffer[9], 2);
562 return commandString;
575 BYTE *bufferPos = NULL;
599 BYTE *bufferPos = NULL;
620 printError(
"SopasEventMessage::getVariableIndex: Unknown protocol!");
BYTE * getPayLoad()
contains 's' + command string(2 byte) + content(payload length - 3)
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)
void sendCommandBuffer(UINT8 *buffer, UINT16 len)
UINT8 m_responseBuffer[1024]
Receive buffer for everything except scan data and eval case data.
void setReadCallbackFunction(ReadFunction readFunction, void *obj)
SopasEventMessage findFrameInReceiveBuffer()
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)
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
Author(s): Michael Lehning
, Jochen Sprickerhof , Martin Günther
autogenerated on Thu Sep 8 2022 02:30:19