client-cpp  0.10.0
NotificationTransport.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014-2016 CyberVision, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef DEFAULTNOTIFICATIONTRANSPORT_HPP_
18 #define DEFAULTNOTIFICATIONTRANSPORT_HPP_
19 
20 #include <map>
21 #include <set>
22 #include <string>
23 
30 
31 namespace kaa {
32 
33 class IKaaChannelManager;
34 
35 class NotificationTransport: public AbstractKaaTransport<TransportType::NOTIFICATION>,
37 {
38 public:
40 
42 
44 
45  virtual void onNotificationResponse(const NotificationSyncResponse& response);
46 
47  virtual void onSubscriptionChanged(SubscriptionCommands&& commands);
48 
50  if (processor) {
51  notificationProcessor_ = processor;
52  }
53  }
54 
55  virtual void sync() {
57  }
58 
59 private:
60  Notifications getUnicastNotifications(const Notifications & notifications);
61  Notifications getMulticastNotifications(const Notifications & notifications);
62  std::vector<TopicState> prepareTopicStatesForRequest();
63 
64 private:
65  INotificationProcessor* notificationProcessor_;
66 
67  std::set<std::string> acceptedUnicastNotificationIds_;
68  SubscriptionCommands subscriptions_;
69 };
70 
71 } /* namespace kaa */
72 
73 #endif /* DEFAULTNOTIFICATIONTRANSPORT_HPP_ */
NotificationTransport(IKaaChannelManager &manager, IKaaClientContext &context)
virtual void setNotificationProcessor(INotificationProcessor *processor)
virtual NotificationSyncRequestPtr createEmptyNotificationRequest()
std::list< SubscriptionCommand > SubscriptionCommands
virtual NotificationSyncRequestPtr createNotificationRequest()
std::shared_ptr< NotificationSyncRequest > NotificationSyncRequestPtr
virtual void onSubscriptionChanged(SubscriptionCommands &&commands)
virtual void onNotificationResponse(const NotificationSyncResponse &response)