RAPP Platform API
 All Classes Namespaces Files Functions Variables Typedefs
fetch_personal_data.hpp
Go to the documentation of this file.
1 #ifndef RAPP_CLOUD_FETCH_PERSONAL_DATA
2 #define RAPP_CLOUD_FETCH_PERSONAL_DATA
3 #include "includes.ihh"
4 namespace rapp {
5 namespace cloud {
13 class fetch_personal_data : public rapp::services::asio_service_http
14 {
15 public:
16 
24  const std::string user,
25  std::function < void( const std::string ) > callback
26  )
27  : rapp::services::asio_service_http(), delegate__(callback)
28  {
29  // Form the POST string - simple argument
30  post_ = "user="+user+"\r\n";
31  // Craft the full URI
32  const std::string uri = "/hop/fetch_personal_data/";
33  // Form the Header
34  header_ = "POST " + uri + " HTTP/1.1\r\n";
35  header_ += "Host: " + std::string( rapp::cloud::address ) + "\r\n";
36  header_ += "Content-Type: application/x-www-form-urlencoded\r\n";
37  header_ += "Content-Length: " + boost::lexical_cast<std::string>(post_.length()) + "\r\n";
38  header_ += "Connection: close\r\n\r\n";
39  // bind the base class callback, to our handle_reply
40  callback_ = std::bind(&fetchPersonalData::handle_reply, this, std::placeholders::_1);
41  }
42 
43 private:
44 
47  void handle_reply(std::string json)
48  {
49  delegate__(json);
50  }
51 
53  std::function<void(const std::string)> delegate__;
54 };
55 }
56 }
57 #endif
std::function< void(const std::string)> delegate__
The callback called upon completion of receiving the detected faces.
fetch_personal_data(const std::string user, std::function< void(const std::string) > callback)
Constructor for obtained personal (JSON) data for a specific user.
base class for asynchronous http websockets used for connecting to cloud services ...
Get all personal data for a specific user.
constexpr char address[]
api.rapp.cloud -
Definition: asio_socket.hpp:8