client-cpp  0.10.0
kaa::NotificationManager Class Reference

#include <NotificationManager.hpp>

+ Inheritance diagram for kaa::NotificationManager:
+ Collaboration diagram for kaa::NotificationManager:

Public Member Functions

 NotificationManager (IKaaClientContext &context)
 
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 topidId, 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 topidId, INotificationListener &listener)
 Removes the listener which receives notifications on the specified topic. More...
 
virtual void subscribeToTopic (std::int64_t id, bool forceSync=true)
 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=true)
 Subscribes to the specified list of optional topics to receive notifications on those topics. More...
 
virtual void unsubscribeFromTopic (std::int64_t id, bool forceSync=true)
 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=true)
 Unsubscribes from the specified list of optional topics to stop receiving notifications on those topics. More...
 
virtual void sync ()
 Sends subscription request(s) to the Operations server. More...
 
virtual void topicsListUpdated (const Topics &topics)
 
virtual void notificationReceived (const Notifications &notifications)
 
void setTransport (std::shared_ptr< NotificationTransport > transport)
 
- Public Member Functions inherited from kaa::INotificationManager
virtual ~INotificationManager ()
 
- Public Member Functions inherited from kaa::INotificationProcessor
virtual ~INotificationProcessor ()
 

Detailed Description

Definition at line 44 of file NotificationManager.hpp.

Constructor & Destructor Documentation

kaa::NotificationManager::NotificationManager ( IKaaClientContext context)

Member Function Documentation

virtual void kaa::NotificationManager::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::INotificationManager.

virtual void kaa::NotificationManager::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::INotificationManager.

virtual void kaa::NotificationManager::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::INotificationManager.

virtual Topics kaa::NotificationManager::getTopics ( )
virtual

Retrieves the list of available topics.

Returns
The list of available topics.

Implements kaa::INotificationManager.

virtual void kaa::NotificationManager::notificationReceived ( const Notifications &  notifications)
virtual

Will be called when new topic list are received

Parameters
notificationscomprises of new notifications

Implements kaa::INotificationProcessor.

virtual void kaa::NotificationManager::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::INotificationManager.

virtual void kaa::NotificationManager::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::INotificationManager.

virtual void kaa::NotificationManager::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::INotificationManager.

void kaa::NotificationManager::setTransport ( std::shared_ptr< NotificationTransport transport)
virtual void kaa::NotificationManager::subscribeToTopic ( std::int64_t  id,
bool  forceSync = true 
)
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 sync() 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
sync()

Implements kaa::INotificationManager.

virtual void kaa::NotificationManager::subscribeToTopics ( const std::list< std::int64_t > &  idList,
bool  forceSync = true 
)
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 sync() 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
sync()

Implements kaa::INotificationManager.

virtual void kaa::NotificationManager::sync ( )
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::INotificationManager.

virtual void kaa::NotificationManager::topicsListUpdated ( const Topics &  topics)
virtual

Will be called when new topic list are received

Parameters
topicscomprises of new topics

Implements kaa::INotificationProcessor.

virtual void kaa::NotificationManager::unsubscribeFromTopic ( std::int64_t  id,
bool  forceSync = true 
)
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 or postponed. If false , the request is postponed either to the explicit call of sync() or to the first call of one of the following functions with the forceSync parameter set to true : subscribeToTopic(), subscribeToTopics(), unsubscribeFromTopic() or unsubscribeFromTopics() .
Exceptions
UnavailableTopicExceptionThrows if the unknown topic id is provided or the topic isn't optional.
See Also
sync()

Implements kaa::INotificationManager.

virtual void kaa::NotificationManager::unsubscribeFromTopics ( const std::list< std::int64_t > &  idList,
bool  forceSync = true 
)
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 or postponed. If false , the request is postponed either to the explicit call of sync() or to the first call of one of the following functions with the forceSync parameter set to true : subscribeToTopic(), subscribeToTopics(), unsubscribeFromTopic() or unsubscribeFromTopics() .
Exceptions
UnavailableTopicExceptionThrows if the unknown topic id is provided or the topic isn't optional.
See Also
sync()

Implements kaa::INotificationManager.


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