1 #ifndef RAPP_CLOUD_USER
2 #define RAPP_CLOUD_USER
20 const std::string token,
21 std::function<
void(std::vector<std::string>)> callback
25 header_ =
"GET /hop/available_services HTTP/1.1\r\n";
34 std::stringstream ss(json);
35 std::vector<std::string> services;
37 boost::property_tree::ptree tree;
38 boost::property_tree::read_json(ss, tree);
39 for (
auto child : tree.get_child(
"services")) {
40 services.push_back(child.second.get_value<std::string>());
42 for (
auto child : tree.get_child(
"error")) {
43 const std::string value = child.second.get_value<std::string>();
45 std::cerr <<
"available_services JSON error: " << value << std::endl;
49 catch (boost::property_tree::json_parser::json_parser_error & je) {
50 std::cerr <<
"available_services::handle_reply Error parsing: " << je.filename()
51 <<
" on line: " << je.line() << std::endl;
52 std::cerr << je.message() << std::endl;
57 std::function<void(std::vector<std::string> services)>
delegate_;
std::string header_
Header that will be used.
void handle_reply(std::string json)
handle platform's JSON reply
available_services(const std::string token, std::function< void(std::vector< std::string >)> callback)
std::function< void(std::string)> callback_
Callback Handler - use with std::bind or boost variant.
void handle_reply(std::string json)
handle platform's JSON reply
base class for asynchronous http websockets used for connecting to cloud services ...
std::function< void(std::vector< std::string > services)> delegate_