client-cpp  0.6.1
EventTransport.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014 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 #ifdef KAA_USE_EVENTS
21 
22 #include "kaa/KaaDefaults.hpp"
23 #include "kaa/KaaThread.hpp"
24 #include "kaa/gen/EndpointGen.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, IKaaClientStateStoragePtr state);
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 isEventSNSynchronized_;;
52 };
53 
54 } // namespace kaa
55 
56 #endif
57 
58 #endif /* EVENTTRANSPORT_HPP_ */
#define KAA_MUTEX_DECLARE(name)
Definition: KaaThread.hpp:71
std::shared_ptr< IKaaClientStateStorage > IKaaClientStateStoragePtr