Public Member Functions | Protected Types | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
SickScanCommonNw Class Reference

Interface for TCP/IP. More...

#include <sick_scan_common_nw.h>

Public Member Functions

bool connect ()
 Connects to a sensor via tcp and reads the device name. More...
 
bool disconnect ()
 Closes the connection to the LMS. This is the opposite of init(). More...
 
bool init (std::string ipAddress, unsigned short portNumber, Tcp::DisconnectFunction disconnectFunction, void *obj)
 
bool isConnected ()
 Returns true if the tcp connection is established. More...
 
void sendCommandBuffer (UINT8 *buffer, UINT16 len)
 
bool setReadCallbackFunction (Tcp::ReadFunction readFunction, void *obj)
 
 SickScanCommonNw ()
 
 ~SickScanCommonNw ()
 

Protected Types

enum  State { CONSTRUCTED, CONNECTED }
 

Protected Attributes

State m_state
 

Private Member Functions

void closeTcpConnection ()
 
void copyFrameToResposeBuffer (UINT32 frameLength)
 
SopasEventMessage findFrameInReceiveBuffer ()
 
bool openTcpConnection ()
 
void processFrame (SopasEventMessage &frame)
 
void readCallbackFunction (UINT8 *buffer, UINT32 &numOfBytes)
 
void removeFrameFromReceiveBuffer (UINT32 frameLength)
 

Static Private Member Functions

static void readCallbackFunctionS (void *obj, UINT8 *buffer, UINT32 &numOfBytes)
 Function that will be called on incomming data via tcp. More...
 

Private Attributes

bool m_beVerbose
 
std::string m_ipAddress
 
UINT32 m_numberOfBytesInReceiveBuffer
 Number of bytes in buffer. More...
 
UINT32 m_numberOfBytesInResponseBuffer
 Number of bytes in buffer. More...
 
UINT16 m_portNumber
 
SopasProtocol m_protocol
 
UINT8 m_receiveBuffer [25000]
 Low-Level receive buffer for all data (25000 should be enough for NAV300 Events) More...
 
Mutex m_receiveDataMutex
 Access mutex for buffer. More...
 
UINT8 m_responseBuffer [1024]
 Receive buffer for everything except scan data and eval case data. More...
 
Tcp m_tcp
 

Detailed Description

Interface for TCP/IP.

This class provides an interface for TCP/IP communication. It also contains simple methods for accessing the essential contents of the SOPAS message (for example, determining the payload and the SOPAS command used). It based on an example of SICK AG.

Doxygen example: http://www-numi.fnal.gov/offline_software/srt_public_context/WebDocs/doxygen-howto.html

Definition at line 38 of file sick_scan_common_nw.h.

Member Enumeration Documentation

◆ State

enum SickScanCommonNw::State
protected
Enumerator
CONSTRUCTED 

Object has been constructed. Use init() to go into CONNECTED state.

Object is now connected. Use run() to go into RUNNING state, or disconnect() to go back into CONSTRUCTED state.

CONNECTED 

Object is connected and emitting data. Use stop() to go back into CONNECTED, or disconnect() to go back into CONSTRUCTED state.

Definition at line 113 of file sick_scan_common_nw.h.

Constructor & Destructor Documentation

◆ SickScanCommonNw()

SickScanCommonNw::SickScanCommonNw ( )

Definition at line 35 of file sick_scan_common_nw.cpp.

◆ ~SickScanCommonNw()

SickScanCommonNw::~SickScanCommonNw ( )

Definition at line 42 of file sick_scan_common_nw.cpp.

Member Function Documentation

◆ closeTcpConnection()

void SickScanCommonNw::closeTcpConnection ( )
private

Definition at line 154 of file sick_scan_common_nw.cpp.

◆ connect()

bool SickScanCommonNw::connect ( )

Connects to a sensor via tcp and reads the device name.

Definition at line 96 of file sick_scan_common_nw.cpp.

◆ copyFrameToResposeBuffer()

void SickScanCommonNw::copyFrameToResposeBuffer ( UINT32  frameLength)
private

Definition at line 462 of file sick_scan_common_nw.cpp.

◆ disconnect()

bool SickScanCommonNw::disconnect ( )

Closes the connection to the LMS. This is the opposite of init().

Switches this device from the CONNECTED state back in the CONSTRUCTED state.

Returns
True if the device is now in the CONSTRUCTED state

Definition at line 56 of file sick_scan_common_nw.cpp.

◆ findFrameInReceiveBuffer()

SopasEventMessage SickScanCommonNw::findFrameInReceiveBuffer ( )
private

Definition at line 249 of file sick_scan_common_nw.cpp.

◆ init()

bool SickScanCommonNw::init ( std::string  ipAddress,
unsigned short  portNumber,
Tcp::DisconnectFunction  disconnectFunction,
void *  obj 
)

Definition at line 70 of file sick_scan_common_nw.cpp.

◆ isConnected()

bool SickScanCommonNw::isConnected ( )

Returns true if the tcp connection is established.

Definition at line 125 of file sick_scan_common_nw.cpp.

◆ openTcpConnection()

bool SickScanCommonNw::openTcpConnection ( )
private

Open TCP-connection to endpoint (usually IP-address and port)

true = Connected, false = no connection

Definition at line 136 of file sick_scan_common_nw.cpp.

◆ processFrame()

void SickScanCommonNw::processFrame ( SopasEventMessage frame)
private

Reads one frame from receive buffer and decodes it. Switches directly to the decoder of the protocol.

Definition at line 437 of file sick_scan_common_nw.cpp.

◆ readCallbackFunction()

void SickScanCommonNw::readCallbackFunction ( UINT8 buffer,
UINT32 numOfBytes 
)
private

Read callback. Diese Funktion wird aufgerufen, sobald Daten auf der Schnittstelle hereingekommen sind.

Definition at line 175 of file sick_scan_common_nw.cpp.

◆ readCallbackFunctionS()

void SickScanCommonNw::readCallbackFunctionS ( void *  obj,
UINT8 buffer,
UINT32 numOfBytes 
)
staticprivate

Function that will be called on incomming data via tcp.

Definition at line 165 of file sick_scan_common_nw.cpp.

◆ removeFrameFromReceiveBuffer()

void SickScanCommonNw::removeFrameFromReceiveBuffer ( UINT32  frameLength)
private

Definition at line 487 of file sick_scan_common_nw.cpp.

◆ sendCommandBuffer()

void SickScanCommonNw::sendCommandBuffer ( UINT8 buffer,
UINT16  len 
)

Send contents of buffer to scanner using according framing.

Send buffer is limited to 1024 byte!

Definition at line 426 of file sick_scan_common_nw.cpp.

◆ setReadCallbackFunction()

bool SickScanCommonNw::setReadCallbackFunction ( Tcp::ReadFunction  readFunction,
void *  obj 
)

Definition at line 82 of file sick_scan_common_nw.cpp.

Member Data Documentation

◆ m_beVerbose

bool SickScanCommonNw::m_beVerbose
private

Definition at line 87 of file sick_scan_common_nw.h.

◆ m_ipAddress

std::string SickScanCommonNw::m_ipAddress
private

Definition at line 103 of file sick_scan_common_nw.h.

◆ m_numberOfBytesInReceiveBuffer

UINT32 SickScanCommonNw::m_numberOfBytesInReceiveBuffer
private

Number of bytes in buffer.

Definition at line 96 of file sick_scan_common_nw.h.

◆ m_numberOfBytesInResponseBuffer

UINT32 SickScanCommonNw::m_numberOfBytesInResponseBuffer
private

Number of bytes in buffer.

Definition at line 91 of file sick_scan_common_nw.h.

◆ m_portNumber

UINT16 SickScanCommonNw::m_portNumber
private

Definition at line 104 of file sick_scan_common_nw.h.

◆ m_protocol

SopasProtocol SickScanCommonNw::m_protocol
private

Definition at line 105 of file sick_scan_common_nw.h.

◆ m_receiveBuffer

UINT8 SickScanCommonNw::m_receiveBuffer[25000]
private

Low-Level receive buffer for all data (25000 should be enough for NAV300 Events)

Definition at line 97 of file sick_scan_common_nw.h.

◆ m_receiveDataMutex

Mutex SickScanCommonNw::m_receiveDataMutex
private

Access mutex for buffer.

Definition at line 93 of file sick_scan_common_nw.h.

◆ m_responseBuffer

UINT8 SickScanCommonNw::m_responseBuffer[1024]
private

Receive buffer for everything except scan data and eval case data.

Definition at line 92 of file sick_scan_common_nw.h.

◆ m_state

State SickScanCommonNw::m_state
protected

Definition at line 126 of file sick_scan_common_nw.h.

◆ m_tcp

Tcp SickScanCommonNw::m_tcp
private

Definition at line 102 of file sick_scan_common_nw.h.


The documentation for this class was generated from the following files:


sick_scan
Author(s): Michael Lehning , Jochen Sprickerhof , Martin Günther
autogenerated on Thu Sep 8 2022 02:30:19