Go to the documentation of this file.
13 #include "sick_scan/tcp/interfaces/tcp.hpp"
18 #include "sick_scan/tcp/tools/Mutex.hpp"
128 std::string ipAddress,
131 bool weWantFieldData,
506 #endif // SOPASBASE_H
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
std::map< UINT16, std::string > IndexToNameMap
@ RN
Read Variable (by name)
UINT32 m_numberOfBytesInReceiveBuffer
Number of bytes in buffer.
SopasBase::SopasProtocol getProtocolType() const
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
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)
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)
double makeAngleValid(double angle)
static const std::string COMMAND_Send_Event_ByIndex
@ MSG_WRITE_VARIABLE_ANSWER
Write Variable Answer.
static const std::string COMMAND_Register_Event_ByIndex
static const std::string COMMAND_Invoke_Method_Answer
@ CMD_UNKNOWN
Unknown command.
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.
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...
static const std::string COMMAND_Write_Variable_Answer
@ CONSTRUCTED
Object has been constructed. Use init() to go into CONNECTED state.
const std::string & getScannerName() const
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....
DecoderFunctionMapByIndex m_decoderFunctionMapByIndex
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()
SopasEncoding m_encoding
ByName or ByIndex.
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
void sendCommandBuffer(UINT8 *buffer, UINT16 len)
Sends the content of the buffer via TCP to the sensor.
std::string sopasCommandToString(SopasCommand cmd)
@ MSG_EVENT_ACKNOWLEDGE
Event Acknowledge -Answer to register event.
std::string getCommandString() const
std::map< UINT16, DecoderFunction > DecoderFunctionMapByIndex
@ 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
const std::string & getScannerVersion() const
@ AN
Method Result (ny name)
@ AA
Method Result Answer.
std::string m_scannerName
Read from scanner.
virtual ~SopasBase()
Destructor.
bool readVariable(const std::string &variableName, SopasAnswer *&answer)
Reads a variable from the sensor by name.
static const std::string METHODNAME_STOP_MEASURE
virtual void scanDataDecoder(SopasEventMessage &msg)=0
IndexToNameMap m_indexToNameMap
static const std::string COMMAND_Method_Result_ByIndex
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 m_fieldEventIsRegistered
bool disconnect()
Closes the connection to the LMS. This is the opposite of init().
void setEventCallbackFunction(DecoderFunction decoderFunction, UINT16 eventIndex)
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)
void setEventCallbackFunction(DecoderFunction decoderFunction, const std::string &eventName)
static const std::string COMMAND_Invoke_Method_ByName
static const std::string EVENTNAME_SUBSCRIBE_EVALCASES
Class that encapsulates a buffer that was sent as return to a sync call. (variable / method)
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
SopasMessageType
types of answers of the sensor
void removeFrameFromReceiveBuffer(UINT32 frameLength)
@ MSG_METHOD_RESULT_ANSWER
Method Result Answer.
~SopasEventMessage()
Destructor.
static const UINT16 INDEX_DEVICE_IDENT
@ SN
Send Event (by name, receive)
void(* DecoderFunction)(SopasEventMessage &frame)
virtual void evalCaseResultDecoder(SopasEventMessage &msg)=0
SopasBase::SopasEncoding getEncodingType() const
static const std::string VARIABLENAME_SCANCONFIG
void setReadOnlyMode(bool mode)
bool m_scanEventIsRegistered
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.
Class that represents a message that was sent by a sensor. (Event message)
UINT8 m_receiveBuffer[25000]
Low-Level receive buffer for all data (25000 should be enough for NAV300 Events)
@ MSG_REGISTER_EVENT_ANSWER
Register Event Answer.
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::map< std::string, DecoderFunction > DecoderFunctionMapByName
static const std::string METHODNAME_START_MEASURE
sick_scan
Author(s): Michael Lehning
, Jochen Sprickerhof , Martin Günther
autogenerated on Thu Sep 8 2022 02:30:19