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