Link Kit C-SDK  4.0.0
aiot_diag_api.h
浏览该文件的文档.
1 
8 #ifndef __AIOT_DIAG_API_H__
9 #define __AIOT_DIAG_API_H__
10 
11 #if defined(__cplusplus)
12 extern "C" {
13 #endif
14 
15 #include <stdint.h>
16 
20 #define STATE_DIAG_BASE (-0x1400)
21 
25 #define STATE_DIAG_LOG_UNKNOWN_STATE_CODE_BASE (-0x1401)
26 
30 #define STATE_DIAG_CODE2 (-0x1402)
31 
35 #define STATE_DIAG_PUB_FAILED (-0x1403)
36 
40 typedef enum {
43 
47 typedef struct {
51  aiot_diag_recv_type_t type;
52  union {
56  struct {
60  uint32_t data;
61  } diag_control;
62  } data;
64 
74 typedef void (* aiot_diag_recv_handler_t)(void *handle, const aiot_diag_recv_t *packet, void *userdata);
75 
79 typedef enum {
85 
89 typedef struct {
93  aiot_diag_event_type_t type;
94  union {
95  struct {
99  char *module_name;
103  char *level;
107  char *desc;
108  } alert;
109  } data;
111 
121 typedef void (*aiot_diag_event_handler_t)(void *handle, const aiot_diag_event_t *event, void *userdata);
122 
126 typedef struct {
134  uint8_t enabled;
138  uint32_t interval_ms;
148 
164 typedef enum {
173 
184 
195 
204 
213 
222 
231 
240 
251 
260 void *aiot_diag_init(void);
261 
274 int32_t aiot_diag_setopt(void *handle, aiot_diag_option_t option, void *data);
275 
286 int32_t aiot_diag_deinit(void **handle);
287 
297 int32_t aiot_diag_start(void *handle);
298 
308 int32_t aiot_diag_stop(void *handle);
309 
310 #if defined(__cplusplus)
311 }
312 #endif
313 
314 #endif /* __AIOT_DIAG_API_H__ */
315 
int32_t aiot_diag_stop(void *handle)
停止诊断SDK内部信息
Definition: aiot_diag_api.c:749
MQTT建联时长告警配置
Definition: aiot_diag_api.h:203
diag内部发生的事件会从此回调函数进行通知
Definition: aiot_diag_api.h:239
是否需要上报告警信息至云端
Definition: aiot_diag_api.h:194
diag模块收到从网络上来的报文时, 通知用户的报文内容
Definition: aiot_diag_api.h:47
aiot_diag_event_type_t
diag模块内部发生值得用户关注的状态变化时, 通知用户的事件类型
Definition: aiot_diag_api.h:79
Definition: aiot_diag_api.h:41
Definition: aiot_diag_api.h:249
uint32_t data
0: 关闭诊断功能,1: 打开诊断功能
Definition: aiot_diag_api.h:60
int64_t fatal_threshold
fatal级别告警的阈值
Definition: aiot_diag_api.h:146
diag会话 需要的MQTT句柄, 需要先建立MQTT连接, 再设置MQTT句柄
Definition: aiot_diag_api.h:172
Alink协议上行报文的回复速度告警配置
Definition: aiot_diag_api.h:221
char * level
告警级别
Definition: aiot_diag_api.h:103
诊断项的配置参数
Definition: aiot_diag_api.h:126
int64_t warning_threashold
warning级别告警的阈值
Definition: aiot_diag_api.h:142
diag模块内部发生值得用户关注的状态变化时, 通知用户的事件内容
Definition: aiot_diag_api.h:89
设置回调, 它在SDK收到网络报文的时候被调用, 告知用户
Definition: aiot_diag_api.h:230
是否需要从事件回调函数中输出告警信息
Definition: aiot_diag_api.h:183
char * desc
告警信息描述字符串
Definition: aiot_diag_api.h:107
void * aiot_diag_init(void)
创建diag会话实例, 并以默认值配置会话参数
Definition: aiot_diag_api.c:565
int32_t aiot_diag_setopt(void *handle, aiot_diag_option_t option, void *data)
配置diag会话
Definition: aiot_diag_api.c:614
uint32_t interval_ms
对当前诊断项连续两次告警的最小时间间隔
Definition: aiot_diag_api.h:138
char * module_name
告警模块名
Definition: aiot_diag_api.h:99
int32_t aiot_diag_start(void *handle)
开始诊断SDK内部信息
Definition: aiot_diag_api.c:734
int32_t aiot_diag_deinit(void **handle)
结束diag会话, 销毁实例并回收资源
Definition: aiot_diag_api.c:689
aiot_diag_option_t
aiot_diag_setopt 接口的option参数可选值.
Definition: aiot_diag_api.h:164
uint8_t enabled
对当前诊断项是否进行诊断的开关
Definition: aiot_diag_api.h:134
aiot_diag_event_type_t type
事件内容所对应的事件类型, 更多信息请参考aiot_diag_event_type_t
Definition: aiot_diag_api.h:93
void(* aiot_diag_recv_handler_t)(void *handle, const aiot_diag_recv_t *packet, void *userdata)
diag模块收到从网络上来的报文时, 通知用户所调用的数据回调函数
Definition: aiot_diag_api.h:74
void(* aiot_diag_event_handler_t)(void *handle, const aiot_diag_event_t *event, void *userdata)
diag模块内部发生值得用户关注的状态变化时, 通知用户所调用的事件回调函数
Definition: aiot_diag_api.h:121
MQTT心跳丢失告警配置
Definition: aiot_diag_api.h:212
诊断模块产生的告警信息
Definition: aiot_diag_api.h:83
用户需要SDK暂存的上下文
Definition: aiot_diag_api.h:248
aiot_diag_recv_type_t
diag模块收到从网络上来的报文时, 通知用户的报文类型
Definition: aiot_diag_api.h:40
aiot_diag_recv_type_t type
报文内容所对应的报文类型, 更多信息请参考aiot_diag_recv_type_t
Definition: aiot_diag_api.h:51