ex

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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers baidu_http_client.h Source File

baidu_http_client.h

00001 // Copyright 2017 Baidu Inc. All Rights Reserved.
00002 // Author: Pan Haijun, Gang Chen(chengang12@baidu.com)
00003 //
00004 // This header file define the HttpClient class, it's used to establish http connection.
00005 
00006 #ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_HTTP_CLIENT_BAIDU_HTTP_CLIENT_H
00007 #define BAIDU_IOT_TINYDU_IOT_OS_SRC_HTTP_CLIENT_BAIDU_HTTP_CLIENT_H
00008 
00009 #include "baidu_http_client_c.h"
00010 
00011 namespace duer {
00012 
00013 class HttpClient {
00014 public:
00015     HttpClient();
00016     ~HttpClient();
00017     /*
00018      *  register data output handler callback to handle data block
00019      *  @param[in] data output handler callback to be registered
00020      *  @param[in] p_usr_ctx for data output handler callback to be registered
00021      *  @return   none
00022      */
00023     void register_data_handler(data_out_handler_cb data_hdlr_cb, void* p_usr_ctx);
00024     /*
00025      *  register callback for stop notify & reset stop notify
00026      *  @param[in] chk_stp_cb: to notify httpclient to stop
00027      *  @param[in] rst_stp_cb: to reset stop notify flag
00028      *  @return   none
00029      */
00030     void register_notify_call_back(check_stop_notify_cb_t chk_stp_cb,
00031                                    reset_stop_notify_cb_t rst_stp_cb);
00032     /*
00033      *  create http connection and get data by the url
00034      *  @param[in] url: to get http client_c's url
00035      *  @return   e_http_result
00036      */
00037     e_http_result get(const char* url);
00038     /*
00039      *  register callback to get url which is used by http to get data
00040      *  @param[in] the callback to be registered
00041      *  @return   none
00042      */
00043     void register_call_back_to_get_url(get_url_cb_t cb);
00044 private:
00045     http_client_c* _p_client_inst;
00046 };
00047 
00048 }//duer
00049 #endif//BAIDU_IOT_TINYDU_IOT_OS_SRC_HTTP_CLIENT_BAIDU_HTTP_CLIENT_H
00050