| 
    Link Kit C-SDK
    4.1.0
    
   | 
 
远程隧道的开关的实现文件,实现mqtt消息的订阅及解析 更多...
#include <stdint.h>

类 | |
| struct | aiot_tunnel_switch_recv_data_t | 
类型定义 | |
| typedef void(* | aiot_tunnel_switch_recv_handler_t) (void *handle, const aiot_tunnel_switch_recv_data_t *recv, void *userdata) | 
| tunnel_swtich模块消息接收回调函数的函数原型定义, 当模块接收到服务器下行数据后将调用此回调函数, 并将消息数据通过recv参数输入给用户,  同时将用户上下文数据指针通过userdata参数返回给用户 更多...  | |
函数 | |
| void * | aiot_tunnel_switch_init () | 
| 初始化tunnel_switch实例  更多... | |
| int32_t | aiot_tunnel_switch_setopt (void *handle, aiot_tunnel_switch_option_t option, void *data) | 
| 设置tunnel_switch参数  更多... | |
| int32_t | aiot_tunnel_switch_deinit (void **handle) | 
| 销毁tunnel_switch实例, 释放资源  更多... | |
| int32_t | aiot_tunnel_switch_request (void *handle) | 
| 发送获取隧道信息  更多... | |
远程隧道的开关的实现文件,实现mqtt消息的订阅及解析
| typedef void(* aiot_tunnel_switch_recv_handler_t) (void *handle, const aiot_tunnel_switch_recv_data_t *recv, void *userdata) | 
tunnel_swtich模块消息接收回调函数的函数原型定义, 当模块接收到服务器下行数据后将调用此回调函数, 并将消息数据通过recv参数输入给用户, 
同时将用户上下文数据指针通过userdata参数返回给用户 
| [in] | handle | tunnel_switch实例句柄 | 
| [in] | recv | 服务下发的消息数据, 消息结构体中的所有数据指针在离开回调函数后将失效, 保存消息数据必须使用内存复制的方式 | 
| [in] | userdata | 指向用户上下文数据的指针, 这个指针由用户通过调用aiot_tunnel_switch_option_t 配置AIOT_TSOPT_USERDATA 选项设置 | 
| 枚举值 | |
|---|---|
| AIOT_TSOPT_MQTT_HANDLE | 
 模块依赖的MQTT句柄 tunnel_switch模块依赖底层的MQTT模块, 用户必需配置正确的MQTT句柄, 否则无法正常工作 数据类型: (void *)  | 
| AIOT_TSOPT_RECV_HANDLER | 
 数据接收回调函数, tunnel_switch接收物联网平台的下行消息后调用此回调函数 数据类型: (aiot_tunnel_switch_recv_handler_t), 详细查看aiot_tunnel_switch_recv_handler_t 回调函数原型  | 
| AIOT_TSOPT_USERDATA | 
 指向用户上下文数据的指针 在用户注册的aiot_tunnel_switch_recv_handler_t 数据接收回调函数中会同过userdata参数将此指针返回给用户 数据类型: (void *)  | 
| AIOT_TSOPT_MAX | 
 配置选项数量最大值, 不可用作配置参数  | 
| void* aiot_tunnel_switch_init | ( | ) | 
初始化tunnel_switch实例
| 非NULL | tunnel_switch实例句柄 | 
| NULL | 初始化失败, 一般是内存分配失败导致 | 

| int32_t aiot_tunnel_switch_setopt | ( | void * | handle, | 
| aiot_tunnel_switch_option_t | option, | ||
| void * | data | ||
| ) | 
设置tunnel_switch参数
| [in] | handle | tunnel_switch实例句柄 | 
| [in] | option | 配置选项, 更多信息请查看aiot_tunnel_switch_option_t | 
| [in] | data | 配置数据, 更多信息请查看aiot_tunnel_switch_option_t | 
| STATE_SUCCESS | 参数配置成功 | 
| others | 参考aiot_state_api.h | 

| int32_t aiot_tunnel_switch_deinit | ( | void ** | handle | ) | 
销毁tunnel_switch实例, 释放资源
| [in] | handle | 指向tunnel_switch实例句柄的指针 | 
| STATE_SUCCESS | 执行成功 | 
| <STATE_SUCCESS | 执行失败 | 

| int32_t aiot_tunnel_switch_request | ( | void * | handle | ) | 
发送获取隧道信息
| [in] | handle | 指向tunnel_switch实例句柄 | 
| STATE_SUCCESS | 执行成功 | 
| <STATE_SUCCESS | 执行失败 | 

 1.8.11