Kanzi Connect 3.9.10
kanzi::connect::ConnectedClientProxy Class Reference

#include <connected_client.hpp>

Inheritance diagram for kanzi::connect::ConnectedClientProxy:
kanzi::connect::ConnectedClient

Public Member Functions

optional< int > acquireSession (const string &interfaceId)
 Acquire new client session to be used with this client.
 
 ConnectedClientProxy (ServiceManagerSharedPtr serviceManager, MessageDispatcherSharedPtr dispatcher, int clientId)
 Constructor.
 
ServiceHostSharedPtr getServiceHost (int sessionId)
 Get service host for session identifier.
 
AbstractSessionSharedPtr getSession (int sessionId)
 Get session for identifier.
 
void releaseSession (int sessionId)
 Sends a stop message through the message handler and release the allocated session.
 
bool send (MessagePackage &message, int sessionId)
 Send a message through client.
 
void setConnectionManager (ConnectionManagerSharedPtr connectionManager)
 If the given client identifier was allocated from client id manager, set the connection manager so that client can release the handle upon destruction.
 
 ~ConnectedClientProxy ()
 Destructor.
 
- Public Member Functions inherited from kanzi::connect::ConnectedClient
 ConnectedClient (shared_ptr< MessageDispatcher > dispatcher, int id=-1)
 Constructor.
 
const string & getAddress () const
 Retrieves ip address of the client.
 
int64_t getFirstMessageWaitTimerHandle () const
 get handle used to track first message
 
int getId () const
 Return the internally hold ID, -1 if not configured.
 
shared_ptr< MessageDispatchergetMessageDispatcher ()
 Retrieves message dispatcher of this client.
 
const string & getName () const
 Retrieves name of the client.
 
const string & getProtocol () const
 Retrieves the protocol assigned to a client connection.
 
Role getRole () const
 Retrieves the role of an object.
 
void setAddress (const string &address)
 Sets IP address for a client.
 
void setFirstMessageWaitTimerHandle (int64_t handle)
 Store a handle used to track first message.
 
void setName (const string &name)
 Sets name for a client.
 
void setProtocol (const string &protocol)
 Sets the protocol for the client.
 
void setRole (Role role)
 Configure the role.
 
string toString () const
 Get textual information of the client to for example logging purposes.
 
 ~ConnectedClient ()
 Destructor.
 

Static Public Member Functions

static ConnectedClientProxySharedPtr create (const string &name, ConnectDomainSharedPtr connectDomain, MessageDispatcherSharedPtr dispatcher, const string &clientIdMgrType)
 

Additional Inherited Members

- Public Types inherited from kanzi::connect::ConnectedClient
enum  Role { RoleClient , RoleServer }
 
typedef enum kanzi::connect::ConnectedClient::Role Role
 

Constructor & Destructor Documentation

◆ ConnectedClientProxy()

kanzi::connect::ConnectedClientProxy::ConnectedClientProxy ( ServiceManagerSharedPtr serviceManager,
MessageDispatcherSharedPtr dispatcher,
int clientId )

Constructor.

Parameters
serviceManagerThe interface to be used when finding service hosts and sending messages.
dispatcherThe message dispatcher to be used with responses.
clientIdThe client identifier used when communicating with services, needs to be unique.

◆ ~ConnectedClientProxy()

kanzi::connect::ConnectedClientProxy::~ConnectedClientProxy ( )

Destructor.

Member Function Documentation

◆ acquireSession()

optional< int > kanzi::connect::ConnectedClientProxy::acquireSession ( const string & interfaceId)

Acquire new client session to be used with this client.

Parameters
interfaceIdIdentifier of the service.
Returns
New session if service host was found.

◆ create()

static ConnectedClientProxySharedPtr kanzi::connect::ConnectedClientProxy::create ( const string & name,
ConnectDomainSharedPtr connectDomain,
MessageDispatcherSharedPtr dispatcher,
const string & clientIdMgrType )
static

◆ getServiceHost()

ServiceHostSharedPtr kanzi::connect::ConnectedClientProxy::getServiceHost ( int sessionId)

Get service host for session identifier.

Parameters
sessionIdThe identifier for a session.
Returns
On success, return a pointer to a service host, nullptr otherwise.

◆ getSession()

AbstractSessionSharedPtr kanzi::connect::ConnectedClientProxy::getSession ( int sessionId)

Get session for identifier.

Parameters
sessionIdThe identifier for a session.
Returns
On success, return a pointer to a session, nullptr otherwise.

◆ releaseSession()

void kanzi::connect::ConnectedClientProxy::releaseSession ( int sessionId)

Sends a stop message through the message handler and release the allocated session.

Parameters
sessionIdThe identifier of a session to be released. If session id is not found, the method does nothing.

◆ send()

bool kanzi::connect::ConnectedClientProxy::send ( MessagePackage & message,
int sessionId )

Send a message through client.

Modify message package with session information.

Parameters
messageThe message package to be modified and sent.
sessionIdThe identifier for the session to be used when sending.
Returns
True if message was sent.

◆ setConnectionManager()

void kanzi::connect::ConnectedClientProxy::setConnectionManager ( ConnectionManagerSharedPtr connectionManager)

If the given client identifier was allocated from client id manager, set the connection manager so that client can release the handle upon destruction.

Parameters
connectionManagerThe connection manager instance that was used when allocating the client identifier.

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