11 #include "../manager.hpp" 12 #include "../tools/errorhandler.hpp" 13 #include "../tools/toolbox.hpp" 14 #include "../tools/Mutex.hpp" 19 #define SOPASBASE_VERSION "1.0.0" 97 std::string ipAddress,
100 bool weWantFieldData,
155 printError(
"SopasBase::connect: Failed to read scanner type and version.");
159 if (success ==
false)
161 printWarning(
"SopasBase::connect: Initialisation failed!");
226 if (success ==
false)
228 printError(
"SopasBase::openTcpConnection: ERROR: Failed to establish TCP connection, aborting!");
253 ((
SopasBase*)obj)->readCallbackFunction(buffer, numOfBytes);
263 bool beVerboseHere =
false;
264 printInfoMessage(
"SopasBase::readCallbackFunction(): Called with " +
toString(numOfBytes) +
" available bytes.", beVerboseHere);
268 UINT32 bytesToBeTransferred = numOfBytes;
269 if (remainingSpace < numOfBytes)
271 bytesToBeTransferred = remainingSpace;
272 printWarning(
"SopasBase::readCallbackFunction(): Input buffer space is to small, transferring only " +
273 ::
toString(bytesToBeTransferred) +
" of " + ::
toString(numOfBytes) +
" bytes.");
278 " bytes from TCP to input buffer.", beVerboseHere);
281 if (bytesToBeTransferred > 0)
285 m_numberOfBytesInReceiveBuffer += bytesToBeTransferred;
299 printInfoMessage(
"SopasBase::readCallbackFunction(): No complete frame in input buffer, we are done.", beVerboseHere);
307 printInfoMessage(
"SopasBase::readCallbackFunction(): Processing a frame of length " + ::
toString(frame.
size()) +
" bytes.", beVerboseHere);
320 printInfoMessage(
"SopasBase::readCallbackFunction(): Leaving. Current input buffer fill level is " +
357 if (i >= m_numberOfBytesInReceiveBuffer)
360 m_numberOfBytesInReceiveBuffer = 0;
365 UINT32 newLen = m_numberOfBytesInReceiveBuffer - i;
367 m_numberOfBytesInReceiveBuffer = newLen;
380 if (i >= m_numberOfBytesInReceiveBuffer)
402 if (magicWord != 0x02020202)
409 if (magicWord == 0x02020202)
427 memmove(&(m_receiveBuffer[0]), &(m_receiveBuffer[i]), bytesToMove);
436 printInfoMessage(
"SopasBase::findFrameInReceiveBuffer: Frame cannot be decoded yet, only " +
443 payloadlength = colab::getIntegerFromBuffer<UINT32>(
m_receiveBuffer, pos);
447 if (payloadlength > (
sizeof(m_receiveBuffer) - 9))
450 printWarning(
"SopasBase::findFrameInReceiveBuffer: Frame too big for receive buffer. Frame discarded with length:" 458 printInfoMessage(
"SopasBase::findFrameInReceiveBuffer: Frame not complete yet. Waiting for the rest of it (" +
464 frameLen = payloadlength + 9;
478 for (
UINT16 i = 8; i < (frameLen - 1); i++)
482 temp_xor = temp_xor ^ temp;
486 if (temp_xor != checkSum)
488 printWarning(
"SopasBase::findFrameInReceiveBuffer: Wrong checksum, Frame discarded.");
509 UINT8 sendBuffer[1024];
552 printWarning(
"SopasBase::receiveAnswer: Wrong protocol (is either not CoLa-A or CoLa-B).");
579 printWarning(
"SopasBase::receiveAnswer: Wrong protocol (is either not CoLa-A or CoLa-B).");
601 for (
UINT32 i = 0; i < timeout; i++)
608 printInfoMessage(
"SopasBase::receiveAnswer_CoLa_A: Response received (len= " +
616 if (rxData.length() > 0)
621 if (cmd == receivedCommand)
625 if (receivedCommand ==
WA)
633 if (receivedIndex == index)
636 if (cmd ==
RA || cmd ==
AN)
644 else if (receivedCommand ==
EA)
647 printInfoMessage(
"SopasBase::receiveAnswer_CoLa_A: Event (by index) successfully (un)registered: " +
661 else if (receivedCommand ==
FA)
699 for (
UINT32 i = 0; i < timeout; i++)
706 printInfoMessage(
"SopasBase::receiveAnswer_CoLa_A: Response received (len= " +
713 if (rxData.length() > 0)
718 if (cmd == receivedCommand)
722 if (receivedCommand ==
WA)
730 if (receivedName == name)
733 if (cmd ==
RA || cmd ==
AN)
741 else if (receivedCommand ==
EA)
757 else if (receivedCommand ==
FA)
759 printInfoMessage(
"SopasBase:: Error answer received: FA " + rxData +
".",
true);
789 std::string receivedName;
797 for (
UINT32 i = 0; i < timeout; i++)
818 if (receivedCommand ==
FA)
823 printWarning(
"SopasBase::receiveAnswer_CoLa_B: Error from sensor! Code=" +
toString(errorCode) +
829 if (cmd != receivedCommand)
847 if (name != receivedName)
857 if (receivedCommand ==
WA)
865 else if (receivedCommand ==
EA)
872 else if (receivedCommand ==
AN )
879 else if (receivedCommand ==
RA)
889 printInfoMessage(
"SopasBase::receiveAnswer_CoLa_B: Unkown Sopas command.",
true);
925 return "Sopas_Error_METHODIN_ACCESSDENIED";
927 return "Sopas_Error_METHODIN_UNKNOWNINDEX";
929 return "Sopas_Error_VARIABLE_UNKNOWNINDEX";
931 return "Sopas_Error_LOCALCONDITIONFAILED";
933 return "Sopas_Error_INVALID_DATA";
935 return "Sopas_Error_UNKNOWN_ERROR";
937 return "Sopas_Error_BUFFER_OVERFLOW";
939 return "Sopas_Error_BUFFER_UNDERFLOW";
941 return "Sopas_Error_ERROR_UNKNOWN_TYPE";
943 return "Sopas_Error_VARIABLE_WRITE_ACCESSDENIED";
945 return "Sopas_Error_UNKNOWN_CMD_FOR_NAMESERVER";
947 return "Sopas_Error_UNKNOWN_COLA_COMMAND";
949 return "Sopas_Error_METHODIN_SERVER_BUSY";
951 return "Sopas_Error_FLEX_OUT_OF_BOUNDS";
953 return "Sopas_Error_EVENTREG_UNKNOWNINDEX";
955 return "Sopas_Error_COLA_A_VALUE_OVERFLOW";
957 return "Sopas_Error_COLA_A_INVALID_CHARACTER";
959 return "Sopas_Error_OSAI_NO_MESSAGE";
961 return "Sopas_Error_OSAI_NO_ANSWER_MESSAGE";
963 return "Sopas_Error_INTERNAL";
965 return "Sopas_Error_HubAddressCorrupted";
967 return "Sopas_Error_HubAddressDecoding";
969 return "Sopas_Error_HubAddressAddressExceeded";
971 return "Sopas_Error_HubAddressBlankExpected";
973 return "Sopas_Error_AsyncMethodsAreSuppressed";
975 return "Sopas_Error_ComplexArraysNotSupported";
977 return "(unknown_Sopas_error_code)";
980 return "(unknown_Sopas_error_code)";
991 printInfoMessage(
"SopasBase::receiveAnswer_CoLa_B_idx: Entering function.", beVerboseHere);
1002 for (
UINT32 i = 0; i < timeout; i++)
1006 printInfoMessage(
"SopasBase::receiveAnswer_CoLa_B_idx: There is something in receive buffer.", beVerboseHere);
1024 if (receivedCommand ==
FA)
1028 printWarning(
"SopasBase::receiveAnswer_CoLa_B_idx: Error from sensor! Code=" +
toString(receivedIndex) +
1034 else if (index != receivedIndex)
1039 printInfoMessage(
"SopasBase::receiveAnswer_CoLa_B_idx: This is not the index we are waiting for (expected=" 1040 +
toString(index) +
", received=" +
toString(receivedIndex) +
")." , beVerboseHere);
1045 else if (cmd != receivedCommand)
1055 else if (receivedCommand ==
WA)
1058 printInfoMessage(
"SopasBase::receiveAnswer_CoLa_B_idx: Variable successfully set.", beVerboseHere);
1063 else if (receivedCommand ==
EA)
1066 printInfoMessage(
"SopasBase::receiveAnswer_CoLa_B_idx: Event successfully (un)registered: " + ::
toString(receivedIndex) +
".", beVerboseHere);
1071 else if (receivedCommand ==
AI )
1074 printInfoMessage(
"SopasBase::receiveAnswer_CoLa_B_idx: Answer to method call with index " + ::
toString(receivedIndex) +
".", beVerboseHere);
1080 else if (receivedCommand ==
RA)
1083 printInfoMessage(
"SopasBase::receiveAnswer_CoLa_B_idx: Answer to read variable with index " + ::
toString(receivedIndex) +
".", beVerboseHere);
1092 printWarning(
"SopasBase::receiveAnswer_CoLa_B_idx: Unknown Sopas command.");
1099 printInfoMessage(
"SopasBase::receiveAnswer_CoLa_B_idx: Untreated Sopas command.", beVerboseHere);
1112 printInfoMessage(
"SopasBase::receiveAnswer_CoLa_B_idx: Leaving with timeout.", beVerboseHere);
1149 std::string command;
1152 assert (command.length() == 2);
1160 if (frame.
size() > 8)
1163 std::string eventName;
1180 printWarning(
"SopasBase::Received an unknown event! Event name is: " + eventName +
".");
1247 bool frameWasProcessed =
false;
1250 if (frame.
size() > 12)
1254 std::string eventName;
1262 eventIndex = colab::getIntegerFromBuffer<UINT16>(
m_receiveBuffer, pos);
1270 frameWasProcessed =
true;
1275 frameWasProcessed =
true;
1283 printWarning(
"SopasBase::processFrame_CoLa_B: Decoding of events by name is not implemented yet.");
1288 if (frameWasProcessed ==
false)
1291 printWarning(
"SopasBase::processFrame_CoLa_B: Don't know how to process the incoming event with the short name <" +
1292 eventName +
"> and the index " + ::
toString(eventIndex) +
", ignoring it!");
1298 printWarning(
"SopasBase::processFrame_CoLa_B: Received a very short (and unknown) event! Frame length is " + ::
toString(frame.
size()) +
" bytes.");
1331 printError(
"SopasBase::copyFrameToResposeBuffer: Failed to copy frame (Length=" + ::
toString(frameLength) +
1332 " bytes) to response buffer because the response buffer is too small (buffer size=" +
1351 " bytes from the input buffer. New length is " + ::
toString(newLen) +
" bytes.",
m_beVerbose);
1380 if (cmdString ==
"RN")
1386 else if (cmdString ==
"AN")
1391 else if (cmdString ==
"SN")
1397 if (cmdString ==
"RI")
1401 else if (cmdString ==
"WI")
1405 else if (cmdString ==
"MI")
1409 else if (cmdString ==
"AI")
1413 else if (cmdString ==
"EI")
1417 else if (cmdString ==
"SI")
1423 else if (cmdString ==
"RA")
1427 else if (cmdString ==
"WA")
1431 else if (cmdString ==
"MA")
1435 else if (cmdString ==
"AA")
1439 else if (cmdString ==
"EA")
1443 else if (cmdString ==
"SA")
1447 else if (cmdString ==
"FA")
1454 printError(
"SopasBase::stringToSopasCommand: Trying to resolve an unknown command: " + cmdString +
".");
1536 printError(
"SopasBase::sopasCommandToString: Trying to resolve an unknown command!");
1554 bool result =
false;
1563 if (result && answer != NULL && answer->
isValid())
1567 std::string colaaAnswer;
1571 colaaAnswer = std::string((
char*)answer->
getBuffer(), answer->
size());
1611 *rxData = rxData->substr(len + 1);
1635 fieldLength = colab::getIntegerFromBuffer<UINT16>(buffer, pos);
1639 fieldLength = colab::getIntegerFromBuffer<UINT16>(buffer, pos);
1642 printInfoMessage(
"SopasBase::colaB_decodeScannerTypeAndVersion: scanner '" + m_scannerName +
"', version '" 1653 BYTE cmdBuffer[128];
1660 cmdBuffer[cmdBufferLen++] =
' ';
1664 if (parametersLength > 0)
1666 cmdBuffer[cmdBufferLen++] =
' ';
1672 colab::addIntegerToBuffer<UINT16>(cmdBuffer, cmdBufferLen, methodeName.size());
1677 if (parametersLength > 0)
1680 memcpy(&cmdBuffer[cmdBufferLen], parameters, parametersLength);
1681 cmdBufferLen += parametersLength;
1697 printWarning(
"SopasBase::invokeMethod: Calling of " + methodeName +
" was NOT successful.");
1710 BYTE cmdBuffer[128];
1716 printError(
"SopasBase::invokeMethod: Invoke method cola-a by index not supported.");
1722 colab::addIntegerToBuffer<UINT16>(cmdBuffer, cmdBufferLen, index);
1726 if (parametersLength > 0)
1729 memcpy(&cmdBuffer[cmdBufferLen], parameters, parametersLength);
1730 cmdBufferLen += parametersLength;
1746 printWarning(
"SopasBase::invokeMethod: Calling of method with index=" + ::
toString(index) +
" was NOT successful.");
1759 BYTE cmdBuffer[128];
1765 cmdBuffer[cmdBufferLen++] =
' ';
1772 cmdBuffer[cmdBufferLen++] =
' ';
1788 printWarning(
"SopasBase::readVariable: Answer to " + variableName +
" not successful.");
1801 BYTE cmdBuffer[128];
1807 cmdBuffer[cmdBufferLen++] =
' ';
1813 colab::addIntegerToBuffer<UINT16>(cmdBuffer, cmdBufferLen, index);
1840 printInfoMessage(
"SopasBase::writeVariable: ReadOnly Modus - ignore writing to variable '" +
1846 BYTE cmdBuffer[128];
1852 cmdBuffer[cmdBufferLen++] =
' ';
1854 if (parametersLength > 0)
1856 cmdBuffer[cmdBufferLen++] =
' ';
1861 printError(
"SopasBase::writeVariable: Write variable cola-b by Name: NOT IMPLEMENTED");
1872 if (parametersLength > 0)
1875 memcpy(&cmdBuffer[cmdBufferLen], parameters, parametersLength);
1876 cmdBufferLen += parametersLength;
1914 printInfoMessage(
"SopasBase::writeVariable: ReadOnly Modus - ignore writing to variable index '" + ::
toString(variableIndex) +
1920 UINT32 cmdBufferLen = parametersLength + 4;
1921 BYTE* cmdBuffer =
new BYTE[cmdBufferLen];
1927 BYTE* buffer = &(cmdBuffer[2]);
1933 memcpy(&(cmdBuffer[4]), parameters, parametersLength);
1936 printInfoMessage(
"SopasBase::writeVariable: Sending command buffer now (payload len=" +
toString(parametersLength+4) +
" bytes).", beVerboseHere);
1939 printInfoMessage(
"SopasBase::writeVariable: Command sent, waiting for reply...", beVerboseHere);
1954 printWarning(
"SopasBase::writeVariable: Answer to " +
toString(variableIndex) +
" not successful!");
1957 printInfoMessage(
"SopasBase::writeVariable: All done, leaving.", beVerboseHere);
1965 BYTE cmdBuffer[128];
1971 cmdBuffer[cmdBufferLen++] =
' ';
1973 cmdBuffer[cmdBufferLen++] =
' ';
1974 cmdBuffer[cmdBufferLen++] =
'1';
1980 cmdBuffer[cmdBufferLen++] =
' ';
1982 cmdBuffer[cmdBufferLen++] =
' ';
1983 colab::addIntegerToBuffer<UINT8>(cmdBuffer, cmdBufferLen, 1);
2010 BYTE cmdBuffer[128];
2016 printError(
"SopasBase::register event cola-a by index not supported, aborting.");
2023 colab::addIntegerToBuffer<UINT16>(cmdBuffer, cmdBufferLen, index);
2024 colab::addIntegerToBuffer<UINT8>(cmdBuffer, cmdBufferLen, 1);
2048 printError(
"SopasBase::registerEvent: Calling of method with index=" + ::
toString(index) +
" was NOT successful.");
2058 BYTE cmdBuffer[128];
2064 printError(
"SopasBase::unregisterEvent: Unregister event cola-a by index not supported.");
2071 colab::addIntegerToBuffer<UINT16>(cmdBuffer, cmdBufferLen, index);
2072 colab::addIntegerToBuffer<UINT8>(cmdBuffer, cmdBufferLen, 0);
2106 BYTE cmdBuffer[128];
2112 cmdBuffer[cmdBufferLen++] =
' ';
2114 cmdBuffer[cmdBufferLen++] =
' ';
2115 cmdBuffer[cmdBufferLen++] =
'0';
2121 cmdBuffer[cmdBufferLen++] =
' ';
2123 cmdBuffer[cmdBufferLen++] =
' ';
2124 colab::addIntegerToBuffer<UINT8>(cmdBuffer, cmdBufferLen, 0);
2176 UINT32 payLoadLength = 0;
2187 return payLoadLength;
2194 std::string commandString;
2199 commandString = std::string((
char*) &
m_buffer[2], 2);
2202 commandString = std::string((
char*) &
m_buffer[9], 2);
2205 return commandString;
2216 BYTE* bufferPos = NULL;
2240 printWarning(
"SopasEventMessage::getVariableIndex: Encoding is not ByIndex, aborting!");
2254 printError(
"SopasEventMessage::getVariableIndex: Unknown protocol!");
2274 printError(
"SopasEventMessage::getVariableName: Protocol CoLa-A is not supported, aborting!");
2349 if (answerLength > 0)
SopasBase::SopasMessageType getMessageType() const
std::string getVariableName()
Returns the name of a variable (answer to read variable by name). In case of error an empty value wil...
UINT32 getPayLoadLength() const
contains 's' + command string(2 byte) + content(payload length - 3)
void printError(std::string message)
void processFrame_CoLa_A(SopasEventMessage &frame)
std::string toString(const PositionWGS84::PositionWGS84SourceType &type)
BYTE * getPayLoad()
contains 's' + command string(2 byte) + content(payload length - 3)
void closeTcpConnection()
static const std::string COMMAND_Read_Variable_ByName
SopasBase::SopasMessageType m_messageType
State m_state
Device info.
bool registerEvent(const std::string &eventName)
Registers an event by name.
std::string decodeString(std::string *rxData, UINT16 len)
bool receiveAnswer_CoLa_A(SopasCommand cmd, std::string name, UINT32 timeout, SopasAnswer *&answer)
SopasAnswer(const BYTE *answer, UINT32 answerLength)
Constructor. Copies the content of the answer into the buffer of this object.
static const std::string VARIABLENAME_DEVICEIDENT
bool m_weWantScanData
Flag to enable/disable scan data reception.
static const std::string VARIABLENAME_SCANCONFIG
void colaB_decodeScannerTypeAndVersion(UINT8 *buffer, UINT16 pos)
SopasEventMessage()
Default constructor.
Class that encapsulates a buffer that was sent as return to a sync call. (variable / method) ...
static std::string convertSopasErrorCodeToText(UINT16 errorCode)
static const std::string COMMAND_Register_Event_Answer
static const std::string EVENTNAME_SUBSCRIBE_EVALCASES
static const std::string VARIABLENAME_SCANDATACONFIG
static const std::string COMMAND_Register_Event_ByName
std::string getNextStringToken(std::string *rxData)
Mutex m_receiveDataMutex
Access mutex for buffer.
static const std::string COMMAND_Method_Result_Answer
Class that represents a message that was sent by a sensor. (Event message)
virtual ~SopasBase()
Destructor.
SopasCommand colaA_decodeCommand(std::string *rxData)
UINT16 decodeUINT16(BYTE *buffer)
std::string convertRxBufferToString(UINT8 *buffer, UINT16 bufferLen)
INT32 getVariableIndex()
Returns the index of a variable (answer to read variable by index). In case of error a negative value...
std::string getStringFromBuffer(UINT8 *buffer, UINT16 &pos, UINT16 length)
SopasBase::SopasEncoding getEncodingType() const
void(* DisconnectFunction)(void *obj)
#define printInfoMessage(a, b)
static const std::string METHODNAME_LOGOUT
static const std::string COMMAND_Invoke_Method_ByIndex
SopasEncoding m_encoding
ByName or ByIndex.
std::string getCommandString() const
read/write variable, invoke methods by index (indexes will be generated !!!)
static const std::string METHODNAME_LOGIN
Object has been constructed. Use init() to go into CONNECTED state.
SopasBase::SopasProtocol m_protocol
bool isConnected()
Returns true if the tcp connection is established.
static const std::string METHODNAME_STOP_MEASURE
SopasBase()
Default constructor.
void addStringToBuffer(UINT8 *buffer, UINT16 &pos, const std::string &stringValue)
bool write(UINT8 *buffer, UINT32 numberOfBytes)
DecoderFunctionMapByName m_decoderFunctionMapByName
UINT32 m_numberOfBytesInResponseBuffer
Number of bytes in buffer.
void readCallbackFunction(UINT8 *buffer, UINT32 &numOfBytes)
static const std::string COMMAND_Write_Variable_ByName
bool open(std::string ipAddress, UINT16 port, bool enableVerboseDebugOutput=false)
Event Acknowledge -Answer to register event.
void processFrame_CoLa_B(SopasEventMessage &frame)
UINT32 m_numberOfBytesInReceiveBuffer
Number of bytes in buffer.
static const std::string COMMAND_Invoke_Method_Answer
void copyFrameToResposeBuffer(UINT32 frameLength)
static const std::string COMMAND_Send_Event_ByIndex
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...
static const std::string COMMAND_Register_Event_ByIndex
read/write variable, invoke methods by name
static const std::string COMMAND_Read_Variable_Answer
static const std::string COMMAND_Write_Variable_ByIndex
std::string sopasCommandToString(SopasCommand cmd)
static const std::string COMMAND_Write_Variable_Answer
void removeFrameFromReceiveBuffer(UINT32 frameLength)
bool writeVariable(const std::string &variableName, BYTE *parameters, UINT16 parametersLength)
Write a variable to the sensor by name.
void addFrameToBuffer(UINT8 *sendBuffer, UINT8 *cmdBuffer, UINT16 *len)
void addFrameToBuffer(UINT8 *sendBuffer, UINT8 *cmdBuffer, UINT16 *len)
SopasEventMessage findFrameInReceiveBuffer()
Depending on the protocol the start and end of a frame will be found.
void setReadOnlyMode(bool mode)
IndexToNameMap m_indexToNameMap
std::string getCommandStringFromBuffer(UINT8 *buffer)
void processFrame(SopasEventMessage &frame)
Reads one frame from receive buffer and decodes it.
SopasCommand stringToSopasCommand(const std::string &cmdString)
Converts strings in sopas answer buffer to SopasCommand enum.
static const std::string EVENTNAME_SUBSCRIBE_SCANS
bool m_weWantFieldData
Flag to enable/disable protection field data reception.
static const UINT16 INDEX_DEVICE_IDENT
static const std::string COMMAND_Event_Acknowledge
UINT8 m_receiveBuffer[25000]
Low-Level receive buffer for all data (25000 should be enough for NAV300 Events)
UINT16 addStringToBuffer(UINT8 *buffer, const std::string &text)
std::string m_scannerName
Read from scanner.
virtual void evalCaseResultDecoder(SopasEventMessage &msg)=0
SopasProtocol m_protocol
Used protocol (ColaA oder ColaB)
virtual void scanDataDecoder(SopasEventMessage &msg)=0
void colaA_decodeScannerTypeAndVersion(std::string *rxData)
bool action_getScannerTypeAndVersion()
Reads the scanner type and version variable from the sensor and stores it in the member variables...
bool disconnect()
Closes the connection to the LMS. This is the opposite of init().
static const std::string METHODNAME_START_MEASURE
~SopasAnswer()
Destructor. Frees the memory for the copied buffer.
static const std::string COMMAND_Method_Result_ByIndex
SopasBase::SopasEncoding m_encoding
bool receiveAnswer_CoLa_B(SopasCommand cmd, std::string name, UINT32 timeout, SopasAnswer *&answer)
static const std::string VARIABLENAME_DATAOUTPUTRANGE
bool readVariable(const std::string &variableName, SopasAnswer *&answer)
Reads a variable from the sensor by name.
void sendCommandBuffer(UINT8 *buffer, UINT16 len)
Sends the content of the buffer via TCP to the sensor.
static const std::string COMMAND_Invoke_Method_ByName
UINT16 addUINT32ToBuffer(UINT8 *buffer, UINT32 value)
void setReadCallbackFunction(ReadFunction readFunction, void *obj)
static const std::string COMMAND_Read_Variable_ByIndex
std::string m_scannerVersion
Read from scanner.
void setDisconnectCallbackFunction(DisconnectFunction discFunction, void *obj)
UINT8 m_responseBuffer[1024]
Receive buffer for everything except scan data and eval case data.
double makeAngleValid(double angle)
Send Event (by name, receive)
void printWarning(std::string message)
UINT16 decodeUINT16(BYTE *buffer)
std::string getIdentifierFromBuffer(UINT8 *buffer, UINT16 &nextData, UINT16 bufferLength)
bool connect()
Connects to a sensor via tcp and reads the device name.
bool unregisterEvent(const std::string &eventName)
Unregisters an event by name.
static const std::string COMMAND_Send_Event_ByName
bool invokeMethod(const std::string &methodeName, BYTE *parameters, UINT16 parametersLength, SopasAnswer *&answer)
Invoke a method on the sensor.
static void readCallbackFunctionS(void *obj, UINT8 *buffer, UINT32 &numOfBytes)
Function that will be called on incomming data via tcp.
static const std::string COMMAND_Method_Result_ByName
virtual bool init(SopasProtocol protocol, std::string ipAddress, UINT16 portNumber, bool weWantScanData, bool weWantFieldData, bool readOnlyMode, Tcp::DisconnectFunction disconnectFunction, void *obj)
Initialization.
static const std::string METHODNAME_SET_SCANCONFIG