RemoteContentClient¶
-
class
kanzi::connect
::
RemoteContentClient
: public ContentClient¶ A content client variant that provides remote access to the content manager over network.
This class can be used in Kanzi Connect client to operate with the Content Service. The guidelines for the usage:
If Content Service is running on different device, process or thread, then use RemoteContentClient class to access it.
This class operates over network, so the access is asynchronous and there is a slight extra overhead involved. In server-side single-thread development, consider using LocalContentClient class instead.
Unnamed Group
-
virtual ContentToken acquireContentToken () KZ_OVERRIDE
- See
ContentClient
-
virtual void releaseContentToken (ContentToken token) KZ_OVERRIDE
Release content token and unregister from content service.
- Parameters
token – the content token to release.
-
virtual bool subscribe (ContentToken token, ContentQueryArgumentsSharedPtr args, ResultCallbackFunction callback, ContentInvalidationFunction invalidationCallback) KZ_OVERRIDE
Subscribe to a table based content.
- Parameters
token – Content token, identifies the user of content API, needs to be acquired first. When subscribing to table based content (content:// or service://) new token must be allocated for each content domain (E.g. com.rightware.content).
args – Query Arguments.
callback – Function callback for results.
invalidationCallback – function to invoke when content provider informs that certain part of the content has been invalidated.
- Returns
true if subscription started, false if problems were met. Possible reasons for failure include for example trying to subscribe to same domain twice using same content token.
-
virtual bool subscribeRuntimeData (ContentToken token, const string uri, RuntimeDataResultCallbackFunction callback, int credits, int creditreturninterval) KZ_OVERRIDE
Subscribes to a service runtime data.
- Parameters
token – Content token, identifies the user of content API.
uri – The content URI where to subscribe. Usually something like service://cluster.
callback – Function callback for results.
credits – amount of transter credits that define the maximum amount of queued items (including both service and client ends) of this type.
creditreturninterval – how often functionality will return transfer credits to the content producer. Smaller the value more housekeeping traffic is produced.
- Returns
true if subscription started, false if there were no session available.
-
virtual bool subscribeEx (ContentToken token, ContentQueryArgumentsSharedPtr args, ContentClientObserver *observer) KZ_OVERRIDE
Subscribe to content.
- Parameters
token – content content, identifies the user of content API.
args – Query Arguments.
- Returns
true if subscription started, false if there were no session available.
-
virtual bool subscribeRuntimeDataEx (ContentToken token, const string uri, ContentClientRuntimeDataObserver *observer, int credits, int creditreturninterval) KZ_OVERRIDE
Subscribe to service runtime data.
- Parameters
token – Content token, identifies the user of content API, needs to be acquired first.
observer – Observer interface to be invoked when subscribed runtime data changes.
credits – amount of transter credits that define the maximum amount of queued items (including both service and client ends) of this type.
creditreturninterval – how often functionality will return transfer credits to the content producer. Smaller the value more housekeeping traffic is produced.
- Returns
true if subscription started, false if there were no session available or subscription for the specific uri is already available.
-
virtual void unsubscribe (ContentToken token, const string &uri) KZ_OVERRIDE
Unsubscribe from content URI.
- Parameters
token – Content token.
uri – Content URI to unsubscribe. Must be previously subscribed.
-
virtual void unsubscribeRuntimeData (ContentToken token, const string &uri) KZ_OVERRIDE
Unsubscribe from runtime data.
- Parameters
token – Content token to unsubscribe.
uri – Service URI where to unsubscribe from.
-
virtual bool addContentProvider (ContentToken token, const string &uri, ContentProviderSharedPtr contentProvider) KZ_OVERRIDE
Adds content provider to content system.
- Parameters
token – Content token, identifies the user of content API, needs to be acquired first.
uri – Content URI that is handled by the content provider.
contentProvider – Content provider to add.
- Returns
true if succeeded, false on error.
-
virtual void removeContentProvider (ContentToken token, ContentProviderSharedPtr contentProvider) KZ_OVERRIDE
Removes content provider from content system.
- Parameters
token – Content token, identifies the user of content API, needs to be acquired first.
contentProvider – Content provider to remove.
-
virtual bool hasSession (ContentToken token) KZ_OVERRIDE
Determine whether specific content token has session currently available.
- Parameters
token – content token
- Returns
true if session exists
-
virtual void setVerboseLog (bool verbose) KZ_OVERRIDE
Configures verbose logging for the content client.
- Parameters
verbose – whether to be verbose or not.
-
virtual bool getVerboseLog () const KZ_OVERRIDE
Return the current state of log verbosity.
- Returns
log verbosity.
Public Functions
-
virtual
~RemoteContentClient
()¶ Destructor.
-
ContentInterfaceClient *
getInterface
()¶ Returns the underlying content interface.
-
virtual void work () KZ_OVERRIDE
Perform work that is pending. Called on main thread.
Public Static Functions
Creates a new instance of RemoteContentClient class.
- Parameters
client – Client class that provides access to Kanzi Connect network.
- Returns
Shared pointer to new RemoteContentClient instance.