Link Kit C-SDK
4.1.0
|
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"
函数 | |
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文件下载的实现文件
|
static |
|
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会话实例, 并以默认值配置会话参数
非NULL | mqtt_download实例的句柄 |
NULL | 初始化失败, 一般是内存分配失败导致 |
|
static |
int32_t aiot_mqtt_download_deinit | ( | void ** | handle | ) |
结束mqtt_download会话, 销毁实例并回收资源
[in] | handle | 指向mqtt_download会话句柄的指针 |
<STATE_SUCCESS | 执行失败 |
>=STATE_SUCCESS | 执行成功 |
|
static |
|
static |
|
static |
|
static |
|
static |
int32_t aiot_mqtt_download_setopt | ( | void * | handle, |
aiot_mqtt_download_option_t | option, | ||
void * | data | ||
) |
配置mqtt_download会话
[in] | handle | mqtt_download会话句柄 |
[in] | option | 配置选项, 更多信息请参考aiot_mqtt_download_option_t |
[in] | data | 配置选项数据, 更多信息请参考aiot_mqtt_download_option_t |
<STATE_SUCCESS | 参数配置失败 |
>=STATE_SUCCESS | 参数配置成功 |
|
static |
int32_t aiot_mqtt_download_process | ( | void * | handle | ) |
处理下载逻辑
handle | mqtt_download会话句柄 |
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_NULL | handle没有初始化 |
STATE_MQTT_DOWNLOAD_TASK_DEINIT | 没有设置task |
const uint16_t crc_ibm_table[256] |