UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Protected Slots | Protected Attributes | List of all members
hds::MessengerLS Class Reference

#include <hds_messenger_ls.hpp>

Inheritance diagram for hds::MessengerLS:
hds::Messenger

Public Types

enum  State { SERVER = 0, CLIENT, UNDEFINED }
 
- Public Types inherited from hds::Messenger
enum  MsgType {
  UNDEFINED_MSG = 0, INFO_MSG, WARNING_MSG, ERROR_MSG,
  DEBUG_MSG, SHOW_PROGRESS_MSG, HIDE_PROGRESS_MSG, SET_PROGRESS_VALUE_MSG,
  SET_PROGRESS_RANGES_MSG, SET_PROGRESS_STATUS_MSG
}
 

Public Member Functions

 MessengerLS (QObject *parent=0x0)
 
 MessengerLS (const QString &sock_name, State state=CLIENT, int connection_time_out=0, QObject *parent=0x0)
 
virtual ~MessengerLS ()
 
State init (const QString &sock_name, State state=CLIENT, int connection_time_out=0)
 
virtual void sendMsg (const hds::Messenger::Message &msg) const
 
virtual hds::Messenger::Message getMsg () const
 
const QString & socketName () const
 
int waitConnectionTimeOut () const
 
void setConnectionTimeOut (int dt)
 
State state () const
 
bool hasMessages ()
 
- Public Member Functions inherited from hds::Messenger
 Messenger ()
 
virtual ~Messenger ()
 
void info (const QString &str) const
 
void warning (const QString &str) const
 
void error (const QString &str) const
 
void debug (const QString &str) const
 

Protected Slots

virtual void socket_connection_error (QLocalSocket::LocalSocketError socketError)
 
virtual void socket_connected ()
 
virtual void socket_disconnected ()
 

Protected Attributes

QLocalServer m_server
 
QLocalSocket m_socket
 
QString m_socket_name
 
State m_state
 
int m_connection_wait_time_out
 

Detailed Description

Provideas log messages sending for HDS Module using local sockets.

Member Enumeration Documentation

State of logger

Enumerator
SERVER 

Logger initialized as a server.

CLIENT 

Logger initialized as a client.

UNDEFINED 

Logger not properly initialized.

Constructor & Destructor Documentation

hds::MessengerLS::MessengerLS ( QObject *  parent = 0x0)

Default constructor. State will be UNDEFINED untill init() called.

hds::MessengerLS::MessengerLS ( const QString &  sock_name,
State  state = CLIENT,
int  connection_time_out = 0,
QObject *  parent = 0x0 
)

Construct logger object for provided socket name. State will be UNDEFINED on errors.

Parameters
sock_nameName of the socket.
stateServer(true) or client(false) state.
connection_time_outDelay (ms) for connection waiting
parentParent for QObject.
virtual hds::MessengerLS::~MessengerLS ( )
virtual

Destructor.

Member Function Documentation

virtual hds::Messenger::Message hds::MessengerLS::getMsg ( ) const
virtual
Get first message with it's type, return message of undefined type  

if no messages presents. Content of the message should be defined in compliance with the type.

Implements hds::Messenger.

bool hds::MessengerLS::hasMessages ( )
Return true if logger has messages not taken by getMsg().

Only in works in SERVER mode and for other modes return false.

State hds::MessengerLS::init ( const QString &  sock_name,
State  state = CLIENT,
int  connection_time_out = 0 
)
Initialize logger in client or server mode. 

If server was initialized as server early => stop listening and close it's socket. Return the state of object.

Parameters
sock_nameName of the socket.
stateServer(true) or client(false) state.
connection_time_outDelay (ms) for connection waiting
virtual void hds::MessengerLS::sendMsg ( const hds::Messenger::Message msg) const
virtual
Send message with provided type. Content of the message 

should be defined in compliance with the type.

Implements hds::Messenger.

void hds::MessengerLS::setConnectionTimeOut ( int  dt)
inline

Set delay dt(ms) for connection waiting.

const QString& hds::MessengerLS::socketName ( ) const
inline

Return current socket name.

State hds::MessengerLS::state ( ) const
inline

Return state of the logger.

int hds::MessengerLS::waitConnectionTimeOut ( ) const
inline

Delay for connection waiting (ms).

Member Data Documentation

QLocalServer hds::MessengerLS::m_server
mutableprotected

< Local server. Local socket.

QLocalSocket hds::MessengerLS::m_socket
mutableprotected

Name of the local socket.

State hds::MessengerLS::m_state
protected

Current state of the logger. Current connection wait time out.


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