Link Kit C-SDK
4.1.0
|
logpost模块的API接口实现, 提供设备端日志上云的能力 更多...
#include "logpost_private.h"
#include "core_string.h"
#include "core_log.h"
#include "core_mqtt.h"
#include "core_global.h"
#include "aiot_mqtt_api.h"
宏定义 | |
#define | LOGPOST_JSON_KEY_MODE "mode" |
函数 | |
static void | _logpost_config_data_handler (void *handle, const aiot_mqtt_recv_t *msg, void *userdata) |
static void | _logpost_get_config (logpost_handle_t *logpost_handle) |
int32_t | _logpost_send_nwkstats_rtt (logpost_handle_t *handle) |
int32_t | _logpost_send_nwkstats_conn (logpost_handle_t *handle) |
int32_t | _should_report_sys_log (logpost_handle_t *logpost_handle, char *module_name) |
void | _logpost_process_handler (void *context, aiot_mqtt_event_t *event, core_mqtt_event_t *core_event) |
void * | aiot_logpost_init (void) |
创建logpost会话实例, 并以默认值配置会话参数 更多... | |
int32_t | aiot_logpost_setopt (void *handle, aiot_logpost_option_t option, void *data) |
配置logpost会话 更多... | |
int32_t | aiot_logpost_send (void *handle, aiot_logpost_msg_t *msg) |
向服务器发送日志消息 更多... | |
int32_t | aiot_logpost_deinit (void **p_handle) |
结束logpost会话, 销毁实例并回收资源 更多... | |
变量 | |
const char * | logpost_loglevel [] |
logpost模块的API接口实现, 提供设备端日志上云的能力
#define LOGPOST_JSON_KEY_MODE "mode" |
|
static |
|
static |
int32_t _logpost_send_nwkstats_rtt | ( | logpost_handle_t * | handle | ) |
int32_t _logpost_send_nwkstats_conn | ( | logpost_handle_t * | handle | ) |
int32_t _should_report_sys_log | ( | logpost_handle_t * | logpost_handle, |
char * | module_name | ||
) |
void _logpost_process_handler | ( | void * | context, |
aiot_mqtt_event_t * | event, | ||
core_mqtt_event_t * | core_event | ||
) |
void* aiot_logpost_init | ( | void | ) |
创建logpost会话实例, 并以默认值配置会话参数
非NULL | logpost实例的句柄 |
NULL | 初始化失败, 一般是内存分配失败导致 |
int32_t aiot_logpost_setopt | ( | void * | handle, |
aiot_logpost_option_t | option, | ||
void * | data | ||
) |
配置logpost会话
[in] | handle | logpost会话句柄 |
[in] | option | 配置选项, 更多信息请参考aiot_logpost_option_t |
[in] | data | 配置选项数据, 更多信息请参考aiot_logpost_option_t |
<STATE_SUCCESS | 参数配置失败 |
STATE_SUCCESS | 参数配置成功 |
STATE_USER_INPUT_NULL_POINTER | 入参handle或data为NULL |
STATE_USER_INPUT_OUT_RANGE | 入参optioin的枚举值>=AIOT_LOGPOSTOPT_MAX |
others | 参考aiot_state_api.h |
int32_t aiot_logpost_send | ( | void * | handle, |
aiot_logpost_msg_t * | msg | ||
) |
向服务器发送日志消息
[in] | handle | logpost会话句柄 |
[in] | msg | 消息结构体, 可指定日志对应模块, 日志级别等, 更多信息请参考aiot_logpost_msg_t |
STATE_SUCCESS | 请求发送成功 |
STATE_USER_INPUT_NULL_POINTER | 入参handle或msg为NULL |
STATE_SYS_DEPEND_MALLOC_FAILED | 内存分配失败 |
STATE_LOGPOST_MQTT_HANDLE_IS_NULL | 用户未调用aiot_logpost_setopt 配置MQTT句柄 |
others | 参考aiot_state_api.h 或STATE_SHADOW_BASE 中对应的错误码说明 |
int32_t aiot_logpost_deinit | ( | void ** | handle | ) |
结束logpost会话, 销毁实例并回收资源
[in] | handle | 指向logpost会话句柄的指针 |
<STATE_SUCCESS | 执行失败 |
>=STATE_SUCCESS | 执行成功 |
const char* logpost_loglevel[] |