Link Kit C-SDK  4.1.0
aiot_mqtt_download_api.h
浏览该文件的文档.
1 
8 #ifndef __AIOT_MQTT_DOWNLOAD_API_H__
9 #define __AIOT_MQTT_DOWNLOAD_API_H__
10 
11 #if defined(__cplusplus)
12 extern "C" {
13 #endif
14 
15 #include <stdint.h>
16 
20 #define STATE_MQTT_DOWNLOAD_BASE (-0x1D00)
21 
25 #define STATE_MQTT_DOWNLOAD_MQTT_HANDLE_NULL (-0x1D01)
26 
30 #define STATE_MQTT_DOWNLOAD_TASK_DEINIT (-0x1D02)
31 
35 #define STATE_MQTT_DOWNLOAD_INIT (-0x1D03)
36 
40 #define STATE_MQTT_DOWNLOAD_ING (-0x1D04)
41 
45 #define STATE_MQTT_DOWNLOAD_FINISHED (-0x1D05)
46 
50 #define STATE_MQTT_DOWNLOAD_SUCCESS (-0x1D06)
51 
55 #define STATE_MQTT_DOWNLOAD_FAILED_TIMEOUT (-0x1D07)
56 
60 #define STATE_MQTT_DOWNLOAD_FAILED_MISMATCH (-0x1D08)
61 
65 #define STATE_MQTT_DOWNLOAD_FAILED_RECVERROR (-0x1D09)
66 
70 #define STATE_MQTT_DOWNLOAD_ABORT (-0x1D0A)
71 
75 #define STATE_MQTT_DOWNLOAD_FILESIZE_ERROR (-0x1D0B)
76 
77 
78 
82 typedef enum {
88 
92 typedef struct {
96  aiot_mqtt_download_recv_type_t type;
97  union {
101  struct {
105  char *filename;
109  uint32_t offset;
113  uint32_t data_size;
117  char *data;
121  int32_t percent;
125  int32_t file_lenth;
126  } data_resp;
127  } data;
129 
139 typedef void (* aiot_mqtt_download_recv_handler_t)(void *handle,
140  const aiot_mqtt_download_recv_t *packet, void *userdata);
141 
142 
148 typedef enum {
157 
168 
191 
216 
225 
228 
237 void *aiot_mqtt_download_init(void);
238 
251 int32_t aiot_mqtt_download_setopt(void *handle, aiot_mqtt_download_option_t option, void *data);
252 
263 int32_t aiot_mqtt_download_deinit(void **handle);
264 
280 int32_t aiot_mqtt_download_process(void *handle);
281 
282 
283 
284 #if defined(__cplusplus)
285 }
286 #endif
287 
288 #endif /* __AIOT_MQTT_DOWNLOAD_API_H__ */
289 
文件分片下载请求的返回报文
Definition: aiot_mqtt_download_api.h:86
用户需要SDK暂存的上下文
Definition: aiot_mqtt_download_api.h:178
void * aiot_mqtt_download_init(void)
创建mqtt_download会话实例, 并以默认值配置会话参数
Definition: aiot_mqtt_download_api.c:106
设置按照range下载的起始地址
Definition: aiot_mqtt_download_api.h:203
设置download实例句柄所包含下载任务的具体内容
Definition: aiot_mqtt_download_api.h:190
aiot_mqtt_download_recv_type_t
mqtt_download模块收到从网络上来的报文时, 通知用户的报文类型
Definition: aiot_mqtt_download_api.h:82
aiot_mqtt_download_option_t
aiot_mqtt_download_setopt 接口的option参数可选值.
Definition: aiot_mqtt_download_api.h:148
char * data
接收到的数据
Definition: aiot_mqtt_download_api.h:117
int32_t percent
接收到的数据
Definition: aiot_mqtt_download_api.h:121
单次请求数据的最大长度
Definition: aiot_mqtt_download_api.h:224
Definition: aiot_mqtt_download_api.h:226
int32_t aiot_mqtt_download_deinit(void **handle)
结束mqtt_download会话, 销毁实例并回收资源
Definition: aiot_mqtt_download_api.c:150
char * filename
用户标准的文件名称,一般为设置的文件名
Definition: aiot_mqtt_download_api.h:105
int32_t aiot_mqtt_download_setopt(void *handle, aiot_mqtt_download_option_t option, void *data)
配置mqtt_download会话
Definition: aiot_mqtt_download_api.c:412
设置MQTT的handle
Definition: aiot_mqtt_download_api.h:167
uint32_t data_size
接收到的数据长度
Definition: aiot_mqtt_download_api.h:113
设置处理OTA消息的用户回调函数
Definition: aiot_mqtt_download_api.h:156
uint32_t offset
文件的偏移
Definition: aiot_mqtt_download_api.h:109
设置按照range下载的结束地址
Definition: aiot_mqtt_download_api.h:215
int32_t file_lenth
文件的总大小
Definition: aiot_mqtt_download_api.h:125
int32_t aiot_mqtt_download_process(void *handle)
处理下载逻辑
Definition: aiot_mqtt_download_api.c:547
mqtt_download模块收到从网络上来的报文时, 通知用户的报文内容
Definition: aiot_mqtt_download_api.h:92
void(* aiot_mqtt_download_recv_handler_t)(void *handle, const aiot_mqtt_download_recv_t *packet, void *userdata)
mqtt_download模块收到从网络上来的报文时, 通知用户所调用的数据回调函数
Definition: aiot_mqtt_download_api.h:139
aiot_mqtt_download_recv_type_t type
报文内容所对应的报文类型, 更多信息请参考aiot_mqtt_download_recv_type_t
Definition: aiot_mqtt_download_api.h:96