Link Kit C-SDK  4.1.0
aiot_bootstrap_api.h
浏览该文件的文档.
1 
9 #ifndef _AIOT_BOOTSTRAP_API_H_
10 #define _AIOT_BOOTSTRAP_API_H_
11 
12 #if defined(__cplusplus)
13 extern "C" {
14 #endif
15 
16 #include <stdint.h>
17 
21 #define STATE_BOOTSTRAP_BASE (-0x0700)
22 
26 #define STATE_BOOTSTRAP_DEINIT_TIMEOUT (-0x0701)
27 
31 #define STATE_BOOTSTRAP_NEED_SEND_REQUEST (-0x0702)
32 
36 #define STATE_BOOTSTRAP_INVALID_STATUS_CODE (-0x0703)
37 
41 #define STATE_BOOTSTRAP_INVALID_CONNECTION_INFO (-0x0704)
42 
46 #define STATE_BOOTSTRAP_PUB_REQUEST_FAILED (-0x0705)
47 
55 typedef enum {
69 
73 typedef struct {
77  aiot_bootstrap_recv_type_t type;
81  union {
85  struct {
86  uint32_t code;
87  } status_code;
91  struct {
92  char *host;
93  uint16_t port;
94  } connection_info;
95  struct {
96  uint32_t cmd;
97  } notify;
98  } data;
100 
110 typedef void (*aiot_bootstrap_recv_handler_t)(void *handle, const aiot_bootstrap_recv_t *packet, void *userdata);
111 
115 typedef enum {
125 
129 typedef struct {
134  aiot_bootstrap_event_type_t type;
136 
145 typedef void (*aiot_bootstrap_event_handler_t)(void *handle, const aiot_bootstrap_event_t *event, void *userdata);
146 
147 typedef enum {
156 
169 
184 
197 
206 
215 
238 
247 
256 
266 
275 
286 
295 
310 
319 void *aiot_bootstrap_init(void);
320 
333 int32_t aiot_bootstrap_setopt(void *handle, aiot_bootstrap_option_t option, void *data);
334 
345 int32_t aiot_bootstrap_deinit(void **handle);
346 
356 int32_t aiot_bootstrap_send_request(void *handle);
357 
367 int32_t aiot_bootstrap_recv(void *handle);
368 
369 #if defined(__cplusplus)
370 }
371 #endif
372 
373 #endif
374 
bootstrap 服务器的域名地址或者ip地址
Definition: aiot_bootstrap_api.h:183
用户需要SDK暂存的上下文
Definition: aiot_bootstrap_api.h:285
bootstrap 服务器返回的http status code
Definition: aiot_bootstrap_api.h:59
收到的bootstrap应答中字段不合法
Definition: aiot_bootstrap_api.h:119
aiot_bootstrap_option_t
Definition: aiot_bootstrap_api.h:147
uint32_t cmd
Definition: aiot_bootstrap_api.h:96
void(* aiot_bootstrap_event_handler_t)(void *handle, const aiot_bootstrap_event_t *event, void *userdata)
bootstrap事件回调函数
Definition: aiot_bootstrap_api.h:145
aiot_bootstrap_recv_type_t type
bootstrap报文类型, 更多信息请参考aiot_bootstrap_recv_type_t
Definition: aiot_bootstrap_api.h:77
bootstrap 服务器的端口号
Definition: aiot_bootstrap_api.h:196
char * host
Definition: aiot_bootstrap_api.h:92
bootstrap会话需要的MQTT句柄, 需要先建立MQTT连接, 再设置MQTT句柄
Definition: aiot_bootstrap_api.h:155
等待bootstrap应答的超时时间
Definition: aiot_bootstrap_api.h:294
设备的device name, 可从阿里云物联网平台控制台获取
Definition: aiot_bootstrap_api.h:214
int32_t aiot_bootstrap_setopt(void *handle, aiot_bootstrap_option_t option, void *data)
设置bootstrap参数
Definition: aiot_bootstrap_api.c:358
配置设备所在的regionId
Definition: aiot_bootstrap_api.h:237
bootstrap接收到的数据
Definition: aiot_bootstrap_api.h:73
Definition: aiot_bootstrap_api.h:308
int32_t aiot_bootstrap_send_request(void *handle)
向bootstrap服务器发送请求
Definition: aiot_bootstrap_api.c:538
bootstrap内部发生的事件会从此回调函数进行通知
Definition: aiot_bootstrap_api.h:274
设备的product key, 可从阿里云物联网平台控制台获取
Definition: aiot_bootstrap_api.h:205
bootstrap会话接收消息时可消费的最长时间间隔
Definition: aiot_bootstrap_api.h:255
aiot_bootstrap_event_type_t type
bootstrap内部事件类型. 更多信息请参考aiot_bootstrap_event_type_t
Definition: aiot_bootstrap_api.h:134
void * aiot_bootstrap_init(void)
初始化bootstrap实例并设置默认参数
Definition: aiot_bootstrap_api.c:316
物联网平台连接信息, 包含域名和端口号
Definition: aiot_bootstrap_api.h:63
int32_t aiot_bootstrap_deinit(void **handle)
释放bootstrap实例句柄的资源
Definition: aiot_bootstrap_api.c:464
收到的bootstrap应答中cmd字段格式错误
Definition: aiot_bootstrap_api.h:123
aiot_bootstrap_recv_type_t
bootstrap报文类型
Definition: aiot_bootstrap_api.h:55
销毁Bootstrap实例时, 等待其他api执行完毕的时间
Definition: aiot_bootstrap_api.h:307
aiot_bootstrap_event_type_t
bootstrap内部事件类型
Definition: aiot_bootstrap_api.h:115
bootstrap 服务器建联时, 网络使用的安全凭据
Definition: aiot_bootstrap_api.h:168
uint32_t code
Definition: aiot_bootstrap_api.h:86
bootstrap会话发送消息时可消费的最长时间间隔
Definition: aiot_bootstrap_api.h:246
int32_t aiot_bootstrap_recv(void *handle)
从bootstrap服务器接收应答
Definition: aiot_bootstrap_api.c:631
uint16_t port
Definition: aiot_bootstrap_api.h:93
bootstrap内部事件
Definition: aiot_bootstrap_api.h:129
void(* aiot_bootstrap_recv_handler_t)(void *handle, const aiot_bootstrap_recv_t *packet, void *userdata)
bootstrap数据接收回调函数原型
Definition: aiot_bootstrap_api.h:110
bootstrap通知信息
Definition: aiot_bootstrap_api.h:67
从 bootstrap 服务器收取的数据从此回调函数进行通知
Definition: aiot_bootstrap_api.h:265