client-cpp  0.6.1
MetaDataTransport.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 METADATATRANSPORT_HPP_
18 #define METADATATRANSPORT_HPP_
19 
20 #include "kaa/KaaDefaults.hpp"
25 
26 namespace kaa {
27 
29 public:
31  : clientStatus_(status), publicKeyHash_(keyHash), timeout_(timeout) {}
32 
33  std::shared_ptr<SyncRequestMetaData> createSyncRequestMetaData() {
34  std::shared_ptr<SyncRequestMetaData> request(new SyncRequestMetaData);
35 
36  request->applicationToken = APPLICATION_TOKEN;
37  request->endpointPublicKeyHash = publicKeyHash_;
38  SharedDataBuffer buffer = clientStatus_->getProfileHash();
39  std::vector<std::uint8_t> profileHash;
40  for (size_t i =0; i < buffer.second; ++i) {
41  profileHash.push_back(buffer.first[i]);
42  }
43  request->profileHash.set_bytes(profileHash);
44  request->timeout = timeout_;
45  return request;
46  }
47 
48 private:
49  IKaaClientStateStoragePtr clientStatus_;
50  EndpointObjectHash publicKeyHash_;
51  long timeout_;
52 };
53 
54 } // namespace kaa
55 
56 
57 #endif /* METADATATRANSPORT_HPP_ */
std::shared_ptr< SyncRequestMetaData > createSyncRequestMetaData()
std::shared_ptr< IKaaClientStateStorage > IKaaClientStateStoragePtr
const char *const APPLICATION_TOKEN
MetaDataTransport(IKaaClientStateStoragePtr status, EndpointObjectHash &keyHash, long timeout)
std::pair< boost::shared_array< std::uint8_t >, std::uint32_t > SharedDataBuffer