17 #ifndef DEFAULTNOTIFICATONMANAGER_HPP_
18 #define DEFAULTNOTIFICATONMANAGER_HPP_
26 #include <unordered_map>
27 #include <unordered_set>
29 #include "kaa/gen/EndpointGen.hpp"
42 class IExecutorContext;
58 virtual void subscribeToTopics(
const std::list<std::int64_t>& idList,
bool forceSync =
true);
66 void setTransport(std::shared_ptr<NotificationTransport> transport);
69 typedef std::shared_ptr<KaaNotification> KaaNotificationPtr;
72 void updateSubscriptionInfo(std::int64_t
id, SubscriptionCommandType type);
75 const Topic& findTopic(std::int64_t
id);
77 void notifyTopicUpdateSubscribers(
const Topics& topics);
78 void notifyMandatoryNotificationSubscribers(std::int64_t
id, KaaNotificationPtr notification);
79 bool notifyOptionalNotificationSubscribers(std::int64_t
id, KaaNotificationPtr notification);
84 std::shared_ptr<NotificationTransport> transport_;
87 std::unordered_map<std::int64_t, Topic> topics_;
88 KAA_MUTEX_DECLARE(topicsGuard_);
90 typedef KaaObservable<void(std::int64_t topicId,
const KaaNotification& notification)
92 typedef std::shared_ptr<NotificationObservable> NotificationObservablePtr;
96 std::unordered_map<std::int64_t, NotificationObservablePtr> optionalListeners_;
97 KAA_MUTEX_DECLARE(optionalListenersGuard_);
100 KAA_MUTEX_DECLARE(subscriptionsGuard_);
The listener which receives updates on available topics.
virtual void sync()
Sends subscription request(s) to the Operations server.
virtual void addNotificationListener(INotificationListener &listener)
Adds the listener which receives notifications on all available topics.
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 topi...
The public interface to topic subscription and notification delivery subsystems.
virtual void notificationReceived(const Notifications ¬ifications)
virtual Topics getTopics()
Retrieves the list of available topics.
NotificationManager(IKaaClientContext &context)
void setTransport(std::shared_ptr< NotificationTransport > transport)
virtual void subscribeToTopic(std::int64_t id, bool forceSync=true)
Subscribes to the specified optional topic to receive notifications on that topic.
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...
virtual void unsubscribeFromTopic(std::int64_t id, bool forceSync=true)
Unsubscribes from the specified optional topic to stop receiving notifications on that topic...
virtual void topicsListUpdated(const Topics &topics)
virtual void addTopicListListener(INotificationTopicListListener &listener)
Adds the listener which receives updates on the list of available topics.
The listener which receives notifications on the specified topic.
std::shared_ptr< IKaaClientStateStorage > IKaaClientStateStoragePtr
virtual void removeNotificationListener(INotificationListener &listener)
Removes the listener which receives notifications on all available topics.
std::list< SubscriptionCommand > SubscriptionCommands
virtual void removeTopicListListener(INotificationTopicListListener &listener)
Removes listener which receives updates on the list of available topics.