1 #ifndef RAPP_CLOUD_WEATHER_REPORT
2 #define RAPP_CLOUD_WEATHER_REPORT
24 const std::string city,
25 const std::string weather_reporter,
26 const unsigned int metric,
27 const std::string token,
28 std::function<
void(std::string)> callback
32 boost::property_tree::ptree tree;
33 tree.put(
"city", city);
34 tree.put(
"weather_reporter", weather_reporter);
35 tree.put(
"metric", boost::lexical_cast<std::string>(metric));
37 boost::property_tree::write_json(ss, tree,
false);
39 header_ =
"POST /hop/weather_report_current HTTP/1.1\r\n"
40 +
"Content-Type: application/x-www-form-urlencoded\r\n";
49 std::stringstream ss(json);
73 const std::string city,
74 const std::string weather_reporter,
75 const unsigned int metric,
76 const std::string token,
77 std::function<
void(std::string)> callback
81 boost::property_tree::ptree tree;
82 tree.put(
"city", city);
83 tree.put(
"weather_reporter", weather_reporter);
84 tree.put(
"metric", boost::lexical_cast<std::string>(metric));
86 boost::property_tree::write_json(ss, tree,
false);
88 header_ =
"POST /hop/weather_report_forecast HTTP/1.1\r\n"
89 +
"Content-Type: application/x-www-form-urlencoded\r\n";
98 std::stringstream ss(json);
std::string header_
Header that will be used.
get current weather report
weather_report_current(const std::string city, const std::string weather_reporter, const unsigned int metric, const std::string token, std::function< void(std::string)> callback)
std::function< void(std::string)> delegate_
void handle_reply(std::string json)
handle platform's JSON reply
std::string post_
Actual post Data.
std::function< void(std::string)> delegate_
weather_report_forecast(const std::string city, const std::string weather_reporter, const unsigned int metric, const std::string token, std::function< void(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 ...