diff options
Diffstat (limited to 'inc/ua_client.h')
-rw-r--r-- | inc/ua_client.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/inc/ua_client.h b/inc/ua_client.h new file mode 100644 index 0000000..9e25ae9 --- /dev/null +++ b/inc/ua_client.h @@ -0,0 +1,46 @@ +#ifndef __UA_CLIENT_H__ +#define __UA_CLIENT_H__ + +#include <stdio.h> +#include <dlog.h> + +#ifdef LOG_TAG +#undef LOG_TAG +#endif +#define LOG_TAG "UA_CLIENT" + +#define UA_LOG(fmt, ...) { \ + dlog_print(DLOG_DEBUG, LOG_TAG, "[%s: %s(): %d] " fmt "", rindex(__FILE__, '/')+1, __FUNCTION__, __LINE__, ##__VA_ARGS__); \ +} + +#define UA_LOG_ONLY(fmt, ...) { \ + dlog_print(DLOG_DEBUG, LOG_TAG, fmt, ##__VA_ARGS__); \ +} + +typedef struct { + char *manufacturer; + char *model_name; + char *firmware_ver; + char * firmware_update_state; + char *uuid; // for test + char *access_token; // for test +} ua_device_info_s; + +typedef enum { + UA_HTTP_GET = 0, + UA_HTTP_POST, + UA_HTTP_PUT, + UA_HTTP_DELETE +}rest_req_type; + + +/* ua_http.cpp */ +int ua_http_download_file(const char *download_url); +int ua_http_send_request(rest_req_type type, char *req_url, char **res_header, char **res_body); + +/* ua_json_parser.cpp */ +void ua_json_parser_firmware_info(const char *data, char **old_ver, char **new_ver, \ + char **download_url, char **priority); + + +#endif /* __UA_CLIENT_H__ */ |