Link Kit C-SDK  4.1.0
aiot_compress_api.h
浏览该文件的文档.
1 
8 #ifndef __AIOT_COMPRESS_API_H__
9 #define __AIOT_COMPRESS_API_H__
10 
11 #if defined(__cplusplus)
12 extern "C" {
13 #endif
14 
15 #include <stdint.h>
16 
17 /* TODO: 这一段列出compress模块使用的状态码, 每个状态码需要有doxygen的brief说明, 每个码之间有1个空行隔开 */
21 #define STATE_COMPRESS_BASE (-0x2200)
22 
26 #define STATE_COMPRESS_LEVEL_INVALID (-0x2201)
27 
31 #define STATE_COMPRESS_COMPR_FAILED (-0x2202)
32 
36 #define STATE_COMPRESS_DECOMPR_FAILED (-0x2203)
37 
41 #define STATE_COMPRESS_APPEND_REPEATED (-0x2204)
42 
46 typedef enum {
49 
53 typedef struct {
57  aiot_compress_recv_type_t type;
58  union {
62  struct {
63  uint32_t code;
64  char *message;
65  uint32_t message_len;
66  } update_reply;
67  } data;
69 
79 typedef void (* aiot_compress_recv_handler_t)(void *handle,
80  const aiot_compress_recv_t *packet, void *userdata);
81 
88 typedef enum {
99 
110 
119 
128 
137 
146 
149 
158 void *aiot_compress_init(void);
159 
172 int32_t aiot_compress_setopt(void *handle, aiot_compress_option_t option, void *data);
173 
184 int32_t aiot_compress_deinit(void **handle);
185 
186 
197 int32_t aiot_compress_topiclist_update(void *handle);
198 
199 #if defined(__cplusplus)
200 }
201 #endif
202 
203 #endif /* __AIOT_COMPRESS_API_H__ */
204 
void * aiot_compress_init(void)
创建compress会话实例, 并以默认值配置会话参数
Definition: aiot_compress_api.c:264
aiot_compress_option_t
aiot_compress_setopt 接口的option参数可选值.
Definition: aiot_compress_api.h:88
int32_t aiot_compress_deinit(void **handle)
结束compress会话, 销毁实例并回收资源
Definition: aiot_compress_api.c:364
用户需要SDK暂存的上下文
Definition: aiot_compress_api.h:145
添加上行消息中,需要压缩的topic
Definition: aiot_compress_api.h:118
添加下行消息中,需要解压缩的topic
Definition: aiot_compress_api.h:127
char * message
Definition: aiot_compress_api.h:64
Definition: aiot_compress_api.h:147
int32_t aiot_compress_topiclist_update(void *handle)
同步给云平台,需要压缩/解压缩的topic
Definition: aiot_compress_api.c:428
compress模块收到从网络上来的报文时, 通知用户的报文内容
Definition: aiot_compress_api.h:53
uint32_t message_len
Definition: aiot_compress_api.h:65
模块依赖的MQTT句柄,为该MQTT句柄连接提供压缩能力
Definition: aiot_compress_api.h:98
Definition: aiot_compress_api.h:47
int32_t aiot_compress_setopt(void *handle, aiot_compress_option_t option, void *data)
配置compress模块参数
Definition: aiot_compress_api.c:292
压缩等级设置,等级越高压缩率越高,消耗的内存和时间也更多
Definition: aiot_compress_api.h:109
uint32_t code
Definition: aiot_compress_api.h:63
设置回调, 它在SDK收到网络报文的时候被调用, 告知用户
Definition: aiot_compress_api.h:136
void(* aiot_compress_recv_handler_t)(void *handle, const aiot_compress_recv_t *packet, void *userdata)
compress模块收到从网络上来的报文时, 通知用户所调用的数据回调函数
Definition: aiot_compress_api.h:79
aiot_compress_recv_type_t type
报文内容所对应的报文类型, 更多信息请参考aiot_compress_recv_type_t
Definition: aiot_compress_api.h:57
aiot_compress_recv_type_t
compress模块收到从网络上来的报文时, 通知用户的报文类型
Definition: aiot_compress_api.h:46