ex

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Committer:
TMBOY
Date:
Tue Jul 18 16:54:45 2017 +0800
Revision:
47:9e361da97763
?

Who changed what in which revision?

UserRevisionLine numberNew contents of line
TMBOY 47:9e361da97763 1 // Copyright 2017 Baidu Inc. All Rights Reserved.
TMBOY 47:9e361da97763 2 // Author: Pan Haijun, Gang Chen(chengang12@baidu.com)
TMBOY 47:9e361da97763 3 //
TMBOY 47:9e361da97763 4 // This header file define the HttpClient class, it's used to establish http connection.
TMBOY 47:9e361da97763 5
TMBOY 47:9e361da97763 6 #ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_HTTP_CLIENT_BAIDU_HTTP_CLIENT_H
TMBOY 47:9e361da97763 7 #define BAIDU_IOT_TINYDU_IOT_OS_SRC_HTTP_CLIENT_BAIDU_HTTP_CLIENT_H
TMBOY 47:9e361da97763 8
TMBOY 47:9e361da97763 9 #include "baidu_http_client_c.h"
TMBOY 47:9e361da97763 10
TMBOY 47:9e361da97763 11 namespace duer {
TMBOY 47:9e361da97763 12
TMBOY 47:9e361da97763 13 class HttpClient {
TMBOY 47:9e361da97763 14 public:
TMBOY 47:9e361da97763 15 HttpClient();
TMBOY 47:9e361da97763 16 ~HttpClient();
TMBOY 47:9e361da97763 17 /*
TMBOY 47:9e361da97763 18 * register data output handler callback to handle data block
TMBOY 47:9e361da97763 19 * @param[in] data output handler callback to be registered
TMBOY 47:9e361da97763 20 * @param[in] p_usr_ctx for data output handler callback to be registered
TMBOY 47:9e361da97763 21 * @return none
TMBOY 47:9e361da97763 22 */
TMBOY 47:9e361da97763 23 void register_data_handler(data_out_handler_cb data_hdlr_cb, void* p_usr_ctx);
TMBOY 47:9e361da97763 24 /*
TMBOY 47:9e361da97763 25 * register callback for stop notify & reset stop notify
TMBOY 47:9e361da97763 26 * @param[in] chk_stp_cb: to notify httpclient to stop
TMBOY 47:9e361da97763 27 * @param[in] rst_stp_cb: to reset stop notify flag
TMBOY 47:9e361da97763 28 * @return none
TMBOY 47:9e361da97763 29 */
TMBOY 47:9e361da97763 30 void register_notify_call_back(check_stop_notify_cb_t chk_stp_cb,
TMBOY 47:9e361da97763 31 reset_stop_notify_cb_t rst_stp_cb);
TMBOY 47:9e361da97763 32 /*
TMBOY 47:9e361da97763 33 * create http connection and get data by the url
TMBOY 47:9e361da97763 34 * @param[in] url: to get http client_c's url
TMBOY 47:9e361da97763 35 * @return e_http_result
TMBOY 47:9e361da97763 36 */
TMBOY 47:9e361da97763 37 e_http_result get(const char* url);
TMBOY 47:9e361da97763 38 /*
TMBOY 47:9e361da97763 39 * register callback to get url which is used by http to get data
TMBOY 47:9e361da97763 40 * @param[in] the callback to be registered
TMBOY 47:9e361da97763 41 * @return none
TMBOY 47:9e361da97763 42 */
TMBOY 47:9e361da97763 43 void register_call_back_to_get_url(get_url_cb_t cb);
TMBOY 47:9e361da97763 44 private:
TMBOY 47:9e361da97763 45 http_client_c* _p_client_inst;
TMBOY 47:9e361da97763 46 };
TMBOY 47:9e361da97763 47
TMBOY 47:9e361da97763 48 }//duer
TMBOY 47:9e361da97763 49 #endif//BAIDU_IOT_TINYDU_IOT_OS_SRC_HTTP_CLIENT_BAIDU_HTTP_CLIENT_H
TMBOY 47:9e361da97763 50