client-cpp  0.10.0
EventTransport.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 EVENTTRANSPORT_HPP_
18 #define EVENTTRANSPORT_HPP_
19 
20 #include "kaa/KaaDefaults.hpp"
21 #include "kaa/KaaThread.hpp"
22 #include "kaa/gen/EndpointGen.hpp"
25 #include "kaa/KaaThread.hpp"
27 
28 namespace kaa {
29 
30 class IEventDataProcessor;
31 class IKaaChannelManager;
32 
33 class EventTransport : public AbstractKaaTransport<TransportType::EVENT>, public IEventTransport {
34 public:
35  EventTransport(IEventDataProcessor& eventManager, IKaaChannelManager& channelManager, IKaaClientContext &context);
36 
37  std::shared_ptr<EventSyncRequest> createEventRequest(std::int32_t requestId);
38 
39  void onEventResponse(const EventSyncResponse& response);
40  void onSyncResponseId(std::int32_t requestId);
41 
42  void sync();
43 
44 private:
45  KAA_MUTEX_DECLARE(eventsGuard_);
46 
47  IEventDataProcessor& eventDataProcessor_;
48  std::map<std::uint32_t, std::list<Event> > events_;
49 
50  std::int32_t startEventSN_;
51  bool_type isEventSNSynchronized_;
52 
53 };
54 
55 } // namespace kaa
56 
57 #endif /* EVENTTRANSPORT_HPP_ */
std::atomic_bool bool_type
Definition: KaaThread.hpp:54
std::shared_ptr< EventSyncRequest > createEventRequest(std::int32_t requestId)
EventTransport(IEventDataProcessor &eventManager, IKaaChannelManager &channelManager, IKaaClientContext &context)
void onSyncResponseId(std::int32_t requestId)
void onEventResponse(const EventSyncResponse &response)