TwiceAsNice  2019-02-18
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
Nice::ChatCore Class Referenceabstract

core communication library for serial tty and sockets tcp More...

#include <Core.h>

Inheritance diagram for Nice::ChatCore:
Inheritance graph
Collaboration diagram for Nice::ChatCore:
Collaboration graph

Public Types

enum  ChatVERBOSE {
  ChatVERBOSE = 0x1, ChatCOLOR = 0x2, ChatTIME = 0x4, ChatECHO = 0x8,
  ChatVERBOSE = 0x1, ChatCOLOR = 0x2, ChatTIME = 0x4, ChatECHO = 0x8
}
 
enum  ChatVERBOSE {
  ChatVERBOSE = 0x1, ChatCOLOR = 0x2, ChatTIME = 0x4, ChatECHO = 0x8,
  ChatVERBOSE = 0x1, ChatCOLOR = 0x2, ChatTIME = 0x4, ChatECHO = 0x8
}
 

Public Member Functions

 ChatCore ()
 constructor More...
 
 ChatCore (const char *_device)
 constructor with devicename tcp://HOSTNAME:PORT or tty:/dev/ttyX:BAUD. More...
 
 ChatCore (int _fd)
 constructor with file descriptor More...
 
virtual ~ChatCore ()
 destructor More...
 
virtual int open ()
 
virtual int open (const char *_device)
 open device with name tcp://HOSTNAME:PORT or tty:/dev/ttyX:BAUD. More...
 
virtual int open (int _fd)
 open device with file descriptor More...
 
virtual int close ()
 closedevice More...
 
virtual bool isConnected () const
 check if its connected More...
 
virtual int wait (Nice::Time _time)
 wait _time sec for data, returns earlier as soon as data has arrived. More...
 
virtual int openListenSocket (int _port)
 open a listen socket. More...
 
virtual int tryAccept (ChatCore &_newConnection)
 try accepting for X secs. X is set by member setTimeout More...
 
void setTimeout (Nice::Time _t)
 set read timeout in seconds, -1 = wait forever. More...
 
Nice::Time timeout ()
 
void setVerbose (int _v)
 set verbosity parameters More...
 
void setName (std::string _name)
 
std::string name ()
 
 ChatCore ()
 constructor More...
 
 ChatCore (const char *_device)
 constructor with devicename tcp://HOSTNAME:PORT or tty:/dev/ttyX:BAUD. More...
 
 ChatCore (int _fd)
 constructor with file descriptor More...
 
virtual ~ChatCore ()
 destructor More...
 
virtual int open ()
 
virtual int open (const char *_device)
 open device with name tcp://HOSTNAME:PORT or tty:/dev/ttyX:BAUD. More...
 
virtual int open (int _fd)
 open device with file descriptor More...
 
virtual int close ()
 closedevice More...
 
virtual bool isConnected () const
 check if its connected More...
 
virtual int wait (Nice::Time _time)
 wait _time sec for data, returns earlier as soon as data has arrived. More...
 
virtual int openListenSocket (int _port)
 open a listen socket. More...
 
virtual int tryAccept (ChatCore &_newConnection)
 try accepting for X secs. X is set by member setTimeout More...
 
void setTimeout (Nice::Time _t)
 set read timeout in seconds, -1 = wait forever. More...
 
Nice::Time timeout ()
 
void setVerbose (int _v)
 set verbosity parameters More...
 
void setName (std::string _name)
 
std::string name ()
 

Protected Member Functions

int openTCP (std::string &_host, uint16_t _port)
 
int openTTY (std::string &_device, int _baud, int _numbits, std::string _parity)
 
virtual void setStdSettings ()
 
virtual void timeoutAktion (const std::string &)=0
 
int openTCP (std::string &_host, uint16_t _port)
 
int openTTY (std::string &_device, int _baud, int _numbits, std::string _parity)
 
virtual void setStdSettings ()
 
virtual void timeoutAktion (const std::string &)=0
 

Protected Attributes

std::string m_device_name
 
int m_fd
 
Nice::Time m_timeout
 
int verbose_
 
bool m_persistent
 
std::string m_name
 

Private Member Functions

std::string createMessageForErrno (int errorNumber)
 
std::string createMessageForErrno (int errorNumber)
 

Detailed Description

core communication library for serial tty and sockets tcp

Author
Florian Briegel
Version
11.02.04
Date
2012-08-10 11:04:58 AM

Member Enumeration Documentation

◆ ChatVERBOSE [1/2]

Enumerator
ChatVERBOSE 
ChatCOLOR 
ChatTIME 
ChatECHO 
ChatVERBOSE 
ChatCOLOR 
ChatTIME 
ChatECHO 

◆ ChatVERBOSE [2/2]

Enumerator
ChatVERBOSE 
ChatCOLOR 
ChatTIME 
ChatECHO 
ChatVERBOSE 
ChatCOLOR 
ChatTIME 
ChatECHO 

Constructor & Destructor Documentation

◆ ChatCore() [1/6]

Nice::ChatCore::ChatCore ( )

constructor

◆ ChatCore() [2/6]

Nice::ChatCore::ChatCore ( const char *  _device)

constructor with devicename tcp://HOSTNAME:PORT or tty:/dev/ttyX:BAUD.

◆ ChatCore() [3/6]

Nice::ChatCore::ChatCore ( int  _fd)

constructor with file descriptor

◆ ~ChatCore() [1/2]

Nice::ChatCore::~ChatCore ( )
virtual

destructor

◆ ChatCore() [4/6]

Nice::ChatCore::ChatCore ( )

constructor

◆ ChatCore() [5/6]

Nice::ChatCore::ChatCore ( const char *  _device)

constructor with devicename tcp://HOSTNAME:PORT or tty:/dev/ttyX:BAUD.

◆ ChatCore() [6/6]

Nice::ChatCore::ChatCore ( int  _fd)

constructor with file descriptor

◆ ~ChatCore() [2/2]

virtual Nice::ChatCore::~ChatCore ( )
virtual

destructor

Member Function Documentation

◆ close() [1/2]

int Nice::ChatCore::close ( void  )
virtual

closedevice

Reimplemented in Basda::ChatLineMockCore, and Basda::ChatLineMockCore.

◆ close() [2/2]

virtual int Nice::ChatCore::close ( )
virtual

closedevice

Reimplemented in Basda::ChatLineMockCore, and Basda::ChatLineMockCore.

◆ createMessageForErrno() [1/2]

std::string Nice::ChatCore::createMessageForErrno ( int  errorNumber)
private

◆ createMessageForErrno() [2/2]

std::string Nice::ChatCore::createMessageForErrno ( int  errorNumber)
private

◆ isConnected() [1/2]

virtual bool Nice::ChatCore::isConnected ( ) const
inlinevirtual

check if its connected

◆ isConnected() [2/2]

virtual bool Nice::ChatCore::isConnected ( ) const
inlinevirtual

check if its connected

◆ name() [1/2]

std::string Nice::ChatCore::name ( )
inline

◆ name() [2/2]

std::string Nice::ChatCore::name ( )
inline

◆ open() [1/6]

virtual int Nice::ChatCore::open ( )
virtual

Reimplemented in Basda::PdvChat, Basda::PdvChat, and Basda::PdvChat.

◆ open() [2/6]

int Nice::ChatCore::open ( void  )
virtual

Reimplemented in Basda::PdvChat, Basda::PdvChat, and Basda::PdvChat.

◆ open() [3/6]

int Nice::ChatCore::open ( const char *  _device)
virtual

open device with name tcp://HOSTNAME:PORT or tty:/dev/ttyX:BAUD.

Reimplemented in Basda::PdvChat, Basda::PdvChat, Basda::PdvChat, Basda::LilJoeChitChat, Basda::LilJoeChitChat, Basda::LilJoeChitChat, Basda::ChatLineMockCore, and Basda::ChatLineMockCore.

◆ open() [4/6]

virtual int Nice::ChatCore::open ( const char *  _device)
virtual

open device with name tcp://HOSTNAME:PORT or tty:/dev/ttyX:BAUD.

Reimplemented in Basda::PdvChat, Basda::PdvChat, Basda::PdvChat, Basda::LilJoeChitChat, Basda::LilJoeChitChat, Basda::LilJoeChitChat, Basda::ChatLineMockCore, and Basda::ChatLineMockCore.

◆ open() [5/6]

virtual int Nice::ChatCore::open ( int  _fd)
virtual

open device with file descriptor

Reimplemented in Basda::PdvChat, Basda::PdvChat, and Basda::PdvChat.

◆ open() [6/6]

int Nice::ChatCore::open ( int  _fd)
virtual

open device with file descriptor

Reimplemented in Basda::PdvChat, Basda::PdvChat, and Basda::PdvChat.

◆ openListenSocket() [1/2]

virtual int Nice::ChatCore::openListenSocket ( int  _port)
virtual

open a listen socket.

◆ openListenSocket() [2/2]

int Nice::ChatCore::openListenSocket ( int  _port)
virtual

open a listen socket.

◆ openTCP() [1/2]

int Nice::ChatCore::openTCP ( std::string &  _host,
uint16_t  _port 
)
protected

◆ openTCP() [2/2]

int Nice::ChatCore::openTCP ( std::string &  _host,
uint16_t  _port 
)
protected

◆ openTTY() [1/2]

int Nice::ChatCore::openTTY ( std::string &  _device,
int  _baud,
int  _numbits,
std::string  _parity 
)
protected

◆ openTTY() [2/2]

int Nice::ChatCore::openTTY ( std::string &  _device,
int  _baud,
int  _numbits,
std::string  _parity 
)
protected

◆ setName() [1/2]

void Nice::ChatCore::setName ( std::string  _name)
inline

◆ setName() [2/2]

void Nice::ChatCore::setName ( std::string  _name)
inline

◆ setStdSettings() [1/2]

virtual void Nice::ChatCore::setStdSettings ( )
protectedvirtual

◆ setStdSettings() [2/2]

void Nice::ChatCore::setStdSettings ( )
protectedvirtual

◆ setTimeout() [1/2]

void Nice::ChatCore::setTimeout ( Nice::Time  _t)
inline

set read timeout in seconds, -1 = wait forever.

◆ setTimeout() [2/2]

void Nice::ChatCore::setTimeout ( Nice::Time  _t)
inline

set read timeout in seconds, -1 = wait forever.

◆ setVerbose() [1/2]

void Nice::ChatCore::setVerbose ( int  _v)
inline

set verbosity parameters

The following flags can be combined:

    ChatCore::VERBOSE        verbosity - prints sent and rcvd lines.
    ChatCore::COLOR          ansi color - if you like color in your live.
    ChatCore::TIME           prints time between sent and rcvd lines.
    ChatCore::ECHO           prints every received character.

◆ setVerbose() [2/2]

void Nice::ChatCore::setVerbose ( int  _v)
inline

set verbosity parameters

The following flags can be combined:

    ChatCore::VERBOSE        verbosity - prints sent and rcvd lines.
    ChatCore::COLOR          ansi color - if you like color in your live.
    ChatCore::TIME           prints time between sent and rcvd lines.
    ChatCore::ECHO           prints every received character.

◆ timeout() [1/2]

Nice::Time Nice::ChatCore::timeout ( )
inline

◆ timeout() [2/2]

Nice::Time Nice::ChatCore::timeout ( )
inline

◆ timeoutAktion() [1/2]

virtual void Nice::ChatCore::timeoutAktion ( const std::string &  )
protectedpure virtual

◆ timeoutAktion() [2/2]

virtual void Nice::ChatCore::timeoutAktion ( const std::string &  )
protectedpure virtual

◆ tryAccept() [1/2]

virtual int Nice::ChatCore::tryAccept ( ChatCore _newConnection)
virtual

try accepting for X secs. X is set by member setTimeout

◆ tryAccept() [2/2]

int Nice::ChatCore::tryAccept ( ChatCore _newConnection)
virtual

try accepting for X secs. X is set by member setTimeout

◆ wait() [1/2]

int Nice::ChatCore::wait ( Nice::Time  _time)
virtual

wait _time sec for data, returns earlier as soon as data has arrived.

◆ wait() [2/2]

virtual int Nice::ChatCore::wait ( Nice::Time  _time)
virtual

wait _time sec for data, returns earlier as soon as data has arrived.

Member Data Documentation

◆ m_device_name

std::string Nice::ChatCore::m_device_name
protected

◆ m_fd

int Nice::ChatCore::m_fd
protected

◆ m_name

std::string Nice::ChatCore::m_name
protected

◆ m_persistent

bool Nice::ChatCore::m_persistent
protected

◆ m_timeout

Nice::Time Nice::ChatCore::m_timeout
protected

◆ verbose_

int Nice::ChatCore::verbose_
protected

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