AbstractInterfaceClient¶
-
class
kanzi::connect
::
AbstractInterfaceClient
¶ An abstract client-side network interface class for services in Kanzi Connect network.
Subclassed by InterfaceClient< InterfaceObserver, ExternalClientSession >, InterfaceClient< ObserverClass, SessionClass >
Public Types
-
typedef function<void(bool)>
ServiceReachableCallback
¶ Callback to inform whether service at server is available or not.
Public Functions
-
AbstractInterfaceClient
(RPCCallStore &callStore)¶ Constructor.
-
virtual
~AbstractInterfaceClient
()¶ Destructor.
-
AbstractSessionSharedPtr
acquireAbstractSession
(MessageDispatcher *dispatcher)¶ Acquires a session for this interface.
- Parameters
dispatcher – Message dispatcher that is used to deliver network messages.
- Returns
Session that was created.
-
virtual string
getIdentifier
() const = 0¶ 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.
-
shared_ptr<p2p::RoutingRules>
getRoutingRules
()¶ Retrieve routing rules for this particular client.
- Returns
routing defintion.
-
AbstractSessionSharedPtr
getSession
(int sessionId)¶ Returns session by id.
- Parameters
sessionId – Id of the session.
- Returns
Session that matches given id, or 0 if there was no such session.
Check if the given session is running or not.
- Parameters
session – The session to check
- Returns
True if the session is running
-
void
notifyServiceReachable
(bool reachable)¶ Invoked to notify clients whether specific service is reachable or not.
-
virtual void
receive
(const MessagePackage &message)¶ Pass a message package to this interface, resolves proper session and makes it receive the package.
- Parameters
message – Message that was sent.
-
virtual void
registerRemoteInterface
(MessageTranslator *translator)¶ Registers this interface to given message translator.
- Parameters
translator – Translator to receive the interface definition.
Releases given session from this interface.
- Parameters
session – Session to release.
-
bool
serviceReachable
() const¶ Is service currently known to be reachable.
- Returns
true if service is reachable.
Stores the client this interface is bound to.
-
void
setServiceReachableCallback
(ServiceReachableCallback callback)¶ Registers service reachable callback.
- Parameters
callback – the callback to configure.
Set the given session to running state.
- Parameters
session – The session to set
Set the given session to stopped state.
- Parameters
session – The session to set
-
void
stopAllSessions
()¶ Ends all sessions since maybe the service itself has disappeared.
-
void
terminateAllSessions
()¶ Terminates all ongoing sessions.
-
typedef function<void(bool)>