client-cpp  0.6.1
ProfileTransport.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 DEFAULTPROFILETRANSPORT_HPP_
18 #define DEFAULTPROFILETRANSPORT_HPP_
19 
20 #include <vector>
21 
22 #include <cstdint>
23 
24 #include <botan/botan.h>
25 
28 
29 namespace kaa {
30 
31 class IKaaChannelManager;
32 
33 class ProfileTransport: public AbstractKaaTransport<TransportType::PROFILE>,
34  public IProfileTransport
35 {
36 public:
37  ProfileTransport(IKaaChannelManager& channelManager,
38  const Botan::MemoryVector<std::uint8_t>& publicKey);
39 
40  virtual void sync() {
41  syncAll();
42  }
43 
45 
46  virtual void onProfileResponse(const ProfileSyncResponse& response);
47 
48  virtual void setProfileManager(IProfileManager* manager) {
49  if (manager != nullptr) {
50  profileManager_ = manager;
51  }
52  }
53 
54 private:
55  void populateEventFamilyVersions(EndpointVersionInfo::eventFamilyVersions_t& versions);
56  bool isProfileOutDated(SharedDataBuffer profileHash);
57 
58 private:
59  IProfileManager* profileManager_;
60  std::vector<std::uint8_t> publicKey_;
61 };
62 
63 } /* namespace kaa */
64 
65 #endif /* DEFAULTPROFILETRANSPORT_HPP_ */
ProfileTransport(IKaaChannelManager &channelManager, const Botan::MemoryVector< std::uint8_t > &publicKey)
virtual void setProfileManager(IProfileManager *manager)
virtual void onProfileResponse(const ProfileSyncResponse &response)
virtual ProfileSyncRequestPtr createProfileRequest()
std::pair< boost::shared_array< std::uint8_t >, std::uint32_t > SharedDataBuffer
std::shared_ptr< ProfileSyncRequest > ProfileSyncRequestPtr