client-cpp  0.9.0
ProfileTransport.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014-2016 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 
28 
29 namespace kaa {
30 
31 class IKaaChannelManager;
32 
33 class ProfileTransport: public AbstractKaaTransport<TransportType::PROFILE>,
34  public IProfileTransport {
35 public:
36  ProfileTransport(IKaaChannelManager& channelManager,
37  const PublicKey& publicKey, IKaaClientContext &context);
38 
39  virtual void sync() { syncAll(); }
40 
42 
43  virtual void onProfileResponse(const ProfileSyncResponse& response);
44 
45  virtual void setProfileManager(IProfileManager* manager)
46  {
47  if (manager) {
48  profileManager_ = manager;
49  }
50  }
51 
52 private:
53  bool isProfileOutDated(const HashDigest& profileHash);
54 
55 private:
56  IProfileManager* profileManager_;
57  std::vector<std::uint8_t> publicKey_;
58 };
59 
60 } /* namespace kaa */
61 
62 #endif /* DEFAULTPROFILETRANSPORT_HPP_ */
Botan::secure_vector< std::uint8_t > PublicKey
std::vector< std::uint8_t > HashDigest
virtual void setProfileManager(IProfileManager *manager)
ProfileTransport(IKaaChannelManager &channelManager, const PublicKey &publicKey, IKaaClientContext &context)
virtual void onProfileResponse(const ProfileSyncResponse &response)
virtual ProfileSyncRequestPtr createProfileRequest()
std::shared_ptr< ProfileSyncRequest > ProfileSyncRequestPtr