8 #ifndef __AIOT_MQTT_UPLOAD_API_H__ 9 #define __AIOT_MQTT_UPLOAD_API_H__ 11 #if defined(__cplusplus) 18 #define STATE_MQTT_UPLOAD_BASE (-0x2100) 23 #define STATE_MQTT_UPLOAD_MQTT_HANDLE_IS_NULL (-0x2101) 29 #define STATE_MQTT_UPLOAD_FILENAME_IS_NULL (-0x2102) 35 #define STATE_MQTT_UPLOAD_PARAMS_IS_NULL (-0x2103) 41 #define STATE_MQTT_UPLOAD_FILE_DATA_IS_NULL (-0x2104) 46 #define STATE_MQTT_UPLOAD_MQTT_SYSDEP_IS_NULL (-0x2105) 51 #define STATE_MQTT_UPLOAD_PARSE_INIT_FAILED (-0x2106) 56 #define STATE_MQTT_UPLOAD_PARSE_UPLOAD_REPLY_FAILED (-0x2107) 61 #define STATE_MQTT_UPLOAD_PARSE_CANCEL_FAILED (-0x2108) 66 #define STATE_MQTT_UPLOAD_PARSE_JSON_FAILED (-0x2109) 71 #define STATE_MQTT_UPLOAD_RECV_FILE_INFO_ERROR (-0x210A) 76 #define STATE_MQTT_UPLOAD_RECV_UPLOADID_ERROR (-0x210B) 81 #define STATE_MQTT_UPLOAD_MALLOC_FAILED (-0x210C) 86 #define STATE_MQTT_UPLOAD_UPTASK_IS_NULL (-0x210D) 91 #define STATE_MQTT_UPLOAD_UPLOAD_REPLY_ERROR (-0x210E) 96 #define STATE_MQTT_UPLOAD_HANDLE_DEINIT (-0x210F) 101 #define STATE_MQTT_UPLOAD_FILE_RESTART_FAILED (-0x2110) 107 #define STATE_MQTT_UPLOAD_BLOCK_SIZE_ERROR (-0x2111) 113 #define STATE_MQTT_UPLOAD_READ_DATA_HANDLER_IS_NULL (-0x2112) 118 #define STATE_MQTT_UPLOAD_HANDLE_INIT (-0x2113) 123 #define STATE_MQTT_UPLOAD_PROCESS_REPLY_ERROR (-0x2114) 129 #define STATE_MQTT_UPLOAD_NONE (-0x2115) 135 #define STATE_MQTT_UPLOAD_REQUEST_INIT (-0x2116) 141 #define STATE_MQTT_UPLOAD_IS_UPLOADING (-0x2117) 147 #define STATE_MQTT_UPLOAD_REQUEST_CANCEL (-0x2118) 153 #define STATE_MQTT_UPLOAD_CANCEL_SUCCESS (-0x2119) 159 #define STATE_MQTT_UPLOAD_CANCEL_FAILED (-0x2120) 165 #define STATE_MQTT_UPLOAD_FAILED (-0x2121) 171 #define STATE_MQTT_UPLOAD_FAILED_TIMEOUT (-0x2122) 177 #define STATE_MQTT_UPLOAD_FAILED_WHOLE_CHECK (-0x2124) 183 #define STATE_MQTT_UPLOAD_FINISHED (-0x2125) 189 #define STATE_MQTT_UPLOAD_NO_UPLOAD_TASK (-0x2126) 195 #define STATE_MQTT_UPLOAD_EXTRA_PARAMS_NOT_JSON (-0x2127) 200 #define AIOT_MQTT_UPLOAD_FILE_MODE_OVERWRITE "overwrite" 209 #define AIOT_MQTT_UPLOAD_FILE_MODE_APPEND "append" 214 #define AIOT_MQTT_UPLOAD_FILE_MODE_FAIL "reject" 219 #define MQTT_UPLOAD_DEFAULT_FILENAME_LEN (128) 224 #define MQTT_UPLOAD_DEFAULT_CRC64_LEN (32) 229 #define MQTT_UPLOAD_DEFAULT_UPLOAD_SIZE (64) 412 aiot_mqtt_upload_recv_type_t
type;
629 #if defined(__cplusplus) int32_t aiot_mqtt_upload_open_stream(void *handle, char *file_name, aiot_mqtt_upload_recv_t *packet)
向MQTT UPLOAD 服务请求发送文件
Definition: aiot_mqtt_upload_api.c:1454
MQTT UPLOAD模块收到服务端应答的报文信息, 通知用户的报文内容
Definition: aiot_mqtt_upload_api.h:407
文件上传正常
Definition: aiot_mqtt_upload_api.h:240
char * mode
Definition: aiot_mqtt_upload_api.h:518
申请使用mqtt协议上传文件时,文件大小超过阈值16M
Definition: aiot_mqtt_upload_api.h:270
aiot_mqtt_upload_recv_type_t
MQTT UPLOAD模块收到从服务端应答的报文类型
Definition: aiot_mqtt_upload_api.h:337
uint8_t complete
服务端应答文件上传完成后才有的应答,complete true: 文件上传成功,false: 文件上传失败 ...
Definition: aiot_mqtt_upload_api.h:400
配置文件上传的分片长度,默认是2048byte, 数据类型为(uint32_t *)
Definition: aiot_mqtt_upload_api.h:448
文件上传请求参数错误
Definition: aiot_mqtt_upload_api.h:258
char * file_name
Definition: aiot_mqtt_upload_api.h:516
设置MQTT的最大值,设置失败
Definition: aiot_mqtt_upload_api.h:457
uint32_t file_offset
已经上传文件的偏移量,偏移量的是相对于文件开始的起始点算起,可以用于回调函数中读取新分片文件的偏移量 ...
Definition: aiot_mqtt_upload_api.h:380
#define MQTT_UPLOAD_DEFAULT_FILENAME_LEN
MQTT上传文件名的最大长度
Definition: aiot_mqtt_upload_api.h:219
请求上传的payload格式非法,无法解析其中的json格式数据
Definition: aiot_mqtt_upload_api.h:246
uint32_t file_size
对应上传文件的总长度,用户调用 aiot_mqtt_upload_open_stream 传入的文件大小
Definition: aiot_mqtt_upload_api.h:369
接收到的服务端应答消息的报文信息
Definition: aiot_mqtt_upload_api.h:359
服务端其他异常
Definition: aiot_mqtt_upload_api.h:264
设备上传文件分片时,当前分片的offset与已上传至的服务端文件大小不一致
Definition: aiot_mqtt_upload_api.h:282
关联MQTT Handle会话,UPLOAD过程中使用MQTT的通道能力, 用以向服务端请求上传、发送分片文件、请求关闭通道...
Definition: aiot_mqtt_upload_api.h:433
aiot_mqtt_upload_setopt 对应参数AIOT_MQTT_UPLOADOPT_FILE_OPTION的结构体
Definition: aiot_mqtt_upload_api.h:514
同名文件已经存在,在追加模式 AIOT_MQTT_UPLOAD_FILE_MODE_APPEND 和拒绝模式 AIOT_MQTT_UPLOAD_FILE_MODE_...
Definition: aiot_mqtt_upload_api.h:306
aiot_mqtt_upload_result_t aiot_mqtt_upload_process(void *handle)
MQTT Upload 处理函数,处理超时和重发逻辑,返回对应文件的执行的状态
Definition: aiot_mqtt_upload_api.c:1627
文件上传过程中,消息限流
Definition: aiot_mqtt_upload_api.h:330
int32_t err_code
云端应答的错误码,参考aiot_mqtt_upload_result_code_t
Definition: aiot_mqtt_upload_api.h:477
重传或网络断开造成文件写入重复,忽略
Definition: aiot_mqtt_upload_api.h:324
上传文件的任务不存在,用户需要发起新的上传请求调用 aiot_mqtt_upload_open_stream
Definition: aiot_mqtt_upload_api.h:300
int32_t aiot_mqtt_upload_setopt(void *handle, aiot_mqtt_upload_option_t option, void *data)
配置MQTT UPLOAD会话
Definition: aiot_mqtt_upload_api.c:1366
int32_t status
通过MQTT通过上传的情况
Definition: aiot_mqtt_upload_api.h:471
aiot_mqtt_upload_result_code_t
请求文件上传和文件传输过程中的服务端返回的文件信息
Definition: aiot_mqtt_upload_api.h:235
收到的服务端应答取消上传的报文应答
Definition: aiot_mqtt_upload_api.h:352
MQTT UPLOAD会话发送消息时,超时重发的最长时间间隔, 数据类型为(uint32_t *)
Definition: aiot_mqtt_upload_api.h:438
文件上传任务已经完成,通知用户对应的文件上传已经完成,销毁对应的upload task释放内存资源 ...
Definition: aiot_mqtt_upload_api.h:312
int32_t(* aiot_mqtt_upload_read_handler_t)(const aiot_mqtt_upload_recv_t *packet, uint8_t *data, uint32_t size, void *userdata)
回调函数读取用户的本地文件或内存数据不能在回调函数中执行 aiot_mqtt_upload_open_stream 和 aiot_mqtt_up...
Definition: aiot_mqtt_upload_api.h:506
int32_t aiot_mqtt_upload_send_data(void *handle, char *file_name, uint8_t *data, uint32_t datalen, uint8_t is_complete)
MQTT Upload 数据发送接口,如果没有配置aiot_mqtt_upload_read_handler_t时,使用该接口发送数据 ...
Definition: aiot_mqtt_upload_api.c:1565
uint32_t file_size
Definition: aiot_mqtt_upload_api.h:517
char * upload_id
服务端应答文件上传请求唯一识别信息,在文件上传的声明周期内uploadId唯一,有效时间24H ...
Definition: aiot_mqtt_upload_api.h:375
aiot_mqtt_upload_result_code_t code
服务端应答的错误编码,对应本次上传的状态
Definition: aiot_mqtt_upload_api.h:390
设备上传文件分片时,当前分片的CRC校验失败,SDK内会自动对当前分片进行重传
Definition: aiot_mqtt_upload_api.h:294
收到的服务端应答上传分片文件时的应答报文消息,通过回调反馈给用户,同时也会调用回调获取下一段分片文件 ...
Definition: aiot_mqtt_upload_api.h:347
char * file_name
服务端应答的文件名信息,用户调用 aiot_mqtt_upload_open_stream 传入的文件名,可用于回调函数中读取文件...
Definition: aiot_mqtt_upload_api.h:364
aiot_mqtt_upload_read_handler_t read_data_handler
Definition: aiot_mqtt_upload_api.h:521
收到的服务端应答请求初始化时的报文信息,通过回调函数反馈给用户
Definition: aiot_mqtt_upload_api.h:342
aiot_mqtt_upload_recv_type_t type
收到服务端应答的报文类型
Definition: aiot_mqtt_upload_api.h:412
char * message
服务端应答,错误码对应的错误信息
Definition: aiot_mqtt_upload_api.h:395
设备上传文件分片时,当前分片的大小小于最小阈值,除最后一片文件外,传输过程中分片大小不得小于256Byte ...
Definition: aiot_mqtt_upload_api.h:288
void * digest
Definition: aiot_mqtt_upload_api.h:519
aiot_mqtt_upload_desc_t desc
收到服务端应答的报文描述信息
Definition: aiot_mqtt_upload_api.h:418
aiot_mqtt_upload_option_t
aiot_mqtt_upload_setopt 接口的option参数可选值.
Definition: aiot_mqtt_upload_api.h:427
aiot_mqtt_upload_process 循环处理,返回对应文件的上传状态给到用户
Definition: aiot_mqtt_upload_api.h:465
配置MQTT文件上传单包发送超时时候的重试次数, 数据类型为(uint32_t *)
Definition: aiot_mqtt_upload_api.h:443
void * aiot_mqtt_upload_init(void)
创建MQTT UPLOAD会话实例, 并以默认值配置会话参数
Definition: aiot_mqtt_upload_api.c:1151
#define MQTT_UPLOAD_DEFAULT_UPLOAD_SIZE
UploadID的数据长度
Definition: aiot_mqtt_upload_api.h:229
uint32_t block_size
本次进行分片上传的分片长度
Definition: aiot_mqtt_upload_api.h:385
void * userdata
Definition: aiot_mqtt_upload_api.h:522
文件上传被限流
Definition: aiot_mqtt_upload_api.h:252
char * extra_params
Definition: aiot_mqtt_upload_api.h:520
文件完整性校验失败,在调用 aiot_mqtt_upload_open_stream 时,如果传入 degist参数服务端会对文件完整性进...
Definition: aiot_mqtt_upload_api.h:318
int32_t aiot_mqtt_upload_cancel_stream(void *handle, char *file_name)
向mqtt_upload服务器请求关闭MQTT通道数据上传命令
Definition: aiot_mqtt_upload_api.c:1527
设备上传文件分片时,分片大小超过阈值128KB
Definition: aiot_mqtt_upload_api.h:276
配置需要上传的文件,数据类型为aiot_mqtt_upload_file_opt_t
Definition: aiot_mqtt_upload_api.h:453
int32_t aiot_mqtt_upload_deinit(void **handle)
结束MQTT UPLOAD会话, 销毁实例并回收资源
Definition: aiot_mqtt_upload_api.c:1181