client-cpp  0.10.0
kaa::KaaClient Class Reference

#include <KaaClient.hpp>

+ Inheritance diagram for kaa::KaaClient:
+ Collaboration diagram for kaa::KaaClient:

Public Member Functions

 KaaClient (IKaaClientPlatformContextPtr platformContext, KaaClientStateListenerPtr listener)
 
virtual void start ()
 Starts Kaa's workflow. More...
 
virtual void stop ()
 Stops Kaa's workflow. More...
 
virtual void pause ()
 Pauses Kaa's workflow. More...
 
virtual void resume ()
 Resumes Kaa's workflow. More...
 
virtual void updateProfile ()
 Notifies server about profile changes. More...
 
virtual IKaaChannelManagergetChannelManager ()
 Retrieves the Channel Manager. More...
 
virtual const KeyPairgetClientKeyPair ()
 Retrieves the client's public and private key. More...
 
virtual void setEndpointAccessToken (const std::string &token)
 Set new access token for a current endpoint. More...
 
virtual std::string refreshEndpointAccessToken ()
 Generate new access token for a current endpoint. More...
 
virtual std::string getEndpointAccessToken () const
 Retrieve an access token for a current endpoint. More...
 
virtual std::string getEndpointKeyHash () const
 
virtual IKaaDataMultiplexergetOperationMultiplexer ()
 Retrieves Kaa operations data multiplexer. More...
 
virtual IKaaDataDemultiplexergetOperationDemultiplexer ()
 Retrieves Kaa operations data demultiplexer. More...
 
virtual EventFamilyFactory & getEventFamilyFactory ()
 
virtual RecordFuture addLogRecord (const KaaUserLogRecord &record)
 Adds a new log record to the log storage. More...
 
virtual void setLogDeliveryListener (ILogDeliveryListenerPtr listener)
 Set a listener which receives a delivery status of each log bucket. More...
 
virtual void setLogStorage (ILogStoragePtr storage)
 Sets the new log storage. More...
 
virtual void setLogUploadStrategy (ILogUploadStrategyPtr strategy)
 Sets the new log upload strategy. More...
 
virtual void setFailoverStrategy (IFailoverStrategyPtr strategy)
 
virtual void setProfileContainer (IProfileContainerPtr container)
 Sets profile container implemented by the user. More...
 
virtual void addTopicListListener (INotificationTopicListListener &listener)
 Adds the listener which receives updates on the list of available topics. More...
 
virtual void removeTopicListListener (INotificationTopicListListener &listener)
 Removes listener which receives updates on the list of available topics. More...
 
virtual Topics getTopics ()
 Retrieves the list of available topics. More...
 
virtual void addNotificationListener (INotificationListener &listener)
 Adds the listener which receives notifications on all available topics. More...
 
virtual void addNotificationListener (std::int64_t topicId, INotificationListener &listener)
 Adds the listener which receives notifications on the specified topic. More...
 
virtual void removeNotificationListener (INotificationListener &listener)
 Removes the listener which receives notifications on all available topics. More...
 
virtual void removeNotificationListener (std::int64_t topicId, INotificationListener &listener)
 Removes the listener which receives notifications on the specified topic. More...
 
virtual void subscribeToTopic (std::int64_t id, bool forceSync)
 Subscribes to the specified optional topic to receive notifications on that topic. More...
 
virtual void subscribeToTopics (const std::list< std::int64_t > &idList, bool forceSync)
 Subscribes to the specified list of optional topics to receive notifications on those topics. More...
 
virtual void unsubscribeFromTopic (std::int64_t id, bool forceSync)
 Unsubscribes from the specified optional topic to stop receiving notifications on that topic. More...
 
virtual void unsubscribeFromTopics (const std::list< std::int64_t > &idList, bool forceSync)
 Unsubscribes from the specified list of optional topics to stop receiving notifications on those topics. More...
 
virtual void syncTopicSubscriptions ()
 Sends subscription request(s) to the Operations server. More...
 
virtual void addConfigurationListener (IConfigurationReceiver &receiver)
 
virtual void removeConfigurationListener (IConfigurationReceiver &receiver)
 
virtual const
KaaRootConfiguration & 
getConfiguration ()
 
virtual void setConfigurationStorage (IConfigurationStoragePtr storage)
 
virtual void attachEndpoint (const std::string &endpointAccessToken, IAttachEndpointCallbackPtr listener=IAttachEndpointCallbackPtr())
 Attaches the specified endpoint to the user to which the current endpoint is attached. More...
 
virtual void detachEndpoint (const std::string &endpointKeyHash, IDetachEndpointCallbackPtr listener=IDetachEndpointCallbackPtr())
 Detaches the specified endpoint from the user to which the current endpoint is attached. More...
 
virtual void attachUser (const std::string &userExternalId, const std::string &userAccessToken, IUserAttachCallbackPtr listener=IUserAttachCallbackPtr())
 Attaches the current endpoint to the specifier user. The user verification is carried out by the default verifier. More...
 
virtual void attachUser (const std::string &userExternalId, const std::string &userAccessToken, const std::string &userVerifierToken, IUserAttachCallbackPtr listener=IUserAttachCallbackPtr())
 
virtual void setAttachStatusListener (IAttachStatusListenerPtr listener)
 Sets listener to notify of the current endpoint is attached/detached by another one. More...
 
virtual bool isAttachedToUser ()
 Checks if the current endpoint is already attached to some user. More...
 
virtual std::int32_t findEventListeners (const std::list< std::string > &eventFQNs, IFetchEventListenersPtr listener)
 Submits an event listeners resolution request. More...
 
virtual IKaaDataMultiplexergetBootstrapMultiplexer ()
 Retrieves Kaa bootstrap data multiplexer. More...
 
virtual IKaaDataDemultiplexergetBootstrapDemultiplexer ()
 Retrieves Kaa bootstrap data demultiplexer. More...
 
virtual IKaaClientContextgetKaaClientContext ()
 Retrieves Kaa context data. More...
 
- Public Member Functions inherited from kaa::IKaaClient
virtual ~IKaaClient ()
 

Detailed Description

Definition at line 47 of file KaaClient.hpp.

Constructor & Destructor Documentation

kaa::KaaClient::KaaClient ( IKaaClientPlatformContextPtr  platformContext,
KaaClientStateListenerPtr  listener 
)

Member Function Documentation

virtual void kaa::KaaClient::addConfigurationListener ( IConfigurationReceiver receiver)
virtual

Subscribes listener of configuration updates.

Parameters
receiverListener to be added to notification list.

Implements kaa::IKaaClient.

virtual RecordFuture kaa::KaaClient::addLogRecord ( const KaaUserLogRecord &  record)
virtual

Adds a new log record to the log storage.

To store log records, MemoryLogStorage is used by default. Use setStorage() to set your own implementation.

Parameters
[in]recordThe log record to be added.
See Also
KaaUserLogRecord
ILogStorage

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::addNotificationListener ( INotificationListener listener)
virtual

Adds the listener which receives notifications on all available topics.

Parameters
[in]listenerThe listener which receives notifications.
See Also
INotificationListener

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::addNotificationListener ( std::int64_t  topicId,
INotificationListener listener 
)
virtual

Adds the listener which receives notifications on the specified topic.

Listener(s) for optional topics may be added/removed irrespective to whether subscription is already done or not.

Parameters
[in]topicIdThe id of the topic (either mandatory or optional).
[in]listenerThe listener which receives notifications.
Exceptions
UnavailableTopicExceptionThrows if the unknown topic id is provided.
See Also
INotificationListener

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::addTopicListListener ( INotificationTopicListListener listener)
virtual

Adds the listener which receives updates on the list of available topics.

Parameters
[in]listenerThe listener which receives updates.
See Also
INotificationTopicListListener

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::attachEndpoint ( const std::string &  endpointAccessToken,
IAttachEndpointCallbackPtr  listener = IAttachEndpointCallbackPtr() 
)
virtual

Attaches the specified endpoint to the user to which the current endpoint is attached.

Parameters
[in]endpointAccessTokenThe access token of the endpoint to be attached to the user.
[in]listenerThe optional listener to notify of the result.
Exceptions
BadCredentialsThe endpoint access token is empty.
TransportNotFoundExceptionThe Kaa SDK isn't fully initialized.
KaaExceptionSome other failure has happened.

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::attachUser ( const std::string &  userExternalId,
const std::string &  userAccessToken,
IUserAttachCallbackPtr  listener = IUserAttachCallbackPtr() 
)
virtual

Attaches the current endpoint to the specifier user. The user verification is carried out by the default verifier.

NOTE: If the default user verifier (DEFAULT_USER_VERIFIER_TOKEN) is not specified, the attach attempt fails with the KaaException exception.

Only endpoints associated with the same user can exchange events.

Parameters
[in]userExternalIdThe external user ID.
[in]userAccessTokenThe user access token.
Exceptions
BadCredentialsThe endpoint access token is empty.
TransportNotFoundExceptionThe Kaa SDK isn't fully initialized.
KaaExceptionSome other failure has happened.

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::attachUser ( const std::string &  userExternalId,
const std::string &  userAccessToken,
const std::string &  userVerifierToken,
IUserAttachCallbackPtr  listener = IUserAttachCallbackPtr() 
)
virtual

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::detachEndpoint ( const std::string &  endpointKeyHash,
IDetachEndpointCallbackPtr  listener = IDetachEndpointCallbackPtr() 
)
virtual

Detaches the specified endpoint from the user to which the current endpoint is attached.

Parameters
[in]endpointKeyHashThe key hash of the endpoint to be detached from the user.
[in]listenerThe optional listener to notify of the result.
Exceptions
BadCredentialsThe endpoint access token is empty.
TransportNotFoundExceptionThe Kaa SDK isn't fully initialized.
KaaExceptionSome other failure has happened.

Implements kaa::IKaaClient.

virtual std::int32_t kaa::KaaClient::findEventListeners ( const std::list< std::string > &  eventFQNs,
IFetchEventListenersPtr  listener 
)
virtual

Submits an event listeners resolution request.

Parameters
eventFQNsList of event class FQNs which have to be supported by endpoint.
listenerResult listener IFetchEventListeners}
Exceptions
KaaExceptionwhen data is invalid (empty list or null listener)
Returns
Request ID of submitted request

Implements kaa::IKaaClient.

virtual IKaaDataDemultiplexer& kaa::KaaClient::getBootstrapDemultiplexer ( )
virtual

Retrieves Kaa bootstrap data demultiplexer.

Returns
IKaaDataDemultiplexer object

Implements kaa::IKaaClient.

virtual IKaaDataMultiplexer& kaa::KaaClient::getBootstrapMultiplexer ( )
virtual

Retrieves Kaa bootstrap data multiplexer.

Returns
IKaaDataMultiplexer object

Implements kaa::IKaaClient.

virtual IKaaChannelManager& kaa::KaaClient::getChannelManager ( )
virtual

Retrieves the Channel Manager.

Implements kaa::IKaaClient.

virtual const KeyPair& kaa::KaaClient::getClientKeyPair ( )
virtual

Retrieves the client's public and private key.

Required in user implementation of an operation data channel. Public key hash (SHA-1) is used by servers as identification number to uniquely identify each connected endpoint.

Private key is used by encryption schema between endpoint and servers.

Returns
client's public/private key pair

Implements kaa::IKaaClient.

virtual const KaaRootConfiguration& kaa::KaaClient::getConfiguration ( )
virtual

Returns full configuration tree which is actual at current moment.

Returns
ICommonRecord containing current configuration tree.

Implements kaa::IKaaClient.

virtual std::string kaa::KaaClient::getEndpointAccessToken ( ) const
virtual

Retrieve an access token for a current endpoint.

Returns
The current access token.

Implements kaa::IKaaClient.

virtual std::string kaa::KaaClient::getEndpointKeyHash ( ) const
virtual

Retrieve Endpoint Key Hash.

Returns
Representation of Endpoint Key Hash in Base64 format.

Implements kaa::IKaaClient.

virtual EventFamilyFactory& kaa::KaaClient::getEventFamilyFactory ( )
virtual

Retrieves Kaa event family factory.

Returns
EventFamilyFactory object.

Implements kaa::IKaaClient.

virtual IKaaClientContext& kaa::KaaClient::getKaaClientContext ( )
virtual

Retrieves Kaa context data.

Returns
IKaaClientContext object

Implements kaa::IKaaClient.

virtual IKaaDataDemultiplexer& kaa::KaaClient::getOperationDemultiplexer ( )
virtual

Retrieves Kaa operations data demultiplexer.

Returns
IKaaDataDemultiplexer object

Implements kaa::IKaaClient.

virtual IKaaDataMultiplexer& kaa::KaaClient::getOperationMultiplexer ( )
virtual

Retrieves Kaa operations data multiplexer.

Returns
IKaaDataMultiplexer object

Implements kaa::IKaaClient.

virtual Topics kaa::KaaClient::getTopics ( )
virtual

Retrieves the list of available topics.

Returns
The list of available topics.

Implements kaa::IKaaClient.

virtual bool kaa::KaaClient::isAttachedToUser ( )
virtual

Checks if the current endpoint is already attached to some user.

Returns
TRUE if the current endpoint is attached, FALSE otherwise.

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::pause ( )
virtual

Pauses Kaa's workflow.

Implements kaa::IKaaClient.

virtual std::string kaa::KaaClient::refreshEndpointAccessToken ( )
virtual

Generate new access token for a current endpoint.

Returns
The new access token.

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::removeConfigurationListener ( IConfigurationReceiver receiver)
virtual

Unsubscribes listener of configuration updates.

Parameters
receiverListener to be removed from notification list.

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::removeNotificationListener ( INotificationListener listener)
virtual

Removes the listener which receives notifications on all available topics.

Parameters
[in]listenerThe listener which receives notifications.
See Also
INotificationListener

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::removeNotificationListener ( std::int64_t  topicId,
INotificationListener listener 
)
virtual

Removes the listener which receives notifications on the specified topic.

Listener(s) for optional topics may be added/removed irrespective to whether subscription is already done or not.

Parameters
[in]topicIdThe id of topic (either mandatory or optional).
[in]listenerThe listener which receives notifications.
Exceptions
UnavailableTopicExceptionThrows if the unknown topic id is provided.
See Also
INotificationListener

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::removeTopicListListener ( INotificationTopicListListener listener)
virtual

Removes listener which receives updates on the list of available topics.

Parameters
[in]listenerThe listener which receives updates.
See Also
INotificationTopicListListener

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::resume ( )
virtual

Resumes Kaa's workflow.

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::setAttachStatusListener ( IAttachStatusListenerPtr  listener)
virtual

Sets listener to notify of the current endpoint is attached/detached by another one.

Parameters
[in]listenerListener to notify of the attach status is changed.

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::setConfigurationStorage ( IConfigurationStoragePtr  storage)
virtual

Registers new configuration persistence routines. Replaces previously set value. Memory pointed by given parameter should be managed by user.

Parameters
storageUser-defined persistence routines.
See Also
IConfigurationStorage

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::setEndpointAccessToken ( const std::string &  token)
virtual

Set new access token for a current endpoint.

Parameters
[in]tokenThe new access token.

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::setFailoverStrategy ( IFailoverStrategyPtr  strategy)
virtual

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::setLogDeliveryListener ( ILogDeliveryListenerPtr  listener)
virtual

Set a listener which receives a delivery status of each log bucket.

Parameters
listener[in]the listener

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::setLogStorage ( ILogStoragePtr  storage)
virtual

Sets the new log storage.

MemoryLogStorage is used by default.

Parameters
[in]storageThe ILogStorage implementation.
Exceptions
KaaExceptionThe storage is NULL.

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::setLogUploadStrategy ( ILogUploadStrategyPtr  strategy)
virtual

Sets the new log upload strategy.

DefaultLogUploadStrategy is used by default.

Parameters
[in]strategyThe ILogUploadStrategy implementation.
Exceptions
KaaExceptionThe strategy is NULL.

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::setProfileContainer ( IProfileContainerPtr  container)
virtual

Sets profile container implemented by the user.

Parameters
containerUser-defined container
See Also
AbstractProfileContainer

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::start ( )
virtual

Starts Kaa's workflow.

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::stop ( )
virtual

Stops Kaa's workflow.

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::subscribeToTopic ( std::int64_t  id,
bool  forceSync 
)
virtual

Subscribes to the specified optional topic to receive notifications on that topic.

Parameters
[in]topicIdThe id of the optional topic.
[in]forceSyncIndicates whether the subscription request should be sent immediately to the Operations server. If false , the request postpones to the explicit call of syncTopicSubscriptions() or to the first call of subscribeToTopic(), subscribeToTopics(), unsubscribeFromTopic() or unsubscribeFromTopics() with the true value for the forceSync parameter.
Exceptions
UnavailableTopicExceptionThrows if the unknown topic id is provided or the topic isn't optional.
See Also
syncTopicSubscriptions()

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::subscribeToTopics ( const std::list< std::int64_t > &  idList,
bool  forceSync 
)
virtual

Subscribes to the specified list of optional topics to receive notifications on those topics.

Parameters
[in]topicIdsThe list of optional topic id-s.
[in]forceSyncIndicates whether the subscription request should be sent immediately to the Operations server. If false , the request postpones to the explicit call of syncTopicSubscriptions() or to the first call of subscribeToTopic(), subscribeToTopics(), unsubscribeFromTopic() or unsubscribeFromTopics() with the true value for the forceSync parameter.
Exceptions
UnavailableTopicExceptionThrows if the unknown topic id is provided or the topic isn't optional.
See Also
syncTopicSubscriptions()

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::syncTopicSubscriptions ( )
virtual

Sends subscription request(s) to the Operations server.

Use as a convenient way to send several subscription requests at once.

IKaaClient& kaaClient = Kaa::getKaaClient();
// Add listener(s) to receive notifications on topic(s)
kaaClient.subscribeToTopics({"optional_topic1_id", "optional_topic2_id"}, false);
kaaClient.unsubscribeFromTopic("optional_topic3_id", false);
kaaClient.syncTopicSubscriptions();

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::unsubscribeFromTopic ( std::int64_t  id,
bool  forceSync 
)
virtual

Unsubscribes from the specified optional topic to stop receiving notifications on that topic.

Parameters
[in]topicIdThe id of the optional topic.
[in]forceSyncIndicates whether the subscription request should be sent immediately to the Operations server. If false , the request postpones to the explicit call of syncTopicSubscriptions() or to the first call of subscribeToTopic(), subscribeToTopics(), unsubscribeFromTopic() or unsubscribeFromTopics() with the true value for the forceSync parameter.
Exceptions
UnavailableTopicExceptionThrows if the unknown topic id is provided or the topic isn't optional.
See Also
syncTopicSubscriptions()

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::unsubscribeFromTopics ( const std::list< std::int64_t > &  idList,
bool  forceSync 
)
virtual

Unsubscribes from the specified list of optional topics to stop receiving notifications on those topics.

Parameters
[in]topicIdThe list of optional topic id-s.
[in]forceSyncIndicates whether the subscription request should be sent immediately to the Operations server. If false , the request postpones to the explicit call of syncTopicSubscriptions() or to the first call of subscribeToTopic(), subscribeToTopics(), unsubscribeFromTopic() or unsubscribeFromTopics() with the true value for the forceSync parameter.
Exceptions
UnavailableTopicExceptionThrows if the unknown topic id is provided or the topic isn't optional.
See Also
syncTopicSubscriptions()

Implements kaa::IKaaClient.

virtual void kaa::KaaClient::updateProfile ( )
virtual

Notifies server about profile changes.

Implements kaa::IKaaClient.


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