云端 AI 检测 & 视频消息

更新时间:2025-07-04 03:08:49下载pdf

涂鸦云通过先进的 AI 智能分析功能,实现目标对象的精准识别,包括但不限于小鸟、包裹等。此外,App 的消息中心提供以视频形式直观展示检测结果的功能,能够显著提升用户的使用体验。

开发指导

详见 ty_sdk_motion_detect.c

API 说明

初始化

/**
 * @brief        rule module init
 * @param[in]    result_cb callback of cloud result
 * @param[in]    video_msg_cb  callback of video ms
 * @return       error code
 * - OPRT_OK     success
 * - Others      fail
 */
OPERATE_RET tuya_ipc_rule_init(IN RULE_AI_RESULT_CB ai_result_cb, IN RULE_VIDEO_MSG_CB video_msg_cb);

参数说明

参数 说明
ai_result_cb 云端 AI 检测结果
video_msg_cb 视频消息结果

事件触发

事件触发后,设备向云端上报图片、视频等,用以检测目标。

/**
 * @brief        trigger event for rule module
 * @param[in]    event refer to NOTIFICATION_NAME_E
 * @param[out]   sn  event identification. used to distinguish different events
 * @return       error code
 * - OPRT_OK     success
 * - Others      fail
 */
OPERATE_RET tuya_ipc_rule_trigger_event(IN INT_T event, OUT UINT_T *sn);

参数说明

参数 说明
event 事件类型
sn 事件序号,用于区分不同的事件

事件上报

上报智能事件

/**
 * @brief        trigger event for rule module
 * @param[in]    event refer to NOTIFICATION_NAME_E
 * @param[out]   sn  event identification. used to distinguish different events
 * @return       error code
 * - OPRT_OK     success
 * - Others      fail
 */
OPERATE_RET tuya_ipc_rule_trigger_event(IN INT_T event, OUT UINT_T *sn);

上报智能事件和视频消息

/**
 * @brief        report ai message and video message
 * @param[in]    ai_result  ai result
 * @param[in]    video_msg  video message
 * @param[in]    is_notify  notify to message center if TRUE
 * @return       error code
 * - OPRT_OK     success
 * - Others      fail
 */
OPERATE_RET tuya_ipc_rule_report_ai_msg_with_video_msg(IN CHAR_T *ai_result, IN CHAR_T *video_msg, IN BOOL_T is_notify);

上报未检测到目标的智能事件

/**
 * @brief        report event if ai result is not detected
 * @param[in]    event      refer to NOTIFICATION_NAME_E
 * @param[in]    ai_result  ai result
 * @param[in]    is_notify  notify to message center if TRUE
 */
OPERATE_RET tuya_ipc_rule_report_event(IN INT_T event, IN CHAR_T *ai_result, IN BOOL_T is_notify);

上报未检测到目标的智能事件和视频消息

/**
 * @brief        report event with video msg if ai result is not detected
 * @param[in]    event      refer to NOTIFICATION_NAME_E
 * @param[in]    ai_result  ai result
 * @param[in]    video_msg  video message
 * @param[in]    is_notify  notify to message center if TRUE
 */
OPERATE_RET tuya_ipc_rule_report_event_with_video_msg(IN INT_T event, IN CHAR_T *ai_result, IN CHAR_T *video_msg, IN BOOL_T is_notify);