| #ifndef _FOTA_PROTOCOL_UTIL_H_ |
| #define _FOTA_PROTOCOL_UTIL_H_ |
| |
| #ifdef __cplusplus |
| extern "C" { |
| #endif |
| |
| |
| #define LINE_BUF_SIZE 128 |
| |
| typedef enum { |
| INT_ARGUMENT = 1, |
| DOUBLE_ARGUMENT, |
| STRING_ARGUMENT, |
| HEX_ARGUMENT, |
| CHARACTER_ARGUMENT, |
| POINTER_ARGUMENT, |
| MESSAGE_END |
| } ArgumentType; |
| |
| typedef struct { |
| ArgumentType type; |
| union { |
| int int_val; |
| double double_val; |
| char *string_val; |
| void *pointer_val; |
| int character_val; |
| } u; |
| } ArgumentInfo; |
| |
| typedef struct { |
| char *string; |
| } VString; |
| |
| /*ÐÒéijÏîÖµÀàÐÍ*/ |
| typedef enum { |
| ITEMTYPE_DEC, |
| ITEMTYPE_HEX, |
| ITEMTYPE_STRING |
| } ItemType; |
| |
| |
| /*º¯ÊýÉùÃ÷*/ |
| char* protocol_package(char *description, ...); |
| |
| void format_arguments(VString *message, va_list ap); |
| |
| int get_action_code(char *content); |
| |
| int get_result_code(char *content); |
| |
| int get_version_info(char *content, version_info_t *versionInfo); |
| |
| int get_version_down_info(char *content, download_info_t *downloadInfo); |
| |
| void str_append(VString *message, char *str); |
| |
| void free_version_info(version_info_t *version_info); |
| void print_version_info(version_info_t *version_info); |
| |
| |
| |
| |
| /* notifier list */ |
| notifier_block_t* notifier_list_add(notifier_block_t* notifier_list, notifier_block_t* notifier_msg); |
| |
| int notifier_list_free(notifier_block_t* notifier_list); |
| |
| void notify_callback_process(dmgr_t dm_id, unsigned short event_id, unsigned short msgid, void* data); |
| /* notifier list end */ |
| |
| int version_md5_check(const char *filename, char *md5_expect); |
| |
| |
| #ifdef __cplusplus |
| } |
| #endif |
| |
| #endif |
| |
| |