Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Tcp Class Reference

#include <tcp.hpp>

Public Types

typedef void(* DisconnectFunction) (void *obj)
 
typedef void(* ReadFunction) (void *obj, UINT8 *inputBuffer, UINT32 &numBytes)
 

Public Member Functions

void close ()
 
UINT32 getNumReadableBytes ()
 
bool isOpen ()
 
bool open (std::string ipAddress, UINT16 port, bool enableVerboseDebugOutput=false)
 
bool open (UINT32 ipAddress, UINT16 port, bool enableVerboseDebugOutput=false)
 
UINT32 read (UINT8 *buffer, UINT32 bufferLen)
 
std::string readString (UINT8 delimiter)
 
void setDisconnectCallbackFunction (DisconnectFunction discFunction, void *obj)
 
void setReadCallbackFunction (ReadFunction readFunction, void *obj)
 
 Tcp ()
 
bool write (UINT8 *buffer, UINT32 numberOfBytes)
 
 ~Tcp ()
 

Private Member Functions

bool isClientConnected_unlocked ()
 
INT32 readInputData ()
 
void readThreadFunction (bool &endThread, UINT16 &waitTimeMs)
 
void startServerThread ()
 
void stopReadThread ()
 
void stopServerThread ()
 

Private Attributes

bool m_beVerbose
 
INT32 m_connectionSocket
 
DisconnectFunction m_disconnectFunction
 
void * m_disconnectFunctionObjPtr
 
bool m_longStringWarningPrinted
 
ReadFunction m_readFunction
 
void * m_readFunctionObjPtr
 
SickThread< Tcp, &Tcp::readThreadFunctionm_readThread
 
std::list< unsigned char > m_rxBuffer
 
std::string m_rxString
 
struct sockaddr_in m_serverAddr
 
Mutex m_socketMutex
 

Detailed Description

Definition at line 30 of file tcp.hpp.

Member Typedef Documentation

◆ DisconnectFunction

typedef void(* Tcp::DisconnectFunction) (void *obj)

Definition at line 53 of file tcp.hpp.

◆ ReadFunction

typedef void(* Tcp::ReadFunction) (void *obj, UINT8 *inputBuffer, UINT32 &numBytes)

Definition at line 49 of file tcp.hpp.

Constructor & Destructor Documentation

◆ Tcp()

Tcp::Tcp ( )

Definition at line 22 of file tcp.cpp.

◆ ~Tcp()

Tcp::~Tcp ( )

Definition at line 40 of file tcp.cpp.

Member Function Documentation

◆ close()

void Tcp::close ( )

Definition at line 326 of file tcp.cpp.

◆ getNumReadableBytes()

UINT32 Tcp::getNumReadableBytes ( )

Auslesen der Anzahl zum Lesen verfuegbarer Bytes.

Rueckgabe: Anzahl der Bytes im Lese-Puffer.

Definition at line 375 of file tcp.cpp.

◆ isClientConnected_unlocked()

bool Tcp::isClientConnected_unlocked ( )
private

◆ isOpen()

bool Tcp::isOpen ( )

True = offen

– Wir sind der Client und mit einem Server verbunden –

Definition at line 95 of file tcp.cpp.

◆ open() [1/2]

bool Tcp::open ( std::string  ipAddress,
UINT16  port,
bool  enableVerboseDebugOutput = false 
)

Definition at line 136 of file tcp.cpp.

◆ open() [2/2]

bool Tcp::open ( UINT32  ipAddress,
UINT16  port,
bool  enableVerboseDebugOutput = false 
)

Definition at line 119 of file tcp.cpp.

◆ read()

UINT32 Tcp::read ( UINT8 buffer,
UINT32  bufferLen 
)

Definition at line 389 of file tcp.cpp.

◆ readInputData()

INT32 Tcp::readInputData ( )
private

Definition at line 229 of file tcp.cpp.

◆ readString()

std::string Tcp::readString ( UINT8  delimiter)

Lese einen String, bis zum Trennzeichen.

** DO NOT INTERMIX WITH CALLS TO READ() **

Definition at line 410 of file tcp.cpp.

◆ readThreadFunction()

void Tcp::readThreadFunction ( bool &  endThread,
UINT16 waitTimeMs 
)
private

Definition at line 195 of file tcp.cpp.

◆ setDisconnectCallbackFunction()

void Tcp::setDisconnectCallbackFunction ( DisconnectFunction  discFunction,
void *  obj 
)

Definition at line 82 of file tcp.cpp.

◆ setReadCallbackFunction()

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

Definition at line 110 of file tcp.cpp.

◆ startServerThread()

void Tcp::startServerThread ( )
private

◆ stopReadThread()

void Tcp::stopReadThread ( )
private

Stoppe den Lese-Thread.

Definition at line 358 of file tcp.cpp.

◆ stopServerThread()

void Tcp::stopServerThread ( )
private

◆ write()

bool Tcp::write ( UINT8 buffer,
UINT32  numberOfBytes 
)

Definition at line 51 of file tcp.cpp.

Member Data Documentation

◆ m_beVerbose

bool Tcp::m_beVerbose
private

Definition at line 67 of file tcp.hpp.

◆ m_connectionSocket

INT32 Tcp::m_connectionSocket
private

Definition at line 70 of file tcp.hpp.

◆ m_disconnectFunction

DisconnectFunction Tcp::m_disconnectFunction
private

Definition at line 81 of file tcp.hpp.

◆ m_disconnectFunctionObjPtr

void* Tcp::m_disconnectFunctionObjPtr
private

Definition at line 82 of file tcp.hpp.

◆ m_longStringWarningPrinted

bool Tcp::m_longStringWarningPrinted
private

Definition at line 58 of file tcp.hpp.

◆ m_readFunction

ReadFunction Tcp::m_readFunction
private

Definition at line 79 of file tcp.hpp.

◆ m_readFunctionObjPtr

void* Tcp::m_readFunctionObjPtr
private

Definition at line 80 of file tcp.hpp.

◆ m_readThread

SickThread<Tcp, &Tcp::readThreadFunction> Tcp::m_readThread
private

Definition at line 76 of file tcp.hpp.

◆ m_rxBuffer

std::list<unsigned char> Tcp::m_rxBuffer
private

Definition at line 61 of file tcp.hpp.

◆ m_rxString

std::string Tcp::m_rxString
private

Definition at line 59 of file tcp.hpp.

◆ m_serverAddr

struct sockaddr_in Tcp::m_serverAddr
private

Definition at line 66 of file tcp.hpp.

◆ m_socketMutex

Mutex Tcp::m_socketMutex
private

Definition at line 68 of file tcp.hpp.


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