Kanzi Connect 3.9.10
kanzi::connect::RemoteContentClient Class Reference

A content client variant that provides remote access to the content manager over network. More...

#include <content_client_remote.hpp>

Inheritance diagram for kanzi::connect::RemoteContentClient:
kanzi::connect::ContentClient kanzi::connect::AbstractServiceClient

Public Member Functions

ContentInterfaceClient * getInterface ()
 Returns the underlying content interface.
 
virtual void work () override
 Perform work that is pending. Called on main thread.
 
virtual ~RemoteContentClient ()
 Destructor.
 
virtual ContentToken acquireContentToken () override
 
virtual void releaseContentToken (ContentToken token) override
 Release content token and unregister from content service.
 
virtual bool subscribe (ContentToken token, ContentQueryArgumentsSharedPtr args, ResultCallbackFunction callback, ContentInvalidationFunction invalidationCallback) override
 Subscribe to a table based content.
 
virtual bool subscribeRuntimeData (ContentToken token, const string uri, RuntimeDataResultCallbackFunction callback, int credits, int creditreturninterval) override
 Subscribes to a service runtime data.
 
virtual bool subscribeEx (ContentToken token, ContentQueryArgumentsSharedPtr args, ContentClientObserver *observer) override
 Subscribe to content.
 
virtual bool subscribeRuntimeDataEx (ContentToken token, const string uri, ContentClientRuntimeDataObserver *observer, int credits, int creditreturninterval) override
 Subscribe to service runtime data.
 
virtual void unsubscribe (ContentToken token, const string &uri) override
 Unsubscribe from content URI.
 
virtual void unsubscribeRuntimeData (ContentToken token, const string &uri) override
 Unsubscribe from runtime data.
 
virtual bool addContentProvider (ContentToken token, const string &uri, ContentProviderSharedPtr contentProvider) override
 Adds content provider to content system.
 
virtual void removeContentProvider (ContentToken token, ContentProviderSharedPtr contentProvider) override
 Removes content provider from content system.
 
virtual bool hasSession (ContentToken token) override
 Determine whether specific content token has session currently available.
 
virtual void setVerboseLog (bool verbose) override
 Configures verbose logging for the content client.
 
virtual bool getVerboseLog () const override
 Return the current state of log verbosity.
 
- Public Member Functions inherited from kanzi::connect::ContentClient
virtual string getIdentifier () const
 Returns the type of the service.
 
virtual ~ContentClient ()
 Destructor.
 
- Public Member Functions inherited from kanzi::connect::AbstractServiceClient
 AbstractServiceClient ()
 Constructor.
 
AbstractSession::MessageSubscriptionToken addMessageSubscription (const string &messageType, AbstractSession::MessageReceivedFunction function)
 
SessionRunningSubscriptionToken addSessionRunningSubscription (SessionRunningFunction function)
 
SessionRunningSubscriptionToken addSessionStoppedSubscription (SessionStoppedFunction function)
 
optional< int > getActiveSessionIdentifier ()
 
optional< const AbstractSession::ServiceAttributesgetServiceAttributes ()
 
virtual void onSessionRunning ()
 
virtual void onSessionStopped ()
 
void removeMessageSubscription (const string &messageType, AbstractSession::MessageSubscriptionToken token)
 
void removeSessionRunningSubscription (SessionRunningSubscriptionToken token)
 
void removeSessionStoppedSubscription (SessionRunningSubscriptionToken token)
 
void setEnabledState (bool newEnabledState)
 Enable/disable the service by allowing or blocking traffic between client and server.
 
bool transmit (const MessagePackage &message)
 
virtual ~AbstractServiceClient ()
 Destructor.
 

Static Public Member Functions

static RemoteContentClientSharedPtr create (ClientSharedPtr client)
 Creates a new instance of RemoteContentClient class.
 
- Static Public Member Functions inherited from kanzi::connect::ContentClient
static string Type ()
 Type accessors.
 

Protected Member Functions

virtual void onConnectionStateChanged (Connection::State state)
 Callback to get notification when the state of the network changes.
 
 RemoteContentClient (ClientSharedPtr client)
 Constructor.
 
- Protected Member Functions inherited from kanzi::connect::ContentClient
 ContentClient ()
 Constructor.
 
- Protected Member Functions inherited from kanzi::connect::AbstractServiceClient
virtual AbstractSessionSharedPtr getSession ()
 

Additional Inherited Members

- Public Types inherited from kanzi::connect::ContentClient
typedef function< void(const string &uri, int reason, int startRow, int endRow) ContentInvalidationFunction)
 Callback function for content invalidation.
 
typedef shared_ptr< void > ContentToken
 A token that identifies the content session / consumer.
 
typedef function< void(const string &uri, ContentDataSharedPtr data) ResultCallbackFunction)
 Callback function for content result.
 
typedef function< void(const string &uri, RuntimeDataObjectSharedPtr data) RuntimeDataResultCallbackFunction)
 callback function for runtimedata content result.
 
- Public Types inherited from kanzi::connect::AbstractServiceClient
typedef function< void(void)> SessionRunningFunction
 
typedef shared_ptr< void > SessionRunningSubscriptionToken
 
typedef function< void(void)> SessionStoppedFunction
 
- Protected Types inherited from kanzi::connect::AbstractServiceClient
enum  SessionState { INITIALIZED = 0 , RUNNING = 1 , STOPPED = 2 }
 
- Protected Attributes inherited from kanzi::connect::AbstractServiceClient
SessionState m_sessionState
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ~RemoteContentClient()

virtual kanzi::connect::RemoteContentClient::~RemoteContentClient ( )
virtual

Destructor.

◆ RemoteContentClient()

kanzi::connect::RemoteContentClient::RemoteContentClient ( ClientSharedPtr client)
protected

Constructor.

Member Function Documentation

◆ acquireContentToken()

virtual ContentToken kanzi::connect::RemoteContentClient::acquireContentToken ( )
overridevirtual

◆ addContentProvider()

virtual bool kanzi::connect::RemoteContentClient::addContentProvider ( ContentToken token,
const string & uri,
ContentProviderSharedPtr contentProvider )
overridevirtual

Adds content provider to content system.

Parameters
tokenContent token, identifies the user of content API, needs to be acquired first.
uriContent URI that is handled by the content provider.
contentProviderContent provider to add.
Returns
true if succeeded, false on error.

Implements kanzi::connect::ContentClient.

◆ create()

static RemoteContentClientSharedPtr kanzi::connect::RemoteContentClient::create ( ClientSharedPtr client)
static

Creates a new instance of RemoteContentClient class.

Parameters
clientClient class that provides access to Kanzi Connect network.
Returns
Shared pointer to new RemoteContentClient instance.

◆ getInterface()

ContentInterfaceClient * kanzi::connect::RemoteContentClient::getInterface ( )

Returns the underlying content interface.

◆ getVerboseLog()

virtual bool kanzi::connect::RemoteContentClient::getVerboseLog ( ) const
overridevirtual

Return the current state of log verbosity.

Returns
log verbosity.

Implements kanzi::connect::ContentClient.

◆ hasSession()

virtual bool kanzi::connect::RemoteContentClient::hasSession ( ContentToken token)
overridevirtual

Determine whether specific content token has session currently available.

Parameters
tokencontent token
Returns
true if session exists

Implements kanzi::connect::ContentClient.

◆ onConnectionStateChanged()

virtual void kanzi::connect::RemoteContentClient::onConnectionStateChanged ( Connection::State state)
protectedvirtual

Callback to get notification when the state of the network changes.

◆ releaseContentToken()

virtual void kanzi::connect::RemoteContentClient::releaseContentToken ( ContentToken token)
overridevirtual

Release content token and unregister from content service.

Parameters
tokenthe content token to release.

Implements kanzi::connect::ContentClient.

◆ removeContentProvider()

virtual void kanzi::connect::RemoteContentClient::removeContentProvider ( ContentToken token,
ContentProviderSharedPtr contentProvider )
overridevirtual

Removes content provider from content system.

Parameters
tokenContent token, identifies the user of content API, needs to be acquired first.
contentProviderContent provider to remove.

Implements kanzi::connect::ContentClient.

◆ setVerboseLog()

virtual void kanzi::connect::RemoteContentClient::setVerboseLog ( bool verbose)
overridevirtual

Configures verbose logging for the content client.

Parameters
verbosewhether to be verbose or not.

Implements kanzi::connect::ContentClient.

◆ subscribe()

virtual bool kanzi::connect::RemoteContentClient::subscribe ( ContentToken token,
ContentQueryArgumentsSharedPtr args,
ResultCallbackFunction callback,
ContentInvalidationFunction invalidationCallback )
overridevirtual

Subscribe to a table based content.

Parameters
tokenContent 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).
argsQuery Arguments.
callbackFunction callback for results.
invalidationCallbackfunction 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.

Implements kanzi::connect::ContentClient.

◆ subscribeEx()

virtual bool kanzi::connect::RemoteContentClient::subscribeEx ( ContentToken token,
ContentQueryArgumentsSharedPtr args,
ContentClientObserver * observer )
overridevirtual

Subscribe to content.

Parameters
tokencontent content, identifies the user of content API.
argsQuery Arguments.
Returns
true if subscription started, false if there were no session available.

Implements kanzi::connect::ContentClient.

◆ subscribeRuntimeData()

virtual bool kanzi::connect::RemoteContentClient::subscribeRuntimeData ( ContentToken token,
const string uri,
RuntimeDataResultCallbackFunction callback,
int credits,
int creditreturninterval )
overridevirtual

Subscribes to a service runtime data.

Parameters
tokenContent token, identifies the user of content API.
uriThe content URI where to subscribe. Usually something like service://cluster.
callbackFunction callback for results.
creditsamount of transter credits that define the maximum amount of queued items (including both service and client ends) of this type.
creditreturnintervalhow 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.

Implements kanzi::connect::ContentClient.

◆ subscribeRuntimeDataEx()

virtual bool kanzi::connect::RemoteContentClient::subscribeRuntimeDataEx ( ContentToken token,
const string uri,
ContentClientRuntimeDataObserver * observer,
int credits,
int creditreturninterval )
overridevirtual

Subscribe to service runtime data.

Parameters
tokenContent token, identifies the user of content API, needs to be acquired first.
observerObserver interface to be invoked when subscribed runtime data changes.
creditsamount of transter credits that define the maximum amount of queued items (including both service and client ends) of this type.
creditreturnintervalhow 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.

Implements kanzi::connect::ContentClient.

◆ unsubscribe()

virtual void kanzi::connect::RemoteContentClient::unsubscribe ( ContentToken token,
const string & uri )
overridevirtual

Unsubscribe from content URI.

Parameters
tokenContent token.
uriContent URI to unsubscribe. Must be previously subscribed.

Implements kanzi::connect::ContentClient.

◆ unsubscribeRuntimeData()

virtual void kanzi::connect::RemoteContentClient::unsubscribeRuntimeData ( ContentToken token,
const string & URI )
overridevirtual

Unsubscribe from runtime data.

Parameters
tokenContent token to unsubscribe.
uriService URI where to unsubscribe from.

Implements kanzi::connect::ContentClient.

◆ work()

virtual void kanzi::connect::RemoteContentClient::work ( )
overridevirtual

Perform work that is pending. Called on main thread.

Reimplemented from kanzi::connect::ContentClient.


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