client-cpp  0.0.1-SNAPSHOT
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 
23 #include "kaa/gen/EndpointGen.hpp"
24 
25 #include <boost/thread/mutex.hpp>
26 
27 namespace kaa {
28 
29 class EventManager;
30 
31 class EventTransport : public AbstractKaaTransport<TransportType::EVENT>, public IEventTransport {
32 public:
33  EventTransport(EventManager& eventManager, IKaaChannelManager& channelManager);
34 
35  boost::shared_ptr<EventSyncRequest> createEventRequest(boost::int32_t requestId);
36  void onEventResponse(const EventSyncResponse& response);
37  void onSyncResponseId(boost::int32_t requestId);
38 
39  void sync();
40 private:
41 
42  typedef boost::mutex mutex_type;
43  typedef boost::unique_lock<mutex_type> lock_type;
44 
45  mutex_type eventsGuard_;
46 
47  EventManager & eventManager_;
48  std::map<boost::uint32_t, std::list<Event> > events_;
49 };
50 
51 } // namespace kaa
52 
53 
54 #endif /* EVENTTRANSPORT_HPP_ */
void onSyncResponseId(boost::int32_t requestId)
EventTransport(EventManager &eventManager, IKaaChannelManager &channelManager)
boost::shared_ptr< EventSyncRequest > createEventRequest(boost::int32_t requestId)
void onEventResponse(const EventSyncResponse &response)