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

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

Definition at line 53 of file tcp.hpp.

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

Definition at line 49 of file tcp.hpp.

Constructor & Destructor Documentation

Tcp::Tcp ( )

Definition at line 22 of file tcp.cpp.

Tcp::~Tcp ( void  )

Definition at line 40 of file tcp.cpp.

Member Function Documentation

void Tcp::close ( )

Definition at line 326 of file tcp.cpp.

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.

bool Tcp::isClientConnected_unlocked ( )
private
bool Tcp::isOpen ( )

True = offen

– Wir sind der Client und mit einem Server verbunden –

Definition at line 95 of file tcp.cpp.

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

Definition at line 136 of file tcp.cpp.

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

Definition at line 119 of file tcp.cpp.

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

Definition at line 389 of file tcp.cpp.

INT32 Tcp::readInputData ( )
private

Definition at line 229 of file tcp.cpp.

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.

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

Definition at line 195 of file tcp.cpp.

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

Definition at line 82 of file tcp.cpp.

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

Definition at line 110 of file tcp.cpp.

void Tcp::startServerThread ( )
private
void Tcp::stopReadThread ( )
private

Stoppe den Lese-Thread.

Definition at line 358 of file tcp.cpp.

void Tcp::stopServerThread ( )
private
bool Tcp::write ( UINT8 buffer,
UINT32  numberOfBytes 
)

Definition at line 51 of file tcp.cpp.

Member Data Documentation

bool Tcp::m_beVerbose
private

Definition at line 67 of file tcp.hpp.

INT32 Tcp::m_connectionSocket
private

Definition at line 70 of file tcp.hpp.

DisconnectFunction Tcp::m_disconnectFunction
private

Definition at line 81 of file tcp.hpp.

void* Tcp::m_disconnectFunctionObjPtr
private

Definition at line 82 of file tcp.hpp.

bool Tcp::m_longStringWarningPrinted
private

Definition at line 58 of file tcp.hpp.

ReadFunction Tcp::m_readFunction
private

Definition at line 79 of file tcp.hpp.

void* Tcp::m_readFunctionObjPtr
private

Definition at line 80 of file tcp.hpp.

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

Definition at line 76 of file tcp.hpp.

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

Definition at line 61 of file tcp.hpp.

std::string Tcp::m_rxString
private

Definition at line 59 of file tcp.hpp.

struct sockaddr_in Tcp::m_serverAddr
private

Definition at line 66 of file tcp.hpp.

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 Tue Jul 9 2019 04:55:32