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.
-
~AbstractInterfaceClient
()¶ Destructor.
-
AbstractSessionSharedPtr
acquireAbstractSession
(MessageDispatcher *dispatcher)¶ Acquires a session for this interface.
- Return
Session that was created.
- Parameters
dispatcher
: Message dispatcher that is used to deliver network messages.
-
string
getIdentifier
() const = 0¶ Returns the type id of the interface.
This is used to identify the service in the network.
- Return
Type of the interface, as a string.
-
shared_ptr<p2p::RoutingRules>
getRoutingRules
()¶ Retrieve routing rules for this particular client.
- Return
routing defintion.
-
AbstractSessionSharedPtr
getSession
(int sessionId)¶ Returns session by id.
- Return
Session that matches given id, or 0 if there was no such session.
- Parameters
sessionId
: Id of the session.
Check if the given session is running or not.
- Return
True if the session is running
- Parameters
session
: The session to check
-
void
notifyServiceReachable
(bool reachable)¶ Invoked to notify clients whether specific service is reachable or not.
-
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.
-
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.
- Return
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)>