17 #ifndef DEFAULTNOTIFICATONMANAGER_HPP_
18 #define DEFAULTNOTIFICATONMANAGER_HPP_
22 #ifdef KAA_USE_NOTIFICATIONS
28 #include <unordered_map>
29 #include <unordered_set>
31 #include "kaa/gen/EndpointGen.hpp"
43 class NotificationManager :
public INotificationManager,
public INotificationProcessor {
47 virtual void topicsListUpdated(
const Topics& topics);
49 virtual void notificationReceived(
const Notifications& notifications);
51 virtual void addTopicListListener(INotificationTopicListListenerPtr listener);
53 virtual void removeTopicListListener(INotificationTopicListListenerPtr listener);
55 virtual Topics getTopics();
57 virtual void addNotificationListener(INotificationListenerPtr listener);
59 virtual void addNotificationListener(
const std::string& topidId, INotificationListenerPtr listener);
61 virtual void removeNotificationListener(INotificationListenerPtr listener);
63 virtual void removeNotificationListener(
const std::string& topidId, INotificationListenerPtr listener);
65 virtual void subscribeToTopic(
const std::string&
id,
bool forceSync);
67 virtual void subscribeToTopics(
const std::list<std::string>& idList,
bool forceSync);
69 virtual void unsubscribeFromTopic(
const std::string&
id,
bool forceSync);
71 virtual void unsubscribeFromTopics(
const std::list<std::string>& idList,
bool forceSync);
78 virtual void setTransport(std::shared_ptr<NotificationTransport> transport);
80 void updateSubscriptionInfo(
const std::string&
id, SubscriptionCommandType type);
83 const Topic& findTopic(
const std::string&
id);
85 void notifyTopicUpdateSubscribers(
const Topics& topics);
86 void notifyMandatoryNotificationSubscribers(
const Notification& notification);
87 bool notifyOptionalNotificationSubscribers(
const Notification& notification);
90 std::shared_ptr<NotificationTransport> transport_;
93 std::unordered_map<std::string, Topic> topics_;
98 typedef KaaObservable<
99 void(
const std::string& topicId,
100 const std::vector<std::uint8_t>& notification),
101 INotificationListenerPtr> NotificationObservable;
103 typedef std::shared_ptr<NotificationObservable> NotificationObservablePtr;
105 KaaObservable<void (const Topics& list), INotificationTopicListListenerPtr> topicListeners_;
106 NotificationObservable mandatoryListeners_;
107 std::unordered_map<std::string, NotificationObservablePtr> optionalListeners_;
#define KAA_MUTEX_DECLARE(name)
std::shared_ptr< IKaaClientStateStorage > IKaaClientStateStoragePtr
std::list< SubscriptionCommand > SubscriptionCommands