An abstract client-side network interface class for services in Kanzi Connect network. More...
#include <abstract_interface_client.hpp>
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::RoutingRules > | getRoutingRules () |
| 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) |
| Function that allows derived classes to destroy their type-specific session instance. More... | |
Protected Attributes | |
| RPCCallStore & | m_callStore |
An abstract client-side network interface class for services in Kanzi Connect network.
| typedef function<void(bool)> kanzi::connect::AbstractInterfaceClient::ServiceReachableCallback |
Callback to inform whether service at server is available or not.
| kanzi::connect::AbstractInterfaceClient::AbstractInterfaceClient | ( | RPCCallStore & | callStore | ) |
Constructor.
|
virtual |
Destructor.
| AbstractSessionSharedPtr kanzi::connect::AbstractInterfaceClient::acquireAbstractSession | ( | MessageDispatcher * | dispatcher | ) |
Acquires a session for this interface.
| dispatcher | Message dispatcher that is used to deliver network messages. |
|
pure virtual |
Returns the type id of the interface.
This is used to identify the service in the network.
Implemented in kanzi::connect::InterfaceClient< ObserverClass, SessionClass >, and kanzi::connect::InterfaceClient< InterfaceObserver, ExternalClientSession >.
| shared_ptr<p2p::RoutingRules> kanzi::connect::AbstractInterfaceClient::getRoutingRules | ( | ) |
Retrieve routing rules for this particular client.
| AbstractSessionSharedPtr kanzi::connect::AbstractInterfaceClient::getSession | ( | int | sessionId | ) |
Returns session by id.
| sessionId | Id of the session. |
| bool kanzi::connect::AbstractInterfaceClient::isSessionRunning | ( | AbstractSessionSharedPtr | session | ) | const |
Check if the given session is running or not.
| session | The session to check |
| void kanzi::connect::AbstractInterfaceClient::notifyServiceReachable | ( | bool | reachable | ) |
Invoked to notify clients whether specific service is reachable or not.
|
protectedpure virtual |
Function that allows derived classes to create their type-specific session instance.
| sessionId | Session Id of the connected client, needs to be unique for this client. |
| dispatcher | Message dispatcher that is used to deliver network messages. |
Implemented in kanzi::connect::InterfaceClient< ObserverClass, SessionClass >, and kanzi::connect::InterfaceClient< InterfaceObserver, ExternalClientSession >.
|
inlineprotectedvirtual |
Function that allows derived classes to destroy their type-specific session instance.
| session | Session to release. |
Reimplemented in kanzi::connect::ExternalClientInterface.
|
virtual |
Pass a message package to this interface, resolves proper session and makes it receive the package.
| message | Message that was sent. |
Reimplemented in kanzi::connect::InterfaceClient< ObserverClass, SessionClass >, and kanzi::connect::InterfaceClient< InterfaceObserver, ExternalClientSession >.
|
virtual |
Registers this interface to given message translator.
| translator | Translator to receive the interface definition. |
| void kanzi::connect::AbstractInterfaceClient::releaseAbstractSession | ( | AbstractSessionSharedPtr | session | ) |
Releases given session from this interface.
| session | Session to release. |
| bool kanzi::connect::AbstractInterfaceClient::serviceReachable | ( | ) | const |
Is service currently known to be reachable.
|
inline |
Stores the client this interface is bound to.
| void kanzi::connect::AbstractInterfaceClient::setServiceReachableCallback | ( | ServiceReachableCallback | callback | ) |
Registers service reachable callback.
| callback | the callback to configure. |
| void kanzi::connect::AbstractInterfaceClient::setSessionRunning | ( | AbstractSessionSharedPtr | session | ) |
Set the given session to running state.
| session | The session to set |
| void kanzi::connect::AbstractInterfaceClient::setSessionStopped | ( | AbstractSessionSharedPtr | session | ) |
Set the given session to stopped state.
| session | The session to set |
| void kanzi::connect::AbstractInterfaceClient::stopAllSessions | ( | ) |
Ends all sessions since maybe the service itself has disappeared.
| void kanzi::connect::AbstractInterfaceClient::terminateAllSessions | ( | ) |
Terminates all ongoing sessions.
|
protected |