Link Kit C-SDK  4.1.0
函数 | 变量
aiot_mqtt_download_api.c 文件参考

mqtt文件下载的实现文件 更多...

#include "aiot_ota_api.h"
#include "core_mqtt.h"
#include "core_string.h"
#include "core_sha256.h"
#include "ota_md5.h"
#include "core_log.h"
#include "core_global.h"
#include "mqtt_download_private.h"
#include "ota_private.h"
aiot_mqtt_download_api.c 的引用(Include)关系图:

函数

static int32_t _md_send_request (void *handle)
 
static void _md_recv_data_reply_handler (void *handle, const aiot_mqtt_recv_t *msg, void *userdata)
 
uint16_t crc_ibm (uint8_t const *buffer, size_t len)
 
int32_t _md_sub_response_topic (void *handle)
 
int32_t _md_unsub_response_topic (void *handle)
 
void * aiot_mqtt_download_init (void)
 创建mqtt_download会话实例, 并以默认值配置会话参数 更多...
 
static void _md_core_mqtt_process_handler (void *context, aiot_mqtt_event_t *event, core_mqtt_event_t *core_event)
 
int32_t aiot_mqtt_download_deinit (void **handle)
 结束mqtt_download会话, 销毁实例并回收资源 更多...
 
static int32_t _download_digest_update (mqtt_download_handle_t *download_handle, uint8_t *buffer, uint32_t buffer_len)
 
static int32_t _download_digest_verify (mqtt_download_handle_t *download_handle)
 
static int32_t _download_report_progress (void *handle, int32_t percent)
 
static int32_t _parse_json_header (void *handle, char *data, uint32_t data_len, aiot_mqtt_download_recv_t *pakcet)
 
static void _md_resend_request (mqtt_download_handle_t *md_handle)
 
int32_t aiot_mqtt_download_setopt (void *handle, aiot_mqtt_download_option_t option, void *data)
 配置mqtt_download会话 更多...
 
static int32_t _md_reset_handle (mqtt_download_handle_t *md_handle)
 
int32_t aiot_mqtt_download_process (void *handle)
 处理下载逻辑 更多...
 

变量

const uint16_t crc_ibm_table [256]
 

详细描述

mqtt文件下载的实现文件

日期
2019-12-27

函数说明

static int32_t _md_send_request ( void *  handle)
static

函数调用图:

static void _md_recv_data_reply_handler ( void *  handle,
const aiot_mqtt_recv_t msg,
void *  userdata 
)
static

函数调用图:

uint16_t crc_ibm ( uint8_t const *  buffer,
size_t  len 
)
int32_t _md_sub_response_topic ( void *  handle)

函数调用图:

int32_t _md_unsub_response_topic ( void *  handle)

函数调用图:

void* aiot_mqtt_download_init ( void  )

创建mqtt_download会话实例, 并以默认值配置会话参数

返回
void *
返回值
非NULLmqtt_download实例的句柄
NULL初始化失败, 一般是内存分配失败导致

函数调用图:

static void _md_core_mqtt_process_handler ( void *  context,
aiot_mqtt_event_t event,
core_mqtt_event_t *  core_event 
)
static
int32_t aiot_mqtt_download_deinit ( void **  handle)

结束mqtt_download会话, 销毁实例并回收资源

参数
[in]handle指向mqtt_download会话句柄的指针
返回
int32_t
返回值
<STATE_SUCCESS执行失败
>=STATE_SUCCESS执行成功

函数调用图:

static int32_t _download_digest_update ( mqtt_download_handle_t *  download_handle,
uint8_t *  buffer,
uint32_t  buffer_len 
)
static
static int32_t _download_digest_verify ( mqtt_download_handle_t *  download_handle)
static
static int32_t _download_report_progress ( void *  handle,
int32_t  percent 
)
static

函数调用图:

static int32_t _parse_json_header ( void *  handle,
char *  data,
uint32_t  data_len,
aiot_mqtt_download_recv_t pakcet 
)
static
static void _md_resend_request ( mqtt_download_handle_t *  md_handle)
static

函数调用图:

int32_t aiot_mqtt_download_setopt ( void *  handle,
aiot_mqtt_download_option_t  option,
void *  data 
)

配置mqtt_download会话

参数
[in]handlemqtt_download会话句柄
[in]option配置选项, 更多信息请参考aiot_mqtt_download_option_t
[in]data配置选项数据, 更多信息请参考aiot_mqtt_download_option_t
返回
int32_t
返回值
<STATE_SUCCESS参数配置失败
>=STATE_SUCCESS参数配置成功

函数调用图:

static int32_t _md_reset_handle ( mqtt_download_handle_t *  md_handle)
static
int32_t aiot_mqtt_download_process ( void *  handle)

处理下载逻辑

参数
handlemqtt_download会话句柄
返回
int32_t
返回值
STATE_MQTT_DOWNLOAD_INIT初始化完成
STATE_MQTT_DOWNLOAD_ING正在下载
STATE_MQTT_DOWNLOAD_SUCCESS下载完成
STATE_MQTT_DOWNLOAD_FAILED_RECVERROR数据接收错误
STATE_MQTT_DOWNLOAD_FAILED_TIMEOUT接收超时
STATE_MQTT_DOWNLOAD_FAILED_MISMATCH校验错误
STATE_MQTT_DOWNLOAD_MQTT_HANDLE_NULLhandle没有初始化
STATE_MQTT_DOWNLOAD_TASK_DEINIT没有设置task

函数调用图:

变量说明

const uint16_t crc_ibm_table[256]