Last Updated on : 2025-09-08 07:41:13download
To reduce development costs and facilitate the interaction between robot vacuums and app panels, the laser robot vacuum SDK encapsulates complex controls such as virtual walls and room properties into different APIs. You can use the APIs to easily complete data communication.
The APIs support the following features:
Feature | Command type identifier | Direction |
---|---|---|
Set a virtual wall | VIRTUAL_WALL_SET | Panel->Device |
Query a virtual wall | VIRTUAL_WALL_QUERY | Panel->Device |
Set a no-go area | RESTRICTED_AREA_SET | Panel->Device |
Query a no-go area | RESTRICTED_AREA_QUERY | Panel->Device |
Set room properties | ROOM_PROPERTY_SET | Panel->Device |
Query room properties | ROOM_PROPERTY_QUERY | Panel->Device |
Set a selected area cleaning | ROOM_CLEAN_SET | Panel->Device |
Query a selected area cleaning | ROOM_CLEAN_QUERY | Panel->Device |
Set a selected zone cleaning | ZONE_CLEAN_SET | Panel->Device |
Query a selected zone cleaning | ZONE_CLEAN_QUERY | Panel->Device |
Set a selected spot cleaning | SPOT_CLEAN_SET | Panel->Device |
Query a selected spot cleaning | SPOT_CLEAN_QUERY | Panel->Device |
Set a schedule | SCHEDULE_SET | Panel->Device |
Query a schedule | SCHEDULE_QUERY | Panel->Device |
Set a Do not disturb (DND) period | QUIET_HOUR_SET | Panel->Device |
Query a DND period | QUIET_HOUR_QUERY | Panel->Device |
Split an area on the map | PART_DIVI_SET | Panel->Device |
Merge areas on the map | PART_MERGE_SET | Panel->Device |
Restore default areas on the map | PART_DEFAULT_SET | Panel->Device |
Reset a map | RESET_CURR_MAP_SET | Panel->Device |
Save a map | SAVE_CURR_MAP_SET | Panel->Device |
Delete a map from the cloud | DELETE_CLOUD_MAP_SET | Panel->Device |
Query a language file | VOICE_LANGUAGE_QUERY | Panel->Device |
Query device information | DEV_INFO_QUERY | Panel->Device |
Query empty map information | MAP_EMPTY_QUERY | Panel->Device |
Query password status | PASSWORD_STATE_QUERY | Panel->Device |
Verify a password | PASSWORD_CHECK | Panel->Device |
Set a password | PASSWORD_SET | Panel->Device |
Query current room information | MCS_ROOM_INFO_QUERY | Panel->Device |
Set and query a virtual wall
/**
* @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
struct is used for setting and querying virtual walls. The member line
within the struct stores num
entries of virtual wall information. The panel does not send the map_id
member value when sending commands. However, the device must include the map_id
member value when reporting status.line
member contains a virtual wall mode
and two point coordinates points
(x0 | y0
and x1 | y1
).Set and query a no-go area
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
struct is used for setting and querying no-go areas. The member restrict_zone
within the struct stores num
entries. The panel does not send the map_id
member value when sending commands. However, the device must include the map_id
member value when reporting status.restrict_zone
member consists of a mode
, the coordinates area
defined by 4
coordinate points, and the no-go area name cur_name
.Set and query room properties
/**
* @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;
The ROOM_PROPERTY_S
struct is used for setting and querying room properties.
num
and map_id
in the struct represent the number of rooms and the map ID where the rooms are located, respectively. The panel does not send the map_id
member value when sending commands. However, the device must include the map_id
member value when reporting status.num
parameters each. For example, the member ids
contains all IDs of rooms within the specified map_id
.sweep_mode
(cleaning mode) and cus_name
(custom room name) store string values instead of enumeration values. You can convert these strings to enumeration values for processing in the business logic.orders
indicates the room cleaning order, and floor_type
indicates the floor type.param
contains cleaning parameters for a single room, including suction
(suction power), cistern
(water volume), Y-shaped mopping, and clean_cnt
(cleaning count). valid
is a reserved field that indicates validity. suction
and cistern
store string values instead of enumeration values.Set and query the selected area cleaning
/**
* @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;
The ROOM_CLEAN_S
struct is used for setting and querying selected area cleaning parameters.
num
and map_id
in the struct represent the number of selected rooms and the map ID where the rooms are located, respectively. The panel does not send the map_id
member value when sending commands. However, the device must include the map_id
member value when reporting status.num
parameters each. For example, the member ids
contains IDs of all the selected rooms within the specified map_id
.sweep_mode
(cleaning mode) and cus_name
(custom room name) store string values instead of enumeration values. You can convert these strings to enumeration values for processing in the business logic.param
contains cleaning parameters for a single room, including suction
(suction power), cistern
(water volume), Y-shaped mopping, and clean_cnt
(cleaning count). valid
is a reserved field that indicates validity. suction
and cistern
store string values instead of enumeration values.Set and query the selected zone cleaning
/**
* @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;
The ZONE_CLEAN_S
struct is used for setting and querying selected zone cleaning parameters.
num
and map_id
in the struct represent the number of selected rooms and the map ID where the rooms are located, respectively. The panel does not send the map_id
member value when sending commands. However, the device must include the map_id
member value when reporting status.clean_zone
within the struct stores num
zones. Other input parameters should be handled according to the struct’s description.clean_zone
member includes mode
(cleaning mode), suction
(suction power), and cistern
(water volume). They and cus_name
(custom room name) store string values instead of enumeration values. You can convert these strings to enumeration values for processing in the business logic.area
member represents the collection of coordinate points (polygons
) defining the zone boundaries.Set and query the selected spot cleaning
/**
* @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;
The SPOT_CLEAN_S
struct is used for setting and querying selected spot cleaning parameters.
num
(number of areas) in the struct is fixed to 1
.points
represents the spot coordinates, and the cleaning area is a 1-square-meter area centered around this point. You can get other members as needed. For example, parameters such as suction power, water volume, and cleaning count for spot cleaning use default values and do not require parsing values sent by the panel.mode
(cleaning mode) stores string values instead of enumeration values. You can convert these strings to enumeration values for processing in the business logic.param
contains cleaning parameters for a single room, including suction
(suction power), cistern
(water volume), Y-shaped mopping, and clean_cnt
(cleaning count). valid
is a reserved field that indicates validity. suction
and cistern
store string values instead of enumeration values.Set and query a schedule
/**
* @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;
The SCHEDULE_S
struct is used for setting and querying schedules.
num
and map_id
in the struct represent the number of schedules and the map ID, respectively. The panel does not send the map_id
member value when sending commands. However, the device must include the map_id
member value when reporting status.time_sets
in the struct stores num
scheduled task parameters. time_sets
includes mode
(cleaning mode), suction
(suction power), and cistern
(water volume) in the member param
. They store string values instead of enumeration values. You can convert these strings to enumeration values for processing in the business logic.time_sets
also includes customed_switch
, which is an enable switch for custom cleaning parameters. You can use this switch to determine whether to apply customized cleaning mode, suction power, water volume, and cleaning count. For other members within the struct, please handle them according to the struct’s documentation.Set and query a DND period
/**
* @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;
The QUIET_HOURS_S
struct is used for setting and querying a DND period. All members within this struct will be utilized. Please handle them according to the struct’s documentation.
Split an area on the map
/**
* @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;
The PART_DIVI_S
struct is used for splitting maps. Currently, this feature is available only in a single room. The member DIVIDE_LINE_S
contains the two coordinate points of the dividing line. For other members within the struct, please handle them according to the struct’s documentation.
Merge areas on the map
/**
* @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;
Currently, only two connected rooms can be merged.
Query a language file
/**
* @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;
The SDK has already implemented the voice download capability internally. You only need to call the ty_rvc_voice_download_init
interface during the device initialization phase to initialize the voice download capability.
Use a map
The SDK has internally completed the implementation for floor map downloads. You only need to call the ty_rvc_map_download_init
interface during the device initialization phase to initialize the map download capability.
Query empty map information
The panel requires the device to provide information on whether a homepage map exists, to facilitate proper display on the panel.
Query current room information
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;
Get and report the current location information of the device. The robot vacuum’s Alexa
functionality requires access to the device’s current location. Please note that this feature is not supported on the panel of Tuya’s all-in-one app.
FUNC_SET_CB
callback, it needs to handle the event asynchronously to ensure that frequent clicks on the panel for sending commands do not block subsequent command parsing. During asynchronous processing, the command parameters should be copied first, and then the copied data should be used for command event processing.This interface is used to register command handler callback functions. After the callback is successfully registered, the SDK receives and parses the command protocol sent by the cloud, and then calls the registered callback to execute the business functionalities.
Note that the param
variable in the callback will be released after the callback is invoked. If the callback has asynchronous operations, you need to copy the param
data to the variable space requested by your application.
/**
* @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);
Parameter | Description |
---|---|
sets_handler | This request parameter is the handler callback of the set command. It is implemented by the business application. Register with the SDK through this interface, and the param request parameter of the callback is a command parameter. The application converts this parameter into the specified command parameter struct according to the command type, and then uses it. |
query_handler | This request parameter is the handler callback of the query command. It is implemented by the business application. Register with the SDK through this interface. The param request parameter of the callback is not currently used, and the application does not need to care about it. |
OPERATE_RET | The return value. OPRT_OK means successful execution, and other values mean failed execution. For the meaning of error codes, refer to definitions in the TuyaOS SDK header file. |
The device data reporting interfaces are used to complete data synchronization with Tuya-enabled apps. The following table lists the data reporting features provided by each interface:
Interface | Feature | Remarks |
---|---|---|
ty_rvc_virtual_wall_data_response | Report virtual wall data | When the device data changes, proactively call the interface to report the data. |
ty_rvc_restricted_area_data_response | Report no-go area data | When the device data changes, proactively call the interface to report the data. |
ty_rvc_room_property_data_response | Report room properties data | When the device data changes, proactively call the interface to report the data. |
ty_rvc_room_clean_data_response | Report selected area cleaning data | When the device data changes, proactively call the interface to report the data. |
ty_rvc_spot_clean_data_response | Report selected spot cleaning data | When the device data changes, proactively call the interface to report the data. |
ty_rvc_zone_clean_data_response | Report selected zone cleaning data | When the device data changes, proactively call the interface to report the data. |
ty_rvc_schedule_data_response | Report schedule data | When the device data changes, proactively call the interface to report the data. |
ty_rvc_quiet_hours_data_response | Report DND period data | When the device data changes, proactively call the interface to report the data. |
ty_rvc_voice_language_data_response | Report language switching data | When the device data changes, proactively call the interface to report the data. |
ty_rvc_device_info_data_response | Report device information data | When the device data changes, proactively call the interface to report the data. |
ty_rvc_part_division_data_response | Report the result of splitting the map area | This feature is only used to return the result after the set command is executed. When the panel does not send a set command, the device does not need to call this interface for data synchronization. |
ty_rvc_part_merge_data_response | Report the result of merging the map areas | This feature is only used to return the result after the set command is executed. When the panel does not send a set command, the device does not need to call this interface for data synchronization. |
ty_rvc_map_part_default_data_response | Report the result of restoring default areas on the map | This feature is only used to return the result after the set command is executed. When the panel does not send a set command, the device does not need to call this interface for data synchronization. |
ty_rvc_map_clear_data_response | Report the result of resetting the map | This feature is only used to return the result after the set command is executed. When the panel does not send a set command, the device does not need to call this interface for data synchronization. |
ty_rvc_map_save_data_response | Report the result of saving the map | This feature is only used to return the result after the set command is executed. When the panel does not send a set command, the device does not need to call this interface for data synchronization. |
ty_rvc_map_delete_data_response | Report the result of deleting the map | This feature is only used to return the result after the set command is executed. When the panel does not send a set command, the device does not need to call this interface for data synchronization. |
ty_rvc_map_empty_response | Report the result of querying an empty map | This feature is only used to return the result after the query command is executed. When the panel does not send a query command, the device does not need to call this interface for data synchronization. |
ty_rvc_password_check_response | Report the result of verifying a password | This feature is only used to return the result after the query command is executed. When the panel does not send a query command, the device does not need to call this interface for data synchronization. |
ty_rvc_password_state_response | Report the result of querying a password status | This feature is only used to return the result after the set or query command is executed. When the panel does not send a command, the device does not need to call this interface for data synchronization. |
ty_rvc_password_set_response | Report the result of setting a password | This feature is only used to return the result after the set command is executed. When the panel does not send a set command, the device does not need to call this interface for data synchronization. |
ty_rvc_mcs_room_info_response | Report the result of querying the current room | When the device data changes, proactively call the interface to report the data. |
/**
* @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);
}
........
//This section only shows how to call the interface. In actual use, the actual device data should be obtained in the asynchronous event processing function and reported.
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:{
//Use test data to show data reporting
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;
}
//Power on main process
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);
....
}
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback