|
Link Kit C-SDK
4.1.0
|
shadow模块的API接口实现, 提供更新, 删除, 获取设备影子的能力 更多...
#include "shadow_private.h"#include "core_string.h"#include "core_log.h"#include "core_global.h"#include "core_mqtt.h"
函数 | |
| static int32_t | _shadow_get_pk_dn (aiot_sysdep_portfile_t *sysdep, char *topic, uint16_t topic_len, char **product_key, char **device_name) |
| int32_t | _shadow_int642str (int64_t input, char *output, uint8_t *output_len) |
| static void | _shadow_recv_message_handler (void *handle, const aiot_mqtt_recv_t *msg, void *userdata) |
| static void | _shadow_core_mqtt_process_handler (void *context, aiot_mqtt_event_t *event, core_mqtt_event_t *core_event) |
| static int32_t | _shadow_core_mqtt_operate_process_handler (shadow_handle_t *shadow_handle, core_mqtt_option_t option) |
| void * | aiot_shadow_init (void) |
| 创建shadow会话实例, 并以默认值配置会话参数 更多... | |
| int32_t | aiot_shadow_setopt (void *handle, aiot_shadow_option_t option, void *data) |
| 配置shadow会话 更多... | |
| int32_t | aiot_shadow_send (void *handle, aiot_shadow_msg_t *msg) |
| 向服务器发送shadow消息请求 更多... | |
| int32_t | aiot_shadow_deinit (void **p_handle) |
| 结束shadow会话, 销毁实例并回收资源 更多... | |
shadow模块的API接口实现, 提供更新, 删除, 获取设备影子的能力
|
static |
| int32_t _shadow_int642str | ( | int64_t | input, |
| char * | output, | ||
| uint8_t * | output_len | ||
| ) |
|
static |

|
static |
|
static |

| void* aiot_shadow_init | ( | void | ) |
创建shadow会话实例, 并以默认值配置会话参数
| 非NULL | shadow实例的句柄 |
| NULL | 初始化失败, 一般是内存分配失败导致 |

| int32_t aiot_shadow_setopt | ( | void * | handle, |
| aiot_shadow_option_t | option, | ||
| void * | data | ||
| ) |
配置shadow会话
| [in] | handle | shadow会话句柄 |
| [in] | option | 配置选项, 更多信息请参考aiot_shadow_option_t |
| [in] | data | 配置选项数据, 更多信息请参考aiot_shadow_option_t |
| STATE_SUCCESS | 参数配置成功 |
| STATE_USER_INPUT_NULL_POINTER | 入参handle或data为NULL |
| STATE_USER_INPUT_OUT_RANGE | 入参optioin的枚举值>=AIOT_SHADOWOPT_MAX |
| others | 参考aiot_state_api.h |

| int32_t aiot_shadow_send | ( | void * | handle, |
| aiot_shadow_msg_t * | msg | ||
| ) |
向服务器发送shadow消息请求
| [in] | handle | shadow会话句柄 |
| [in] | msg | 消息结构体, 可指定发送消息的设备productKey, deviceName; 消息类型, 消息数据等, 更多信息请参考aiot_shadow_msg_t |
| STATE_SUCCESS | 请求发送成功 |
| STATE_USER_INPUT_NULL_POINTER | 入参handle或msg为NULL |
| STATE_USER_INPUT_OUT_RANGE | 入参msg的结构体成员type >= AIOT_SHADOWMSG_MAX |
| STATE_SYS_DEPEND_MALLOC_FAILED | 内存分配失败 |
| STATE_SHADOW_MQTT_HANDLE_IS_NULL | 用户未调用aiot_shadow_setopt 配置MQTT句柄 |
| others | 参考aiot_state_api.h 或STATE_SHADOW_BASE 中对应的错误码说明 |

| int32_t aiot_shadow_deinit | ( | void ** | handle | ) |
结束shadow会话, 销毁实例并回收资源
| [in] | handle | 指向shadow会话句柄的指针 |
| STATE_SUCCESS | 执行成功 |
| <STATE_SUCCESS | 执行失败 |

1.8.11