Kanzi Connect  3.9.8
Kanzi Connect C++ API
kanzi::connect::AbstractInterfaceClient Class Referenceabstract

An abstract client-side network interface class for services in Kanzi Connect network. More...

#include <abstract_interface_client.hpp>

Inheritance diagram for kanzi::connect::AbstractInterfaceClient:
kanzi::connect::InterfaceClient< InterfaceObserver, ExternalClientSession > kanzi::connect::InterfaceClient< ObserverClass, SessionClass > kanzi::connect::ExternalClientInterface

Public Types

typedef function< void(bool)> ServiceReachableCallback
 Callback to inform whether service at server is available or not. More...
 

Public Member Functions

 AbstractInterfaceClient (RPCCallStore &callStore)
 Constructor. More...
 
AbstractSessionSharedPtr acquireAbstractSession (MessageDispatcher *dispatcher)
 Acquires a session for this interface. More...
 
virtual string getIdentifier () const =0
 Returns the type id of the interface. More...
 
shared_ptr< p2p::RoutingRulesgetRoutingRules ()
 Retrieve routing rules for this particular client. More...
 
AbstractSessionSharedPtr getSession (int sessionId)
 Returns session by id. More...
 
bool isSessionRunning (AbstractSessionSharedPtr session) const
 Check if the given session is running or not. More...
 
void notifyServiceReachable (bool reachable)
 Invoked to notify clients whether specific service is reachable or not. More...
 
virtual void receive (const MessagePackage &message)
 Pass a message package to this interface, resolves proper session and makes it receive the package. More...
 
virtual void registerRemoteInterface (MessageTranslator *translator)
 Registers this interface to given message translator. More...
 
void releaseAbstractSession (AbstractSessionSharedPtr session)
 Releases given session from this interface. More...
 
bool serviceReachable () const
 Is service currently known to be reachable. More...
 
void setClient (ClientSharedPtr client)
 Stores the client this interface is bound to. More...
 
void setServiceReachableCallback (ServiceReachableCallback callback)
 Registers service reachable callback. More...
 
void setSessionRunning (AbstractSessionSharedPtr session)
 Set the given session to running state. More...
 
void setSessionStopped (AbstractSessionSharedPtr session)
 Set the given session to stopped state. More...
 
void stopAllSessions ()
 Ends all sessions since maybe the service itself has disappeared. More...
 
void terminateAllSessions ()
 Terminates all ongoing sessions. More...
 
virtual ~AbstractInterfaceClient ()
 Destructor. More...
 

Protected Member Functions

virtual AbstractSessionSharedPtr onAcquireSession (int sessionId, MessageDispatcher *dispatcher)=0
 Function that allows derived classes to create their type-specific session instance. More...
 
virtual void onReleaseSession (AbstractSessionSharedPtr session)
 Function that allows derived classes to destroy their type-specific session instance. More...
 

Protected Attributes

RPCCallStorem_callStore
 

Detailed Description

An abstract client-side network interface class for services in Kanzi Connect network.

Member Typedef Documentation

◆ ServiceReachableCallback

Callback to inform whether service at server is available or not.

Constructor & Destructor Documentation

◆ AbstractInterfaceClient()

kanzi::connect::AbstractInterfaceClient::AbstractInterfaceClient ( RPCCallStore callStore)

Constructor.

◆ ~AbstractInterfaceClient()

virtual kanzi::connect::AbstractInterfaceClient::~AbstractInterfaceClient ( )
virtual

Destructor.

Member Function Documentation

◆ acquireAbstractSession()

AbstractSessionSharedPtr kanzi::connect::AbstractInterfaceClient::acquireAbstractSession ( MessageDispatcher dispatcher)

Acquires a session for this interface.

Parameters
dispatcherMessage dispatcher that is used to deliver network messages.
Returns
Session that was created.

◆ getIdentifier()

virtual string kanzi::connect::AbstractInterfaceClient::getIdentifier ( ) const
pure virtual

Returns the type id of the interface.

This is used to identify the service in the network.

Returns
Type of the interface, as a string.

Implemented in kanzi::connect::InterfaceClient< ObserverClass, SessionClass >, and kanzi::connect::InterfaceClient< InterfaceObserver, ExternalClientSession >.

◆ getRoutingRules()

shared_ptr<p2p::RoutingRules> kanzi::connect::AbstractInterfaceClient::getRoutingRules ( )

Retrieve routing rules for this particular client.

Returns
routing defintion.

◆ getSession()

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

Returns session by id.

Parameters
sessionIdId of the session.
Returns
Session that matches given id, or 0 if there was no such session.

◆ isSessionRunning()

bool kanzi::connect::AbstractInterfaceClient::isSessionRunning ( AbstractSessionSharedPtr  session) const

Check if the given session is running or not.

Parameters
sessionThe session to check
Returns
True if the session is running

◆ notifyServiceReachable()

void kanzi::connect::AbstractInterfaceClient::notifyServiceReachable ( bool  reachable)

Invoked to notify clients whether specific service is reachable or not.

◆ onAcquireSession()

virtual AbstractSessionSharedPtr kanzi::connect::AbstractInterfaceClient::onAcquireSession ( int  sessionId,
MessageDispatcher dispatcher 
)
protectedpure virtual

Function that allows derived classes to create their type-specific session instance.

Parameters
sessionIdSession Id of the connected client, needs to be unique for this client.
dispatcherMessage dispatcher that is used to deliver network messages.
Returns
New session instance for this type of interface.

Implemented in kanzi::connect::InterfaceClient< ObserverClass, SessionClass >, and kanzi::connect::InterfaceClient< InterfaceObserver, ExternalClientSession >.

◆ onReleaseSession()

virtual void kanzi::connect::AbstractInterfaceClient::onReleaseSession ( AbstractSessionSharedPtr  session)
inlineprotectedvirtual

Function that allows derived classes to destroy their type-specific session instance.

Parameters
sessionSession to release.

Reimplemented in kanzi::connect::ExternalClientInterface.

◆ receive()

virtual void kanzi::connect::AbstractInterfaceClient::receive ( const MessagePackage message)
virtual

Pass a message package to this interface, resolves proper session and makes it receive the package.

Parameters
messageMessage that was sent.

Reimplemented in kanzi::connect::InterfaceClient< ObserverClass, SessionClass >, and kanzi::connect::InterfaceClient< InterfaceObserver, ExternalClientSession >.

◆ registerRemoteInterface()

virtual void kanzi::connect::AbstractInterfaceClient::registerRemoteInterface ( MessageTranslator translator)
virtual

Registers this interface to given message translator.

Parameters
translatorTranslator to receive the interface definition.

◆ releaseAbstractSession()

void kanzi::connect::AbstractInterfaceClient::releaseAbstractSession ( AbstractSessionSharedPtr  session)

Releases given session from this interface.

Parameters
sessionSession to release.

◆ serviceReachable()

bool kanzi::connect::AbstractInterfaceClient::serviceReachable ( ) const

Is service currently known to be reachable.

Returns
true if service is reachable.

◆ setClient()

void kanzi::connect::AbstractInterfaceClient::setClient ( ClientSharedPtr  client)
inline

Stores the client this interface is bound to.

◆ setServiceReachableCallback()

void kanzi::connect::AbstractInterfaceClient::setServiceReachableCallback ( ServiceReachableCallback  callback)

Registers service reachable callback.

Parameters
callbackthe callback to configure.

◆ setSessionRunning()

void kanzi::connect::AbstractInterfaceClient::setSessionRunning ( AbstractSessionSharedPtr  session)

Set the given session to running state.

Parameters
sessionThe session to set

◆ setSessionStopped()

void kanzi::connect::AbstractInterfaceClient::setSessionStopped ( AbstractSessionSharedPtr  session)

Set the given session to stopped state.

Parameters
sessionThe session to set

◆ stopAllSessions()

void kanzi::connect::AbstractInterfaceClient::stopAllSessions ( )

Ends all sessions since maybe the service itself has disappeared.

◆ terminateAllSessions()

void kanzi::connect::AbstractInterfaceClient::terminateAllSessions ( )

Terminates all ongoing sessions.

Member Data Documentation

◆ m_callStore

RPCCallStore& kanzi::connect::AbstractInterfaceClient::m_callStore
protected

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