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

#include <ChatLineMock.h>

Inheritance diagram for Basda::ChatLineMockMocon:
Inheritance graph
Collaboration diagram for Basda::ChatLineMockMocon:
Collaboration graph

Public Member Functions

 ChatLineMockMocon ()
 
virtual ~ChatLineMockMocon ()
 
virtual void setCycleTime (Nice::Time _cycleTime)
 
virtual void setStartDate (Nice::Date &_startDate)
 
virtual void setBlockUploadTime (Nice::Time &_blockUploadTime)
 
 ChatLineMockMocon ()
 
virtual ~ChatLineMockMocon ()
 
virtual void setCycleTime (Nice::Time _cycleTime)
 
virtual void setStartDate (Nice::Date &_startDate)
 
virtual void setBlockUploadTime (Nice::Time &_blockUploadTime)
 
- 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 setExternalProfileEvent (const unsigned int _cmdID, const char *_cmd)
 
virtual void sendAllEvents ()
 
virtual void sendCommandRequest (const unsigned int _cmdID, const char *_cmd)
 
virtual Nice::Time checkNextEvent ()
 
virtual Nice::I64 getCurrentCycle ()
 
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 setExternalProfileEvent (const unsigned int _cmdID, const char *_cmd)
 
virtual void sendAllEvents ()
 
virtual void sendCommandRequest (const unsigned int _cmdID, const char *_cmd)
 
virtual Nice::Time checkNextEvent ()
 
virtual Nice::I64 getCurrentCycle ()
 

Private Attributes

std::vector< std::string > m_profileCommands
 
Nice::Time m_cycleTime
 
Nice::Date m_referenceDate
 
Nice::I64 m_profileStartCycle
 
Nice::Date m_startDate
 
Nice::I64 m_profileCompleteEventCycle
 
Nice::Date m_profileBlockStartDate
 
std::pair< Nice::I64, std::string > m_profileCompleteEvent
 
unsigned int m_profileStartCmd
 
Nice::Date m_lastTriggerDate
 
bool m_firstSegmentOfBlock
 
Nice::Time m_blockLengthReference
 
Nice::Time m_blockLengthLast
 
Nice::Time m_blockUploadTime
 
int m_decelerationTime
 
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 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

◆ ChatLineMockMocon() [1/2]

Basda::ChatLineMockMocon::ChatLineMockMocon ( )

◆ ~ChatLineMockMocon() [1/2]

Basda::ChatLineMockMocon::~ChatLineMockMocon ( )
virtual

◆ ChatLineMockMocon() [2/2]

Basda::ChatLineMockMocon::ChatLineMockMocon ( )

◆ ~ChatLineMockMocon() [2/2]

virtual Basda::ChatLineMockMocon::~ChatLineMockMocon ( )
virtual

Member Function Documentation

◆ checkNextEvent() [1/2]

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

Reimplemented from Basda::ChatLineMockCore.

◆ checkNextEvent() [2/2]

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

Reimplemented from Basda::ChatLineMockCore.

◆ getCurrentCycle() [1/2]

Nice::I64 Basda::ChatLineMockMocon::getCurrentCycle ( )
privatevirtual

◆ getCurrentCycle() [2/2]

virtual Nice::I64 Basda::ChatLineMockMocon::getCurrentCycle ( )
privatevirtual

◆ getResponse() [1/2]

int Basda::ChatLineMockMocon::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]

virtual int Basda::ChatLineMockMocon::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.

◆ sendAllEvents() [1/2]

void Basda::ChatLineMockMocon::sendAllEvents ( )
privatevirtual

Reimplemented from Basda::ChatLineMockCore.

◆ sendAllEvents() [2/2]

virtual void Basda::ChatLineMockMocon::sendAllEvents ( )
privatevirtual

Reimplemented from Basda::ChatLineMockCore.

◆ sendCommandRequest() [1/2]

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

Reimplemented from Basda::ChatLineMockCore.

◆ sendCommandRequest() [2/2]

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

Reimplemented from Basda::ChatLineMockCore.

◆ setBlockUploadTime() [1/2]

void Basda::ChatLineMockMocon::setBlockUploadTime ( Nice::Time _blockUploadTime)
virtual

◆ setBlockUploadTime() [2/2]

virtual void Basda::ChatLineMockMocon::setBlockUploadTime ( Nice::Time _blockUploadTime)
virtual

◆ setCycleTime() [1/2]

virtual void Basda::ChatLineMockMocon::setCycleTime ( Nice::Time  _cycleTime)
virtual

◆ setCycleTime() [2/2]

void Basda::ChatLineMockMocon::setCycleTime ( Nice::Time  _cycleTime)
virtual

◆ setExternalProfileEvent() [1/2]

virtual void Basda::ChatLineMockMocon::setExternalProfileEvent ( const unsigned int  _cmdID,
const char *  _cmd 
)
privatevirtual

◆ setExternalProfileEvent() [2/2]

void Basda::ChatLineMockMocon::setExternalProfileEvent ( const unsigned int  _cmdID,
const char *  _cmd 
)
privatevirtual

◆ setStartDate() [1/2]

void Basda::ChatLineMockMocon::setStartDate ( Nice::Date _startDate)
virtual

◆ setStartDate() [2/2]

virtual void Basda::ChatLineMockMocon::setStartDate ( Nice::Date _startDate)
virtual

Member Data Documentation

◆ m_blockLengthLast

Nice::Time Basda::ChatLineMockMocon::m_blockLengthLast
private

◆ m_blockLengthReference

Nice::Time Basda::ChatLineMockMocon::m_blockLengthReference
private

◆ m_blockUploadTime

Nice::Time Basda::ChatLineMockMocon::m_blockUploadTime
private

◆ m_cycleTime

Nice::Time Basda::ChatLineMockMocon::m_cycleTime
private

◆ m_decelerationTime

int Basda::ChatLineMockMocon::m_decelerationTime
private

◆ m_firstSegmentOfBlock

bool Basda::ChatLineMockMocon::m_firstSegmentOfBlock
private

◆ m_lastTriggerDate

Nice::Date Basda::ChatLineMockMocon::m_lastTriggerDate
private

◆ m_mutex

Nice::Mutex Basda::ChatLineMockMocon::m_mutex
private

◆ m_profileBlockStartDate

Nice::Date Basda::ChatLineMockMocon::m_profileBlockStartDate
private

◆ m_profileCommands

std::vector< std::string > Basda::ChatLineMockMocon::m_profileCommands
private

◆ m_profileCompleteEvent

std::pair< Nice::I64, std::string > Basda::ChatLineMockMocon::m_profileCompleteEvent
private

◆ m_profileCompleteEventCycle

Nice::I64 Basda::ChatLineMockMocon::m_profileCompleteEventCycle
private

◆ m_profileStartCmd

unsigned int Basda::ChatLineMockMocon::m_profileStartCmd
private

◆ m_profileStartCycle

Nice::I64 Basda::ChatLineMockMocon::m_profileStartCycle
private

◆ m_referenceDate

Nice::Date Basda::ChatLineMockMocon::m_referenceDate
private

◆ m_startDate

Nice::Date Basda::ChatLineMockMocon::m_startDate
private

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