Link Kit C-SDK  4.1.0
函数 | 变量
aiot_dm_api.c 文件参考

数据模型模块接口实现文件, 包含了支持物模型数据格式通信的所有接口实现 更多...

#include "dm_private.h"
aiot_dm_api.c 的引用(Include)关系图:

函数

static int32_t _dm_send_property_post (dm_handle_t *handle, const char *topic, const aiot_dm_msg_t *msg)
 
static int32_t _dm_send_event_post (dm_handle_t *handle, const char *topic, const aiot_dm_msg_t *msg)
 
static int32_t _dm_send_property_set_reply (dm_handle_t *handle, const char *topic, const aiot_dm_msg_t *msg)
 
static int32_t _dm_send_async_service_reply (dm_handle_t *handle, const char *topic, const aiot_dm_msg_t *msg)
 
static int32_t _dm_send_sync_service_reply (dm_handle_t *handle, const char *topic, const aiot_dm_msg_t *msg)
 
static int32_t _dm_send_raw_data (dm_handle_t *handle, const char *topic, const aiot_dm_msg_t *msg)
 
static int32_t _dm_send_raw_service_reply (dm_handle_t *handle, const char *topic, const aiot_dm_msg_t *msg)
 
static int32_t _dm_send_desired_get (dm_handle_t *handle, const char *topic, const aiot_dm_msg_t *msg)
 
static int32_t _dm_send_desired_delete (dm_handle_t *handle, const char *topic, const aiot_dm_msg_t *msg)
 
static int32_t _dm_send_property_batch_post (dm_handle_t *handle, const char *topic, const aiot_dm_msg_t *msg)
 
static void _dm_recv_generic_reply_handler (void *handle, const aiot_mqtt_recv_t *msg, void *userdata)
 
static void _dm_recv_property_set_handler (void *handle, const aiot_mqtt_recv_t *msg, void *userdata)
 
static void _dm_recv_async_service_invoke_handler (void *handle, const aiot_mqtt_recv_t *msg, void *userdata)
 
static void _dm_recv_sync_service_invoke_handler (void *handle, const aiot_mqtt_recv_t *msg, void *userdata)
 
static void _dm_recv_raw_data_handler (void *handle, const aiot_mqtt_recv_t *msg, void *userdata)
 
static void _dm_recv_raw_sync_service_invoke_handler (void *handle, const aiot_mqtt_recv_t *msg, void *userdata)
 
static void _dm_recv_up_raw_reply_data_handler (void *handle, const aiot_mqtt_recv_t *msg, void *userdata)
 
static void _append_diag_data (dm_handle_t *dm_handle, uint8_t msg_type, int32_t msg_id)
 
static int32_t _dm_setup_topic_mapping (void *mqtt_handle, void *dm_handle)
 
static int32_t _dm_prepare_send_topic (dm_handle_t *dm_handle, const aiot_dm_msg_t *msg, char **topic)
 
static int32_t _dm_send_alink_req (dm_handle_t *handle, const char *topic, char *params)
 
static int32_t _dm_send_alink_rsp (dm_handle_t *handle, const char *topic, uint64_t msg_id, uint32_t code, char *data)
 
static int32_t _dm_get_topic_level (aiot_sysdep_portfile_t *sysdep, char *topic, uint32_t topic_len, uint8_t level, char **level_name)
 
static int32_t _dm_parse_alink_request (const char *payload, uint32_t payload_len, uint64_t *msg_id, char **params, uint32_t *params_len)
 
static void _dm_core_mqtt_process_handler (void *context, aiot_mqtt_event_t *event, core_mqtt_event_t *core_event)
 
static int32_t _dm_core_mqtt_operate_process_handler (dm_handle_t *dm_handle, core_mqtt_option_t option)
 
void * aiot_dm_init (void)
 初始化data-model实例 更多...
 
int32_t aiot_dm_setopt (void *handle, aiot_dm_option_t option, void *data)
 设置data-model参数 更多...
 
int32_t aiot_dm_send (void *handle, const aiot_dm_msg_t *msg)
 发送一条data-model消息到物联网平台, 消息类型和消息数据由msg入参决定 更多...
 
int32_t aiot_dm_deinit (void **p_handle)
 销毁data-model实例, 释放资源 更多...
 

变量

static const dm_send_topic_map_t g_dm_send_topic_mapping [AIOT_DMMSG_MAX]
 
static const dm_recv_topic_map_t g_dm_recv_topic_mapping []
 

详细描述

数据模型模块接口实现文件, 包含了支持物模型数据格式通信的所有接口实现

日期
2020-01-20

函数说明

static int32_t _dm_send_property_post ( dm_handle_t *  handle,
const char *  topic,
const aiot_dm_msg_t msg 
)
static

函数调用图:

static int32_t _dm_send_event_post ( dm_handle_t *  handle,
const char *  topic,
const aiot_dm_msg_t msg 
)
static

函数调用图:

static int32_t _dm_send_property_set_reply ( dm_handle_t *  handle,
const char *  topic,
const aiot_dm_msg_t msg 
)
static

函数调用图:

static int32_t _dm_send_async_service_reply ( dm_handle_t *  handle,
const char *  topic,
const aiot_dm_msg_t msg 
)
static

函数调用图:

static int32_t _dm_send_sync_service_reply ( dm_handle_t *  handle,
const char *  topic,
const aiot_dm_msg_t msg 
)
static

函数调用图:

static int32_t _dm_send_raw_data ( dm_handle_t *  handle,
const char *  topic,
const aiot_dm_msg_t msg 
)
static

函数调用图:

static int32_t _dm_send_raw_service_reply ( dm_handle_t *  handle,
const char *  topic,
const aiot_dm_msg_t msg 
)
static

函数调用图:

static int32_t _dm_send_desired_get ( dm_handle_t *  handle,
const char *  topic,
const aiot_dm_msg_t msg 
)
static

函数调用图:

static int32_t _dm_send_desired_delete ( dm_handle_t *  handle,
const char *  topic,
const aiot_dm_msg_t msg 
)
static

函数调用图:

static int32_t _dm_send_property_batch_post ( dm_handle_t *  handle,
const char *  topic,
const aiot_dm_msg_t msg 
)
static

函数调用图:

static void _dm_recv_generic_reply_handler ( void *  handle,
const aiot_mqtt_recv_t msg,
void *  userdata 
)
static

函数调用图:

static void _dm_recv_property_set_handler ( void *  handle,
const aiot_mqtt_recv_t msg,
void *  userdata 
)
static

函数调用图:

static void _dm_recv_async_service_invoke_handler ( void *  handle,
const aiot_mqtt_recv_t msg,
void *  userdata 
)
static

函数调用图:

static void _dm_recv_sync_service_invoke_handler ( void *  handle,
const aiot_mqtt_recv_t msg,
void *  userdata 
)
static

函数调用图:

static void _dm_recv_raw_data_handler ( void *  handle,
const aiot_mqtt_recv_t msg,
void *  userdata 
)
static

函数调用图:

static void _dm_recv_raw_sync_service_invoke_handler ( void *  handle,
const aiot_mqtt_recv_t msg,
void *  userdata 
)
static

函数调用图:

static void _dm_recv_up_raw_reply_data_handler ( void *  handle,
const aiot_mqtt_recv_t msg,
void *  userdata 
)
static

函数调用图:

static void _append_diag_data ( dm_handle_t *  dm_handle,
uint8_t  msg_type,
int32_t  msg_id 
)
static
static int32_t _dm_setup_topic_mapping ( void *  mqtt_handle,
void *  dm_handle 
)
static

函数调用图:

static int32_t _dm_prepare_send_topic ( dm_handle_t *  dm_handle,
const aiot_dm_msg_t msg,
char **  topic 
)
static

函数调用图:

static int32_t _dm_send_alink_req ( dm_handle_t *  handle,
const char *  topic,
char *  params 
)
static

函数调用图:

static int32_t _dm_send_alink_rsp ( dm_handle_t *  handle,
const char *  topic,
uint64_t  msg_id,
uint32_t  code,
char *  data 
)
static

函数调用图:

static int32_t _dm_get_topic_level ( aiot_sysdep_portfile_t sysdep,
char *  topic,
uint32_t  topic_len,
uint8_t  level,
char **  level_name 
)
static
static int32_t _dm_parse_alink_request ( const char *  payload,
uint32_t  payload_len,
uint64_t *  msg_id,
char **  params,
uint32_t *  params_len 
)
static
static void _dm_core_mqtt_process_handler ( void *  context,
aiot_mqtt_event_t event,
core_mqtt_event_t *  core_event 
)
static
static int32_t _dm_core_mqtt_operate_process_handler ( dm_handle_t *  dm_handle,
core_mqtt_option_t  option 
)
static

函数调用图:

void* aiot_dm_init ( void  )

初始化data-model实例

返回
void*
返回值
非NULLdata-model实例句柄
NULL初始化失败, 一般是内存分配失败导致

函数调用图:

int32_t aiot_dm_setopt ( void *  handle,
aiot_dm_option_t  option,
void *  data 
)

设置data-model参数

参数
[in]handledata-model实例句柄
[in]option配置选项, 更多信息请查看aiot_dm_option_t
[in]data配置数据, 更多信息请查看aiot_dm_option_t
返回
int32_t
返回值
STATE_SUCCESS参数配置成功
STATE_USER_INPUT_NULL_POINTER入参handle或data为NULL
STATE_USER_INPUT_OUT_RANGE入参optioin的枚举值>=AIOT_DMOPT_MAX
others参考aiot_state_api.h

函数调用图:

int32_t aiot_dm_send ( void *  handle,
const aiot_dm_msg_t msg 
)

发送一条data-model消息到物联网平台, 消息类型和消息数据由msg入参决定

参数
[in]handledata-model实例句柄
[in]msg消息结构体, 可指定发送消息的设备productKey, deviceName; 消息类型, 消息数据等, 更多信息请参考aiot_dm_msg_t
返回
int32_t
返回值
>=STATE_SUCCESS消息发送成功, 对于AIOT_DMMSG_PROPERTY_POST, AIOT_DMMSG_EVENT_POST, AIOT_DMMSG_GET_DESIREDAIOT_DMMSG_DELETE_DESIRED 消息,
发送成功返回值为>STATE_SUCCESS的消息标示符msg_id
STATE_USER_INPUT_NULL_POINTER入参handlemsg为NULL
STATE_USER_INPUT_OUT_RANGE入参msg的结构体成员type >= AIOT_DMMSG_MAX
STATE_SYS_DEPEND_MALLOC_FAILED内存分配失败
STATE_DM_MQTT_HANDLE_IS_NULL用户未调用aiot_dm_setopt 配置MQTT句柄
others参考aiot_state_api.hSTATE_DM_BASE 中对应的错误码说明

函数调用图:

int32_t aiot_dm_deinit ( void **  p_handle)

销毁data-model实例, 释放资源

参数
[in]p_handle指向data-model实例句柄的指针
返回
int32_t
返回值
STATE_SUCCESS执行成功
<STATE_SUCCESS执行失败

函数调用图:

变量说明

const dm_send_topic_map_t g_dm_send_topic_mapping[AIOT_DMMSG_MAX]
static
const dm_recv_topic_map_t g_dm_recv_topic_mapping[]
static