复杂协议控制

更新时间:2025-09-08 07:25:03下载pdf

为降低客户开发成本,方便扫地机与 App 面板交互,激光扫地机品类 SDK 把虚拟墙、房间属性等复杂控制,封装成不同的 API,应用开发者使用 API 即可完成数据通信。

功能介绍

当前 API 提供了以下方面的功能:

  • 完成云端下发的功能参数设置的协议解析,并将设置/查询命令及其参数通过回调接口交付业务应用。
  • 设备端功能参数上报 API 封装,设备端如有同云端的数据同步,调用相应的功能上报接口即可完成上报。

当前 API 支持的命令列表

功能 命令类型标识 发起方向
虚拟墙设置 VIRTUAL_WALL_SET 面板->设备
虚拟墙查询 VIRTUAL_WALL_QUERY 面板->设备
禁区设置 RESTRICTED_AREA_SET 面板->设备
禁区查询 RESTRICTED_AREA_QUERY 面板->设备
房间属性设置 ROOM_PROPERTY_SET 面板->设备
房间属性查询 ROOM_PROPERTY_QUERY 面板->设备
选区清扫设置 ROOM_CLEAN_SET 面板->设备
选区清扫查询 ROOM_CLEAN_QUERY 面板->设备
划区清扫设置 ZONE_CLEAN_SET 面板->设备
划区清扫查询 ZONE_CLEAN_QUERY 面板->设备
定点清扫设置 SPOT_CLEAN_SET 面板->设备
定点清扫查询 SPOT_CLEAN_QUERY 面板->设备
预约定时设置 SCHEDULE_SET 面板->设备
预约定时查询 SCHEDULE_QUERY 面板->设备
勿扰定时设置 QUIET_HOUR_SET 面板->设备
勿扰定时查询 QUIET_HOUR_QUERY 面板->设备
地图分区分割 PART_DIVI_SET 面板->设备
地图分区合并 PART_MERGE_SET 面板->设备
地图分区恢复默认 PART_DEFAULT_SET 面板->设备
地图重置 RESET_CURR_MAP_SET 面板->设备
地图保存 SAVE_CURR_MAP_SET 面板->设备
云端地图删除 DELETE_CLOUD_MAP_SET 面板->设备
语音查询 VOICE_LANGUAGE_QUERY 面板->设备
设备信息查询 DEV_INFO_QUERY 面板->设备
空地图信息查询 MAP_EMPTY_QUERY 面板->设备
密码状态查询 PASSWORD_STATE_QUERY 面板->设备
密码验证 PASSWORD_CHECK 面板->设备
密码设置 PASSWORD_SET 面板->设备
查询当前房间信息 MCS_ROOM_INFO_QUERY 面板->设备

功能解析

  • 虚拟墙设置 & 查询

    /**
    * @brief Forbidden modes
    */
    typedef enum {
        FORBIT_ALL = 0, // All prohibited
        FORBIT_SWEEP, // Prohibit mopping
        FORBIT_MOP, // Prohibit sweeping
        FORBIT_RESERVE, // Not set, reserved
    } FORBIT_MODE_E;
    
    /**
    * @brief Coordinate point structure
    */
    typedef struct {
        int x; // X value of the coordinate point
        int y; // Y value of the coordinate point
    } POINT_COOR_S;
    
    /**
    * @brief Virtual line coordinate structure
    */
    typedef struct {
        FORBIT_MODE_E mode; // Forbidden mode
        POINT_COOR_S points[2]; // Endpoints of the line, first element is the starting point of the virtual wall, second element is the ending point of the virtual wall
    } VIRTUAL_LINE_S;
    
    /**
    * @brief Virtual wall structure
    */
    typedef struct {
        int num; // Number of virtual walls
        int map_id; // Current command operation corresponding map ID, when the device reports, it's the map ID where the device currently is, the panel uses this field to confirm whether the reported parameters and the parameters set are on the same map
        VIRTUAL_LINE_S* line; // Virtual wall coordinate points and forbidden mode
    } VIRTUAL_WALL_S;
    
    • 虚拟墙的设置与查询使用 VIRTUAL_WALL_S 结构体,结构体内的成员 line 存着 num 条虚拟墙信息。注意面板不下发 map_id 成员值,但是设备上报需要带上 map_id 成员值。
    • 一条虚拟墙信息成员 line 中带着一个虚拟墙模式 mode 和两个虚拟墙点坐标 points(x0 | y0,x1 | y1)。
  • 禁区设置 & 查询

    typedef struct {
        int len; // string length
        char* name; // string memory points
    } STR_ELEMENT_S;
    
    /**
    * @brief Area coordinate point structure
    */
    typedef struct {
        int point_num; // Number of endpoints forming the area
        POINT_COOR_S* point; // Endpoint coordinates forming the restricted area
    } AREA_S;
    
    /**
    * @brief Virtual area structure
    */
    typedef struct {
        FORBIT_MODE_E mode; // Forbidden mode
        AREA_S area; // Endpoint coordinates of the restricted area
        STR_ELEMENT_S cur_name; // Name of the restricted area
    } VIRTUAL_AREA_S;
    
    /**
    * @brief Restricted area structure
    */
    typedef struct {
        int num; // Number of restricted areas
        int map_id; // Current command operation corresponding map ID, when the device reports, it's the map ID where the device currently is, the panel uses this field to confirm whether the reported parameters and the parameters set are on the same map
        VIRTUAL_AREA_S* restrict_zone; // Coordinates and forbidden mode of the restricted area
    } RESTRICTED_AREA_S;
    
    • 禁区的设置与查询使用 RESTRICTED_AREA_S 结构体,结构体内的成员 restrict_zone 存在 num 个区域。注意面板不下发 map_id 成员值,但是设备上报需要带上 map_id 成员值。
    • 一条禁区信息成员 restrict_zone 中由一个禁区模式 mode、一个禁区的坐标 area4 个坐标点)及禁区的名称 cur_name 组成。
  • 房间属性设置 & 查询

    /**
    * @brief Cleaning parameters
    */
    typedef struct {
        int valid; // Whether the parameter is valid
        STR_ELEMENT_S suction; // Suction power setting, specific values should be agreed upon with the project
        STR_ELEMENT_S cistern; // Water volume setting, specific values should be agreed upon with the project
        bool y_mop; // Y-shaped mopping, TRUE for Y-shaped mopping to take effect
        int clean_cnt; // Number of room cleanings
    } CLEAN_PARAM_S;
    
    /**
    * @brief Room property structure
    */
    typedef struct {
        int num; // Number of rooms
        int map_id; // Current command operation corresponding map ID, when the device reports, it's the map ID where the device currently is, the panel uses this field to confirm whether the reported parameters and the parameters set are on the same map
        int* ids; // Room ID numbers, each room corresponds to one ID number
        STR_ELEMENT_S* sweep_mode; // room sweep mode,each room corresponds to one sweep mode
        CLEAN_PARAM_S* param; // Cleaning parameters for rooms, each room corresponds to one cleaning setting parameter, param[0] corresponds to ids[0] area
        int* orders; // Cleaning order for rooms, each room corresponds to one cleaning order, cleaning order is represented by non-zero Arabic numerals, smaller values indicate higher cleaning priority, zero represents the lowest priority
        STR_ELEMENT_S* cus_name; // Room naming list, each room corresponds to a name, cus_name[0] corresponds to id[0]
        int* floor_type; // Room floor types,each room corresponds to one floor type
    } ROOM_PROPERTY_S;
    
    

    房间属性设置 & 查询使用 ROOM_PROPERTY_S 结构体:

    • 结构体内的成员中的 nummap_id 分别是房间数量和房间所在的地图 ID。注意面板不下发 map_id 成员值,但是设备上报需要带上 map_id 成员值。
    • 其他成员分别存放 num 个参数,如成员 ids 是该 map_id 内所有的房间 ID。
    • 清扫模式 sweep_mode 与当前房间的名称 cus_name 一样,存放的不是枚举值而是字符串,开发者在业务端可以自行将其转换为枚举值后处理。
    • orders 表示房间清扫顺序,floor_type 表示地板类型。
    • 单房间对应的清扫参数成员 param,包括吸力 suction、水量 cistern、Y 字拖、清扫次数 clean_cntvalid 表示有效,是备用字段;吸力和水量存放的不是枚举值而是字符串。
  • 选区清扫设置 & 查询

    /**
    * @brief Cleaning parameters
    */
    typedef struct {
        int valid; // Whether the parameter is valid
        STR_ELEMENT_S suction; // Suction power setting, specific values should be agreed upon with the project
        STR_ELEMENT_S cistern; // Water volume setting, specific values should be agreed upon with the project
        bool y_mop; // Y-shaped mopping, TRUE for Y-shaped mopping to take effect
        int clean_cnt; // Number of room cleanings
    } CLEAN_PARAM_S;
    
    /**
    * @brief Selected area cleaning structure
    */
    typedef struct {
        int num; // Number of selected areas
        int map_id; // Current command operation corresponding map ID, when the device reports, it's the map ID where the device currently is, the panel uses this field to confirm whether the reported parameters and the parameters set are on the same map
        int* ids; // List of IDs for the selected area rooms
        STR_ELEMENT_S* sweep_mode; // sweep mode for the selected area rooms
        CLEAN_PARAM_S* param; // Cleaning parameters for selected areas, each room corresponds to one cleaning parameter, param[0] corresponds to ids[0] area, if not set valid is 0
    } ROOM_CLEAN_S;
    

    选区清扫设置 & 查询使用 ROOM_CLEAN_S 结构体:

    • 结构体内的成员中的 nummap_id 分别是选中的房间数量和房间所在的地图 ID。注意面板不下发 map_id 成员值,但是设备上报需要带上 map_id 成员值。
    • 其他成员分别存放 num 个参数,如成员 ids 是该 map_id 内所有选中的房间 ID。
    • 清扫模式 sweep_mode 与当前房间的名称 cus_name 相同,存放的不是枚举值而是字符串,开发者在业务端可以自行转换为枚举值后处理。
    • 单房间对应的清扫参数成员 param,包括吸力 suction、水量 cistern、Y 字拖、清扫次数 clean_cntvalid表示有效,是备用字段;吸力和水量存放的不是枚举值而是字符串。
  • 划区清扫设置 & 查询

    /**
    * @brief Area coordinate point structure
    */
    typedef struct {
        int point_num; // Number of endpoints forming the area
        POINT_COOR_S* point; // Endpoint coordinates forming the restricted area
    } AREA_S;
    
    /**
    * @brief Zone parameters structure
    */
    typedef struct {
        STR_ELEMENT_S mode; // Cleaning mode
        CLEAN_PARAM_S param; // Cleaning parameters
        AREA_S area; // Area coordinates
        STR_ELEMENT_S cur_name; // Area name
    } ZONE_AREA_PARAM_S;
    /**
    * @brief Zone cleaning structure
    */
    typedef struct {
        int num; // Number of zones
        int map_id; // Current command operation corresponding map ID, when the device reports, it's the map ID where the device currently is, the panel uses this field to confirm whether the reported parameters and the parameters set are on the same map
        ZONE_AREA_PARAM_S* clean_zone; // Cleaning parameters for zone cleaning, each zone corresponds to one cleaning parameter
    } ZONE_CLEAN_S;
    

    划区清扫设置 & 查询使用 ZONE_CLEAN_S 结构体:

    • 结构体内的成员中的 nummap_id 分别是选中的房间数量和房间所在的地图 ID。注意面板不下发 map_id 成员值,但是设备上报需要带上 map_id 成员值。
    • 结构体内的成员 clean_zone 存着 num 个区域,其他入参按照结构体的说明进行操作。
    • clean_zone 成员包括清扫模式 mode、吸力 suction及水量 cistern。与当前房间的名称 cus_name 相同,存放的不是枚举值而是字符串,开发者在业务端可以自行转换为枚举值后处理。
    • area 是划区的区域坐标点集合 polygons
  • 定点清扫设置 & 查询

    /**
    * @brief Spot cleaning structure
    */
    typedef struct {
        int num; // Number of spot cleanings
        int map_id; // Current command operation corresponding map ID, when the device reports, it's the map ID where the device currently is, the panel uses this field to confirm whether the reported parameters and the parameters set are on the same map
        POINT_COOR_S* points; // List of spot coordinates, each spot area corresponds to one points element
        STR_ELEMENT_S* mode; // Cleaning mode for the zone, each area corresponds to one cleaning mode, mode[0] corresponds to point[0] area
        CLEAN_PARAM_S* param; // Cleaning parameters for selected areas, param[0] corresponds to point[0] area, if not set valid is 0
    } SPOT_CLEAN_S;
    

    定点清扫设置 & 查询使用 SPOT_CLEAN_S 结构体:

    • 定点清扫只是单个区域的清扫,结构体内的成员 num 区域数量固定为 1
    • 成员 points 是定点坐标,清扫区域是以该点坐标为中心的 1 平米的区域。其他的成员按需获取,如定点清扫的吸力、水量及清扫次数等都是代码默认值,无需解析面板下发的值。
    • 清扫模式 mode 存放的不是枚举值而是字符串,开发者在业务端可以自行转换为枚举值后处理。
    • 单房间对应的清扫参数成员 param,包括吸力 suction、水量 cistern、Y 字拖、清扫次数 clean_cntvalid表示有效,是备用字段;吸力和水量存放的不是枚举值而是字符串。
  • 预约定时设置 & 查询

    /**
    * @brief Scheduled time structure
    */
    typedef struct {
        char hour; // Scheduled hour value
        char min; // Scheduled minute value
    } SCHEDULE_TIME_S;
    
    /**
    * @brief Scheduled information structure
    */
    typedef struct {
        unsigned char active; // Scheduled switch, 0 for off, 1 for on
        unsigned char cycle; // Whether to loop the schedule, value 0 indicates a one-time schedule, non-zero indicates a looping schedule, cycle's bit0~bit6 correspond to Monday~Sunday
        SCHEDULE_TIME_S start_time; // Scheduled effective time
        int num; // Number of rooms corresponding to each schedule
        bool customed_switch; // the switch of the clean param,when it is true,the clean param of the app send is unvalid
        int* ids; // Room ID categories corresponding to each schedule
        STR_ELEMENT_S* mode; // List of cleaning modes, mode[0] corresponds to ids[0]
        CLEAN_PARAM_S* param; // List of cleaning parameters, param[0] corresponds to ids[0]
    } SCHEDULE_PARAM_S;
    /**
    * @brief Local schedule structure
    */
    typedef struct {
        int num; // Number of schedules
        int map_id; // Current command operation corresponding map ID, when the device reports, it's the map ID where the device currently is, the panel uses this field to confirm whether the reported parameters and the parameters set are on the same map
        SCHEDULE_PARAM_S* time_sets; // Parameter categories for each schedule
    } SCHEDULE_S;
    

    预约定时设置 & 查询使用 SCHEDULE_S 结构体:

    • 结构体内的成员中 nummap_id 分别是预约数量和地图 ID。注意面板不下发 map_id 成员值,但是设备上报需要带上 map_id 成员值。
    • 结构体内的成员 time_sets 存着 num 条预约参数,成员 time_sets 内包含:清扫模式 modeparam 成员下的吸力 suction 和水量 cistern,存放的不是枚举值而是字符串,开发者在业务端可以自行转换为枚举值后处理。
    • 成员 time_sets 内还包含 customed_switch 是指自定义清扫参数的使能开关,开发者可以根据使能开关,来确认是否使用自定义的清扫模式、吸力、水量及清洁次数。结构体内的其他成员,请按照结构体说明来操作。
  • 勿扰定时设置 & 查询

    /**
    * @brief Scheduled time structure
    */
    typedef struct {
        char hour; // Scheduled hour value
        char min; // Scheduled minute value
    } SCHEDULE_TIME_S;
    
    /**
    * @brief Do not disturb settings structure
    */
    typedef struct {
        unsigned char active; // Do not disturb switch, 0 for off, 1 for on
        unsigned char other_day; // Effective time, 0 for today, 1 for the next day
        SCHEDULE_TIME_S start_time; // Do not disturb start time
        SCHEDULE_TIME_S end_time; // Do not disturb end time
    } QUIET_HOURS_S;
    

    勿扰定时扫设置 & 查询使用 QUIET_HOURS_S 结构体,结构体内的成员都会被使用,开发者可根据结构体成员的说明来操作。

  • 地图分区分割

    /**
    * @brief Division line coordinate structure
    */
    typedef struct {
        POINT_COOR_S points[2]; // Endpoints of the line
    } DIVIDE_LINE_S;
    
    /**
    * @brief Manual partition structure
    */
    typedef struct {
        int num; // Number of partitions to be divided
        int map_id; // Current command operation corresponding map ID, when the device reports, it's the map ID where the device currently is, the panel uses this field to confirm whether the reported parameters and the parameters set are on the same map
        int* ids; // List of IDs to be divided
        DIVIDE_LINE_S* divi_line; // Partition division line coordinates, each room ID corresponds to one division line, divi_line[0] corresponds to ids[0]
    } PART_DIVI_S;
    

    地图分区分割使用 PART_DIVI_S 结构体,目前房间分割只支持单一房间。成员 DIVIDE_LINE_S 是分割线的两个坐标点,其他结构体内的成员,开发者可根据结构体成员的说明来操作。

  • 地图分区合并

    /**
    * @brief Manual area merge structure
    */
    typedef struct {
        int num; // Number of partitions to be merged
        int map_id; // Current command operation corresponding map ID, when the device reports, it's the map ID where the device currently is, the panel uses this field to confirm whether the reported parameters and the parameters set are on the same map
        int* ids; // List of IDs to be merged
    } PART_MERGE_S;
    
    

    目前只支持相连的两个房间合并。

  • 语音查询

    /**
    * @brief Voice download status
    */
    typedef enum {
        RVC_DOWNLOAD_ST_FAILED = 0, // Voice download error
        RVC_DOWNLOAD_ST_LOADING, // Voice downloading
        RVC_DOWNLOAD_ST_SUCC, // Voice download successful
        RVC_DOWNLOAD_ST_USING // Voice in use
    } VOICE_DOWNLOAD_ST_E;
    
    /**
    * @brief Use voice response structure
    */
    typedef struct {
        unsigned int id; // Voice ID number
        VOICE_DOWNLOAD_ST_E download_status; // Voice download status
        int percent;  // Voice download progress percentage,range is 0~100
    } USE_VOICE_LANGUAGE_RESPONSE_S; 
    

    SDK 内部已经完成了语音下载的工作,开发者只需要在设备初始化阶段,调用 ty_rvc_voice_download_init 接口初始化语音下载能力即可。

  • 使用地图功能

    SDK 内部已经完成了楼层地图的下载工作,开发者只需要在设备初始化阶段,调用 ty_rvc_map_download_init 接口初始化地图下载能力即可。

  • 空地图信息查询

    面板需要设备端提供首页地图是否存在,便于面板展示。

  • 查询当前房间信息

    typedef struct {
        int len; // string length
        char* name; // string memory points
    } STR_ELEMENT_S;
    
    /**
    * @brief  MCS Room info structure
    */
    typedef struct {
        unsigned int map_id;  //Current command operation corresponding map ID, when the device reports, it's the map ID where the device currently is, the panel uses this field to confirm whether the reported parameters and the parameters set are on the same map
        unsigned int curr_name_id; //The current room ID where the machine is located.
        STR_ELEMENT_S curr_name;   //The current room name where the machine is located.
    } MCS_ROOM_INFO_S;
    

    获取设备当前所在的位置信息并上报,扫地机 Alexa 功能需要获取设备当前位置。注意涂鸦公版 App 的面板不支持该功能。

流程说明

  • 设备端与涂鸦 App 进行数据同步有以下三种方式:
    • 设备端数据状态变化时,主动调用接口进行数据上报。
    • 面板端发起数据查询命令,设备端进行被动响应完成数据上报。
    • 面板端发起数据设置命令,设备端完成相应功能处理后,调用接口进行数据上报同步。
  • 应用收到 FUNC_SET_CB 回调对应的处理命令后,需要异步处理该事件,以保证频繁点击面板进行命令下发时,不对后续命令解析造成阻塞,异步处理时需要将命令参数先进行数据复制,然后使用复制后的数据进行命令事件处理。
应用TuyaOS_SDK涂鸦 App设备上电数据命令设置/查询回调函数注册到-接口:ty_rvc_advance_func_regis-ter设备联网成功通过ty_rvc_device_info_data_response等 response接口设备端进行数据上报数据上报,完成与云端的数据同步用户进行面板 UI 交互,下发命令设置参数SDK 进行数据解析为保证不对命令解析造成后续阻塞,建议应用对命令进行异步处理异步处理时需要将命令参数先进行数据复制,然后使用复制后的数据进行命令事件处-SDK调用数据命令设置回调函数进行数-据处理设备端完成命令设置功能处理后,-调用 response 接口进行数据上报数据上报,完成与云端的数据同步用户进行面板 UI 交互,下发命令查询参数SDK 进行数据解析SDK调用数据命令查询回调函数进行数-据处理设备端完成命令查询功能处理后,-调用 response 接口进行数据上报数据上报,完成与云端的数据同步应用TuyaOS_SDK涂鸦 App

API

协议处理回调函数注册

命令处理回调函数的注册接口。回调函数注册成功后,SDK 在收到云端下发的命令协议并成功解析后会调用注册的回调函数执行业务功能。需要注意的是回调函数中的 param 入参变量会在回调函数被调用后释放掉,如果回调函数有异步操作,需要将该入参的参数数据复制到应用自己申请的变量空间中。

/**
 * @brief Sweeper advanced function setting callback function pointer
 * @param [ADVANCE_CMD_E] cmd, protocol command, the SDK uses this parameter to notify the application of the current setting command to be processed, see the list for setting commands, all ending with SET
 * @param [void *] param, parameters corresponding to the command, the application converts the param parameter into the command corresponding parameter structure based on the cmd command field, the structure correspondence can refer to the accompanying demo
 */
typedef OPERATE_RET (*FUNC_SET_CB)(IN ADVANCE_CMD_E cmd, IN void* param);

/**
 * @brief Sweeper advanced function query callback function pointer
 * @param [ADVANCE_CMD_E] cmd, protocol command, the SDK uses this parameter to notify the application of the current query command to be processed, see the list for query commands, all ending with QUERY
 * @param [void *] param, parameters corresponding to the command, current query command, its parameters are meaningless and do not need to be processed
 * @note  When the application gets the corresponding command parameters in the query callback function and needs to report, please call the corresponding response reporting function, for example, after processing the VIRTUAL_WALL_QUERY command, when needing to report parameters, use the ty_rvc_virtual_wall_data_response interface to report
 */
typedef OPERATE_RET (*FUNC_QUERY_CB)(IN ADVANCE_CMD_E cmd, IN void* param);

/**
 * @brief Register advanced capability setting and query callback functions
 * @param[in] sets_handler: Command setting callback function that the application needs to implement
 * @param[in] query_handler: Command query callback function that the application needs to implement
 * @return OPERATE_RET: 0 success, other error codes indicate failure
 */
OPERATE_RET ty_rvc_advance_func_register(IN FUNC_SET_CB sets_handler, IN FUNC_QUERY_CB query_handler);

参数 说明
sets_handler 入参,设置命令的处理回调函数,由业务应用实现。通过该接口注册到 SDK,回调函数的 param 入参为命令参数,应用应根据命令类型将该参数转换成对应的命令参数结构体,再进行使用
query_handler 入参,查询命令的处理回调函数,由业务应用实现。通过该接口注册到 SDK,回调函数的 param 入参当前未使用,应用无需关心
OPERATE_RET 返回值,OPRT_OK 代表执行成功,其它值代表执行失败,错误码含义参见 TuyaOS_SDK 对应头文件定义

数据上报接口

设备端数据上报接口,用于完成与涂鸦 App 的数据同步,各接口完成的数据上报功能列表如下:

接口名称 接口功能 备注
ty_rvc_virtual_wall_data_response 虚拟墙数据上报 设备端有相应数据变化时应主动调用该接口进行数据上报
ty_rvc_restricted_area_data_response 禁区数据上报 设备端有相应数据变化时应主动调用该接口进行数据上报
ty_rvc_room_property_data_response 房间属性数据上报 设备端有相应数据变化时应主动调用该接口进行数据上报
ty_rvc_room_clean_data_response 选区清扫数据上报 设备端有相应数据变化时应主动调用该接口进行数据上报
ty_rvc_spot_clean_data_response 定点清扫数据上报 设备端有相应数据变化时应主动调用该接口进行数据上报
ty_rvc_zone_clean_data_response 划区清扫数据上报 设备端有相应数据变化时应主动调用该接口进行数据上报
ty_rvc_schedule_data_response 预约定时数据上报 设备端有相应数据变化时应主动调用该接口进行数据上报
ty_rvc_quiet_hours_data_response 勿扰定时数据上报 设备端有相应数据变化时应主动调用该接口进行数据上报
ty_rvc_voice_language_data_response 语种切换数据上报 设备端有相应数据变化时应主动调用该接口进行数据上报
ty_rvc_device_info_data_response 设备信息数据上报 设备端有相应数据变化时应主动调用该接口进行数据上报
ty_rvc_part_division_data_response 地图分区分割设置结果上报 该功能仅用于设置命令执行后的结果回复,面板无设置命令下发时设备无需调用该接口进行数据同步
ty_rvc_part_merge_data_response 地图分区合并设置结果上报 该功能仅用于设置命令执行后的结果回复,面板无设置命令下发时设备无需调用该接口进行数据同步
ty_rvc_map_part_default_data_response 地图分区恢复默认数据上报 该功能仅用于设置命令执行后的结果回复,面板无设置命令下发时设备无需调用该接口进行数据同步
ty_rvc_map_clear_data_response 地图重置命令设置结果上报 该功能仅用于设置命令执行后的结果回复,面板无设置命令下发时设备无需调用该接口进行数据同步
ty_rvc_map_save_data_response 地图保存命令设置结果上报 该功能仅用于设置命令执行后的结果回复,面板无设置命令下发时设备无需调用该接口进行数据同步
ty_rvc_map_delete_data_response 地图删除命令设置结果上报 该功能仅用于设置命令执行后的结果回复,面板无设置命令下发时设备无需调用该接口进行数据同步
ty_rvc_map_empty_response 空地图查询命令结果上报 该功能仅用于查询命令执行后的结果回复,面板无查询命令下发时设备无需调用该接口进行数据同步
ty_rvc_password_check_response 密码验证命令结果上报 该功能仅用于查询命令执行后的结果回复,面板无查询命令下发时设备无需调用该接口进行数据同步
ty_rvc_password_state_response 密码状态命令结果上报 该功能仅用于设置或者查询命令执行后的结果回复,面板无设置或者查询命令下发时设备无需调用该接口进行数据同步
ty_rvc_password_set_response 设置密码命令结果上报 该功能仅用于设置命令执行后的结果回复,面板无设置命令下发时设备无需调用该接口进行数据同步
ty_rvc_mcs_room_info_response 查询当前房间信息结果上报 设备端有相应数据变化时应主动调用该接口进行数据上报

/**
 * @brief Report virtual wall information
 * @param[in] p_virtual_wall: Virtual wall data, passed in by the application, parameters are defined in the structure
 * @param[in] errcode: Command execution result, 0 for success, other values for failure
 * @return OPERATE_RET: 0 success, other error codes indicate failure
 */
OPERATE_RET ty_rvc_virtual_wall_data_response(VIRTUAL_WALL_S* p_virtual_wall, int errcode);

/**
 * @brief Report restricted area data
 * @param[in] p_restricted_area: Restricted area data input parameter, passed in by the application, parameters are defined in the structure
 * @param[in] errcode: Execution result corresponding to the parameter setting, 0 for success, other values for failure
 * @return OPERATE_RET: 0 success, other error codes indicate failure
 */
OPERATE_RET ty_rvc_restricted_area_data_response(RESTRICTED_AREA_S* p_restricted_area, int errcode);

/**
 * @brief Report room property data
 * @param[in] p_room_clean: Room property data, passed in by the application, parameters are defined in the structure
 * @param[in] errcode: Execution result corresponding to the parameter setting, 0 for success, other values for failure
 * @return OPERATE_RET: 0 success, other error codes indicate failure
 */
OPERATE_RET ty_rvc_room_property_data_response(ROOM_PROPERTY_S* p_room_clean, int errcode);

/**
 * @brief Report selected area cleaning parameter values
 * @param[in] p_room_clean: Cleaning parameter input parameter, passed in by the application, parameters are defined in the structure
 * @param[in] errcode: Execution error code, no error, input parameter is 0
 * @return OPERATE_RET: 0 success, other error codes indicate failure
 */
OPERATE_RET ty_rvc_room_clean_data_response(ROOM_CLEAN_S* p_room_clean, int errcode);

/**
 * @brief Report spot cleaning data
 * @param[in] spot_clean_data: Spot cleaning data input parameter, passed in by the application, parameters are defined in the structure
 * @param[in] errcode: Execution error code, input 0 when no error
 * @return OPERATE_RET: 0 success, other error codes indicate failure
 */
OPERATE_RET ty_rvc_spot_clean_data_response(SPOT_CLEAN_S* spot_clean_data, int errcode);

/**
 * @brief Report zone cleaning data
 * @param[in] p_zone_area: Zone cleaning data input parameter, passed in by the application, parameters are defined in the structure
 * @param[in] errcode: Execution error code, input 0 when no error
 * @return OPERATE_RET: 0 success, other error codes indicate failure
 */
OPERATE_RET ty_rvc_zone_clean_data_response(ZONE_CLEAN_S* p_zone_area, int errcode);

/**
 * @brief Partition setting reply
 * @param[in] p_part_division: Partition parameters, passed in by the application, parameters are defined in the structure
 * @param[in] errcode: Execution error code, input 0 when no error
 * @return OPERATE_RET: 0 success, other error codes indicate failure
 */
OPERATE_RET ty_rvc_part_division_data_response(PART_DIVI_S* p_part_division, PART_DIV_ST_E errcode);

/**
 * @brief Partition merge command reply
 * @param[in] p_part_merge: Partition setting reply parameters, passed in by the application, parameters are defined in the structure
 * @param[in] errcode: Execution error code, input 0 when no error
 * @return OPERATE_RET: 0 success, other error codes indicate failure
 */
OPERATE_RET ty_rvc_part_merge_data_response(PART_MERGE_S* p_part_merge, PART_MERGE_ST_E errcode);

/**
 * @brief Partition restore default command response
 * @param[in] p_part_merge: Structure parameters, passed in by the application, parameters are defined in the structure
 * @param[in] errcode: Execution error code
 * @return OPERATE_RET: 0 success, other error codes indicate failure
 */
OPERATE_RET ty_rvc_map_part_default_data_response(MAP_PART_RESET_S* p_part_merge, PART_RESET_ST_E errcode);

/**
 * @brief Clear home map reply
 * @param[in] p_map_reset: Map reset structure, passed in by the application, parameters are defined in the structure
 * @param[in] errcode: Execution error code
 * @return OPERATE_RET: 0 success, other error codes indicate failure
 */
OPERATE_RET ty_rvc_map_clear_data_response(CURRENT_MAP_RESET_S* p_map_reset, MAP_RESET_ST_E errcode);

/**
 * @brief Map save command reply
 * @param[in] p_map_save: Map save reply parameter input, passed in by the application, parameters are defined in the structure
 * @param[in] errcode: Error code
 * @return OPERATE_RET: 0 success, other error codes indicate failure
 */
OPERATE_RET ty_rvc_map_save_data_response(MAP_SAVE_S* p_map_save, MAP_SAVE_ST_E errcode);

/**
 * @brief Map delete command reply
 * @param[in] p_map_delete: Map delete reply parameters, passed in by the application, parameters are defined in the structure
 * @param[in] errcode: Error code
 * @return OPERATE_RET: 0 success, other error codes indicate failure
 */
OPERATE_RET ty_rvc_map_delete_data_response(DELETE_CLOUD_MAP_S* p_map_delete, MAP_DELETE_ST_E errcode);

/**
 * @brief Scheduled data report
 * @param[in] p_schedule: Scheduled data, passed in by the application, parameters are defined in the structure
 * @param[in] current_map_id:
 * @param[in] errcode:
 * @return OPERATE_RET: 0 success, other error codes indicate failure
 */
OPERATE_RET ty_rvc_schedule_data_response(SCHEDULE_S* p_schedule, int errcode);

/**
 * @brief Do not disturb scheduled data report
 * @param[in] p_quiet_hours: Do not disturb scheduled data input, passed in by the application, parameters are defined in the structure
 * @param[in] errcode: Error code
 * @return OPERATE_RET: 0 success, other error codes indicate failure
 */
OPERATE_RET ty_rvc_quiet_hours_data_response(QUIET_HOURS_S* p_quiet_hours, int errcode);

/**
 * @brief Voice use parameter report
 * @param[in] p_voice_language_res: Voice use parameter report, passed in by the application, parameters are defined in the structure
 * @param[in] errcode: Execution error code
 * @return OPERATE_RET: 0 success, other error codes indicate failure
 */
OPERATE_RET ty_rvc_voice_language_data_response(USE_VOICE_LANGUAGE_RESPONSE_S* p_voice_language_res, VOICE_USE_ST_E errcode);

/**
 * @brief Device information report, info field is concatenated by the customer in key:value format in JSON, when the app panel displays device information, it shows each value in the order of the key list
 * The panel needs to correctly configure multilingual support for each key value
 * This interface is responsible for completing data reporting via the MQTT channel
 *
 * @param[char*] info: Application's JSON format string
 * @param [int] len: String length
 * @return OPERATE_RET, OPRT_OK indicates success, other error codes indicate failure
 */
OPERATE_RET ty_rvc_device_info_data_response(char* info, int len);            

/**
 * @brief Report dev room info
 * @param[in] room_info: Room information parameters, passed in by the application, are defined in the structure.
 * @param[in] errcode: Execution result corresponding to the parameter setting, 0 for success, other values for failure
 * @return OPERATE_RET: 0 success, other error codes indicate failure
 */
OPERATE_RET ty_rvc_mcs_room_info_response(MCS_ROOM_INFO_S* room_info, int errcode);      
           

使用示例


static OPERATE_RET __sweeper_advance_function_set(OUT ADVANCE_CMD_E cmd, OUT void *param)
{
    OPERATE_RET ret = 0;
    int i=0,j=0;
    switch (cmd) {
        case VIRTUAL_WALL_SET: {
            VIRTUAL_WALL_S* p_virtual_wall = (VIRTUAL_WALL_S*)param;
            PR_DEBUG("virtual wall num:%d", p_virtual_wall->num);
            for(i = 0; i < p_virtual_wall->num;i++){
                PR_DEBUG("mode:%d", p_virtual_wall->line[i].mode);
                PR_DEBUG("line:%d", p_virtual_wall->line[i].points[0].x);
                PR_DEBUG("line:%d", p_virtual_wall->line[i].points[0].y);
                PR_DEBUG("line:%d", p_virtual_wall->line[i].points[1].x);
                PR_DEBUG("line:%d", p_virtual_wall->line[i].points[1].y);
            }

            ........
            //此处仅演示接口用法,实际使用时应在异步事件处理函数中获取设备实际数据,并进行数据上报
            current_map_id = 8;
            errcode = 0;
            ty_rvc_virtual_wall_data_response(p_virtual_wall, current_map_id, errcode);  

            }break;
            .......
            default:
                PR_DEBUG("cmd not support now");
                break;
    }

}


static OPERATE_RET __sweeper_advance_function_query(OUT ADVANCE_CMD_E cmd, OUT void *param)
{
    OPERATE_RET ret = OPRT_OK;
    uint16_t cmd_index = 0;
    switch(cmd){
        case VIRTUAL_WALL_QUERY:{
			// 使用测试数据进行数据上报演示
            VIRTUAL_WALL_S test_virtual_wall;
            VIRTUAL_LINE_S virtual_line[10] = {0};
            OPERATE_RET ret = OPRT_OK;

            test_virtual_wall.num = 1;
            for (int i = 0; i < test_virtual_wall.num; i++) {
                virtual_line[i].mode = FORBIT_ALL;
                virtual_line[i].points[0].x = 100;
                virtual_line[i].points[0].y = 200;
                virtual_line[i].points[1].x = 50;
                virtual_line[i].points[1].y = 60;
            }
            test_virtual_wall.line = virtual_line;
            int current_map_id = 7;
            ty_rvc_virtual_wall_data_response(&test_virtual_wall, current_map_id, errcode);          
        }break;
        default:
        PR_DEBUG("cmd not support now");
        break;
    }
    return ret;
}


// 上电主流程
int main(int argc, char* argv[])
{
    OPERATE_RET ret = 0;
    ....
    ret = ty_sys_start();
    if (ret != OPRT_OK) {
        PR_ERR("[%s, %d] sys start failed", __FUNCTION__, __LINE__);
        return ret;
    }

    ty_rvc_advance_func_register(__sweeper_advance_function_set, __sweeper_advance_function_query);
	....
}