TwiceAsNice  2019-02-18
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Basda::ChatLineMockUnimod Class Reference

#include <ChatLineMock.h>

Inheritance diagram for Basda::ChatLineMockUnimod:
Inheritance graph
Collaboration diagram for Basda::ChatLineMockUnimod:
Collaboration graph

Public Member Functions

 ChatLineMockUnimod ()
 
virtual ~ChatLineMockUnimod ()
 
 ChatLineMockUnimod ()
 
virtual ~ChatLineMockUnimod ()
 
- Public Member Functions inherited from Basda::ChatLineMockCore
 ChatLineMockCore ()
 
virtual ~ChatLineMockCore ()
 
virtual int open (const char *_device)
 open device with name tcp://HOSTNAME:PORT or tty:/dev/ttyX:BAUD. More...
 
virtual int close ()
 closedevice More...
 
virtual int tryReadlines (const int _max=-1)
 check if you can savly read a line. More...
 
virtual int nprintf (int _max, const char *_rsp_fmtstr, const char *_cmd_fmtstr,...)
 send line _cmd with params (like printf) and recv lines until a line _rsp is received or _max lines received. More...
 
virtual int chat (const char *_rsp, int _max, const char *_cmd=NULL)
 send line _cmd and recv lines until a line _rsp is received or _max lines received. More...
 
virtual int chat (const char *_rsp, const char *_cmd=NULL)
 send line _cmd and recv lines until a line _rsp is received. More...
 
virtual void setResponse (unsigned int _cmdID, std::string _response, std::string _event="", Nice::Time _time=Nice::Time(), bool _repeat=false)
 This method allows to set the command response. More...
 
virtual std::vector< std::string > getBuffer ()
 All command responses are stored in the serial buffer (m_srbuffer). More...
 
std::string operator[] (int _num)
 This operation allows to have access to the elements within the serial buffer (m_srbuffer) More...
 
virtual unsigned int size ()
 
 ChatLineMockCore ()
 
virtual ~ChatLineMockCore ()
 
virtual int open (const char *_device)
 open device with name tcp://HOSTNAME:PORT or tty:/dev/ttyX:BAUD. More...
 
virtual int close ()
 closedevice More...
 
virtual int tryReadlines (const int _max=-1)
 check if you can savly read a line. More...
 
virtual int nprintf (int _max, const char *_rsp_fmtstr, const char *_cmd_fmtstr,...)
 send line _cmd with params (like printf) and recv lines until a line _rsp is received or _max lines received. More...
 
virtual int chat (const char *_rsp, int _max, const char *_cmd=NULL)
 send line _cmd and recv lines until a line _rsp is received or _max lines received. More...
 
virtual int chat (const char *_rsp, const char *_cmd=NULL)
 send line _cmd and recv lines until a line _rsp is received. More...
 
virtual void setResponse (unsigned int _cmdID, std::string _response, std::string _event="", Nice::Time _time=Nice::Time(), bool _repeat=false)
 This method allows to set the command response. More...
 
virtual std::vector< std::string > getBuffer ()
 All command responses are stored in the serial buffer (m_srbuffer). More...
 
std::string operator[] (int _num)
 This operation allows to have access to the elements within the serial buffer (m_srbuffer) More...
 
virtual unsigned int size ()
 
- Public Member Functions inherited from Nice::ChatLine
 ChatLine ()
 constructor More...
 
 ChatLine (const char *_device)
 constructor with devicename tcp://HOSTNAME:PORT or tty:/dev/ttyX:BAUD. More...
 
 ChatLine (int _fd)
 constructor with file descriptor More...
 
virtual ~ChatLine ()
 destructor More...
 
virtual int sendline (const std::string &_line)
 send line _line More...
 
virtual int recvline (std::string &_line)
 recv line _line More...
 
int dumpdata ()
 dump data in buffers More...
 
int chat (int _num, const char *_cmd=NULL)
 send line _cmd and wait for _num lines. More...
 
int mprintf (int _num, const char *_cmd=NULL,...)
 send line _cmd with params (like printf) and wait for _num lines. More...
 
int printf (const char *_rsp_fmtstr, const char *_cmd_fmtstr=NULL,...)
 send line _cmd with params (like printf) and recv lines until a line _rsp is received. More...
 
std::string operator[] (int _num)
 return recvd line number _num More...
 
std::size_t size ()
 return number of recvd lines More...
 
Nice::SeqString srbuffer ()
 
void setLineEnd (const char *_end)
 set the end of a rcvd- and sentline. More...
 
void setLineEndSend (const char *_end)
 the string _end is sent after every raw line. More...
 
void setLineEndRecv (const char *_end)
 characters from the string _end are used to detect the end of the line. More...
 
void setMinLine (int _min_line)
 
 ChatLine ()
 constructor More...
 
 ChatLine (const char *_device)
 constructor with devicename tcp://HOSTNAME:PORT or tty:/dev/ttyX:BAUD. More...
 
 ChatLine (int _fd)
 constructor with file descriptor More...
 
virtual ~ChatLine ()
 destructor More...
 
virtual int sendline (const std::string &_line)
 send line _line More...
 
virtual int recvline (std::string &_line)
 recv line _line More...
 
int dumpdata ()
 dump data in buffers More...
 
int chat (int _num, const char *_cmd=NULL)
 send line _cmd and wait for _num lines. More...
 
int mprintf (int _num, const char *_cmd=NULL,...)
 send line _cmd with params (like printf) and wait for _num lines. More...
 
int printf (const char *_rsp_fmtstr, const char *_cmd_fmtstr=NULL,...)
 send line _cmd with params (like printf) and recv lines until a line _rsp is received. More...
 
std::string operator[] (int _num)
 return recvd line number _num More...
 
std::size_t size ()
 return number of recvd lines More...
 
Nice::SeqString srbuffer ()
 
void setLineEnd (const char *_end)
 set the end of a rcvd- and sentline. More...
 
void setLineEndSend (const char *_end)
 the string _end is sent after every raw line. More...
 
void setLineEndRecv (const char *_end)
 characters from the string _end are used to detect the end of the line. More...
 
void setMinLine (int _min_line)
 
- Public Member Functions inherited from Nice::ChatCore
 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 (int _fd)
 open device with file descriptor 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 (int _fd)
 open device with file descriptor 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 ()
 

Private Member Functions

virtual int getResponse (const unsigned int _cmdID, const int _max=-1, const char *_cmd="")
 This command is used by the chat method to response for the correct command request. More...
 
virtual void sendCommandRequest (const unsigned int _cmdID, const char *_cmd)
 
virtual Nice::Time checkNextEvent ()
 
virtual int getResponse (const unsigned int _cmdID, const int _max=-1, const char *_cmd="")
 This command is used by the chat method to response for the correct command request. More...
 
virtual void sendCommandRequest (const unsigned int _cmdID, const char *_cmd)
 
virtual Nice::Time checkNextEvent ()
 

Private Attributes

Nice::Mutex m_mutex
 

Additional Inherited Members

- Public Types inherited from Nice::ChatLine
enum  { CONNECTION_TIMEOUT = -7777 }
 
enum  { CONNECTION_TIMEOUT = -7777 }
 
- Public Types inherited from Nice::ChatCore
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
}
 
- Protected Member Functions inherited from Basda::ChatLineMockCore
virtual void sendAllEvents ()
 
virtual void sendAllEvents ()
 
- Protected Member Functions inherited from Nice::ChatLine
virtual void setStdSettings ()
 
virtual void timeoutAktion (const std::string &)
 
virtual int getc (char *_ch)
 
virtual void setStdSettings ()
 
virtual void timeoutAktion (const std::string &)
 
virtual int getc (char *_ch)
 
- Protected Member Functions inherited from Nice::ChatCore
int openTCP (std::string &_host, uint16_t _port)
 
int openTTY (std::string &_device, int _baud, int _numbits, std::string _parity)
 
int openTCP (std::string &_host, uint16_t _port)
 
int openTTY (std::string &_device, int _baud, int _numbits, std::string _parity)
 
- Protected Attributes inherited from Basda::ChatLineMockCore
std::string m_endl
 
std::multimap< Nice::Date, std::vector< std::string > > m_eventStack
 
std::multimap< unsigned int, Replym_responseStack
 
std::queue< std::string > m_streamBuffer
 
bool m_sendVersionString
 
Nice::Mutex m_mutex
 
- Protected Attributes inherited from Nice::ChatLine
Nice::SeqString m_srbuffer
 
char m_lineEndSend [7]
 
char m_lineEndRecv [7]
 
unsigned int m_minLine
 
char m_readBlockBuffer [1025]
 
std::string m_readBuffer
 
std::string m_lineBuffer
 
- Protected Attributes inherited from Nice::ChatCore
std::string m_device_name
 
int m_fd
 
Nice::Time m_timeout
 
int verbose_
 
bool m_persistent
 
std::string m_name
 

Constructor & Destructor Documentation

◆ ChatLineMockUnimod() [1/2]

Basda::ChatLineMockUnimod::ChatLineMockUnimod ( )

◆ ~ChatLineMockUnimod() [1/2]

Basda::ChatLineMockUnimod::~ChatLineMockUnimod ( )
virtual

◆ ChatLineMockUnimod() [2/2]

Basda::ChatLineMockUnimod::ChatLineMockUnimod ( )

◆ ~ChatLineMockUnimod() [2/2]

virtual Basda::ChatLineMockUnimod::~ChatLineMockUnimod ( )
virtual

Member Function Documentation

◆ checkNextEvent() [1/2]

Nice::Time Basda::ChatLineMockUnimod::checkNextEvent ( )
privatevirtual

Reimplemented from Basda::ChatLineMockCore.

◆ checkNextEvent() [2/2]

virtual Nice::Time Basda::ChatLineMockUnimod::checkNextEvent ( )
privatevirtual

Reimplemented from Basda::ChatLineMockCore.

◆ getResponse() [1/2]

virtual int Basda::ChatLineMockUnimod::getResponse ( const unsigned int  _cmdID,
const int  _max = -1,
const char *  _cmd = "" 
)
privatevirtual

This command is used by the chat method to response for the correct command request.

It checks for event messages first and than for the command requests.

Parameters
_cmdIDThe command ID of the command request.
_maxThis number indicates how many lines the service want to be receive at once. If the number is -1, all lines will be send back.
_cmdThe command string is used for auto generation of the command response.
Returns
how many characters are read. A return value of -7777 indicates a read timeout.

Reimplemented from Basda::ChatLineMockCore.

◆ getResponse() [2/2]

int Basda::ChatLineMockUnimod::getResponse ( const unsigned int  _cmdID,
const int  _max = -1,
const char *  _cmd = "" 
)
privatevirtual

This command is used by the chat method to response for the correct command request.

It checks for event messages first and than for the command requests.

Parameters
_cmdIDThe command ID of the command request.
_maxThis number indicates how many lines the service want to be receive at once. If the number is -1, all lines will be send back.
_cmdThe command string is used for auto generation of the command response.
Returns
how many characters are read. A return value of -7777 indicates a read timeout.

Reimplemented from Basda::ChatLineMockCore.

◆ sendCommandRequest() [1/2]

void Basda::ChatLineMockUnimod::sendCommandRequest ( const unsigned int  _cmdID,
const char *  _cmd 
)
privatevirtual

Reimplemented from Basda::ChatLineMockCore.

◆ sendCommandRequest() [2/2]

virtual void Basda::ChatLineMockUnimod::sendCommandRequest ( const unsigned int  _cmdID,
const char *  _cmd 
)
privatevirtual

Reimplemented from Basda::ChatLineMockCore.

Member Data Documentation

◆ m_mutex

Nice::Mutex Basda::ChatLineMockUnimod::m_mutex
private

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