client-cpp  0.7.0
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 public:
35  ProfileTransport(IKaaChannelManager& channelManager,
36  const PublicKey& publicKey);
37 
38  virtual void sync() { syncAll(); }
39 
41 
42  virtual void onProfileResponse(const ProfileSyncResponse& response);
43  virtual void onProfileResync() { syncAll(); }
44 
45  virtual void setProfileManager(IProfileManager* manager)
46  {
47  if (manager) {
48  profileManager_ = manager;
49  }
50  }
51 
52 private:
53  void populateEventFamilyVersions(EndpointVersionInfo::eventFamilyVersions_t& versions);
54  bool isProfileOutDated(const HashDigest& profileHash);
55 
56 private:
57  IProfileManager* profileManager_;
58  std::vector<std::uint8_t> publicKey_;
59 };
60 
61 } /* namespace kaa */
62 
63 #endif /* DEFAULTPROFILETRANSPORT_HPP_ */
std::vector< std::uint8_t > HashDigest
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::shared_ptr< ProfileSyncRequest > ProfileSyncRequestPtr
virtual void onProfileResync()