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)
283 m_numberOfBytesInReceiveBuffer += bytesToBeTransferred;
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 " +
355 if (i >= m_numberOfBytesInReceiveBuffer)
358 m_numberOfBytesInReceiveBuffer = 0;
363 UINT32 newLen = m_numberOfBytesInReceiveBuffer - i;
365 m_numberOfBytesInReceiveBuffer = newLen;
378 if (i >= m_numberOfBytesInReceiveBuffer)
400 if (magicWord != 0x02020202)
407 if (magicWord == 0x02020202)
425 memmove(&(m_receiveBuffer[0]), &(m_receiveBuffer[i]), bytesToMove);
434 printInfoMessage(
"SopasBase::findFrameInReceiveBuffer: Frame cannot be decoded yet, only " +
441 payloadlength = colab::getIntegerFromBuffer<UINT32>(
m_receiveBuffer, pos);
445 if (payloadlength > (
sizeof(m_receiveBuffer) - 9))
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)
634 if (cmd ==
RA || cmd ==
AN)
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)
731 if (cmd ==
RA || cmd ==
AN)
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);
1640 printInfoMessage(
"SopasBase::colaB_decodeScannerTypeAndVersion: scanner '" + m_scannerName +
"', version '" 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;
1695 printWarning(
"SopasBase::invokeMethod: Calling of " + methodeName +
" was NOT successful.");
1708 BYTE cmdBuffer[128];
1714 printError(
"SopasBase::invokeMethod: Invoke method cola-a by index not supported.");
1720 colab::addIntegerToBuffer<UINT16>(cmdBuffer, cmdBufferLen, index);
1724 if (parametersLength > 0)
1727 memcpy(&cmdBuffer[cmdBufferLen], parameters, parametersLength);
1728 cmdBufferLen += parametersLength;
1744 printWarning(
"SopasBase::invokeMethod: Calling of method with index=" + ::
toString(index) +
" was NOT successful.");
1757 BYTE cmdBuffer[128];
1763 cmdBuffer[cmdBufferLen++] =
' ';
1770 cmdBuffer[cmdBufferLen++] =
' ';
1786 printWarning(
"SopasBase::readVariable: Answer to " + variableName +
" not successful.");
1799 BYTE cmdBuffer[128];
1805 cmdBuffer[cmdBufferLen++] =
' ';
1811 colab::addIntegerToBuffer<UINT16>(cmdBuffer, cmdBufferLen, index);
1838 printInfoMessage(
"SopasBase::writeVariable: ReadOnly Modus - ignore writing to variable '" +
1844 BYTE cmdBuffer[128];
1850 cmdBuffer[cmdBufferLen++] =
' ';
1852 if (parametersLength > 0)
1854 cmdBuffer[cmdBufferLen++] =
' ';
1859 printError(
"SopasBase::writeVariable: Write variable cola-b by Name: NOT IMPLEMENTED");
1870 if (parametersLength > 0)
1873 memcpy(&cmdBuffer[cmdBufferLen], parameters, parametersLength);
1874 cmdBufferLen += parametersLength;
1912 printInfoMessage(
"SopasBase::writeVariable: ReadOnly Modus - ignore writing to variable index '" + ::
toString(variableIndex) +
1918 UINT32 cmdBufferLen = parametersLength + 4;
1919 BYTE* cmdBuffer =
new BYTE[cmdBufferLen];
1925 BYTE* buffer = &(cmdBuffer[2]);
1931 memcpy(&(cmdBuffer[4]), parameters, parametersLength);
1934 printInfoMessage(
"SopasBase::writeVariable: Sending command buffer now (payload len=" +
toString(parametersLength+4) +
" bytes).", beVerboseHere);
1937 printInfoMessage(
"SopasBase::writeVariable: Command sent, waiting for reply...", beVerboseHere);
1952 printWarning(
"SopasBase::writeVariable: Answer to " +
toString(variableIndex) +
" not successful!");
1955 printInfoMessage(
"SopasBase::writeVariable: All done, leaving.", beVerboseHere);
1963 BYTE cmdBuffer[128];
1969 cmdBuffer[cmdBufferLen++] =
' ';
1971 cmdBuffer[cmdBufferLen++] =
' ';
1972 cmdBuffer[cmdBufferLen++] =
'1';
1978 cmdBuffer[cmdBufferLen++] =
' ';
1980 cmdBuffer[cmdBufferLen++] =
' ';
1981 colab::addIntegerToBuffer<UINT8>(cmdBuffer, cmdBufferLen, 1);
2008 BYTE cmdBuffer[128];
2014 printError(
"SopasBase::register event cola-a by index not supported, aborting.");
2021 colab::addIntegerToBuffer<UINT16>(cmdBuffer, cmdBufferLen, index);
2022 colab::addIntegerToBuffer<UINT8>(cmdBuffer, cmdBufferLen, 1);
2046 printError(
"SopasBase::registerEvent: Calling of method with index=" + ::
toString(index) +
" was NOT successful.");
2056 BYTE cmdBuffer[128];
2062 printError(
"SopasBase::unregisterEvent: Unregister event cola-a by index not supported.");
2069 colab::addIntegerToBuffer<UINT16>(cmdBuffer, cmdBufferLen, index);
2070 colab::addIntegerToBuffer<UINT8>(cmdBuffer, cmdBufferLen, 0);
2104 BYTE cmdBuffer[128];
2110 cmdBuffer[cmdBufferLen++] =
' ';
2112 cmdBuffer[cmdBufferLen++] =
' ';
2113 cmdBuffer[cmdBufferLen++] =
'0';
2119 cmdBuffer[cmdBufferLen++] =
' ';
2121 cmdBuffer[cmdBufferLen++] =
' ';
2122 colab::addIntegerToBuffer<UINT8>(cmdBuffer, cmdBufferLen, 0);
2148 return ::normalizeRadians(angle);
2174 UINT32 payLoadLength = 0;
2185 return payLoadLength;
2192 std::string commandString;
2197 commandString = std::string((
char*) &
m_buffer[2], 2);
2200 commandString = std::string((
char*) &
m_buffer[9], 2);
2203 return commandString;
2214 BYTE* bufferPos = NULL;
2238 printWarning(
"SopasEventMessage::getVariableIndex: Encoding is not ByIndex, aborting!");
2252 printError(
"SopasEventMessage::getVariableIndex: Unknown protocol!");
2272 printError(
"SopasEventMessage::getVariableName: Protocol CoLa-A is not supported, aborting!");
2347 if (answerLength > 0)
SopasBase::SopasMessageType getMessageType() const
void printError(std::string message)
void processFrame_CoLa_A(SopasEventMessage &frame)
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)
static const std::string VARIABLENAME_DEVICEIDENT
bool m_weWantScanData
Flag to enable/disable scan data reception.
std::string getCommandString() const
static const std::string VARIABLENAME_SCANCONFIG
void colaB_decodeScannerTypeAndVersion(UINT8 *buffer, UINT16 pos)
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)
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
std::string getVariableName()
Returns the name of a variable (answer to read variable by name). In case of error an empty value wil...
static const std::string COMMAND_Invoke_Method_ByIndex
SopasEncoding m_encoding
ByName or ByIndex.
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)
ROSLIB_DECL std::string command(const std::string &cmd)
BYTE * getPayLoad()
contains 's' + command string(2 byte) + content(payload length - 3)
static const std::string COMMAND_Write_Variable_Answer
void removeFrameFromReceiveBuffer(UINT32 frameLength)
SopasAnswer(const BYTE *answer, UINT32 answerLength)
Constructor. Copies the content of the answer into the buffer of this object.
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
SopasEventMessage()
Default constructor.
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
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
~SopasAnswer()
Destructor. Frees the memory for the copied buffer.
std::string m_scannerVersion
Read from scanner.
void setDisconnectCallbackFunction(DisconnectFunction discFunction, void *obj)
INT32 getVariableIndex()
Returns the index of a variable (answer to read variable by index). In case of error a negative value...
UINT32 getPayLoadLength() const
contains 's' + command string(2 byte) + content(payload length - 3)
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