Last Updated on : 2024-07-24 07:06:01download
Based on TuyaOS SDK, this topic describes the process and APIs for transmitting multiple floor maps and the cleaning history of laser robot vacuums.
/**
* @brief tuya_iot_map_record_upload_buffer
* @desc Robot vacuum function. Upload record map info
*
* @param[in] map_id
* @param[in] buffer
* @param[in] len
* @param[in] descript
*
* @return OPERATE_RET
*/
OPERATE_RET tuya_iot_map_record_upload_buffer(IN CONST INT_T map_id, IN CONST BYTE_T *buffer, IN CONST UINT_T len, IN CONST CHAR_T *descript);
Function: Upload the cleaning history.
Parameter | Description |
---|---|
map_id | The ID of the specified local map. |
buffer | The content of the reported data. For more information about data formats, see Tuya laser robot vacuum protocol. |
len | The length of the reported data. |
descript | The description information in the format similar to RecordId_BeginTime_CleanTime_CleanArea_MapLen_PathLen_VirtualLen . For more information, see Tuya laser robot vacuum protocol. |
Return value:
Return value | Description |
---|---|
OPRT_OK | The operation succeeded. |
Error code | The error code on a failed operation. |
/***********************************************************
* Function: tuya_iot_map_upload_files
* Desc: Robot vacuum function. Upload cleaning map info
* Input: bitmap_file& datamap_file & descript
* output: map_id
* Return: OPERATE_RET
***********************************************************/
OPERATE_RET tuya_iot_map_upload_files(IN CONST CHAR_T *bitmap_file, IN CONST CHAR_T *datamap_file, IN CONST CHAR_T *descript, OUT CONST UINT_T *map_id);
Function: Upload maps.
Parameter | Description |
---|---|
bitmap_file | Upload the map file used for display on the mobile app. The file name must not exceed 16 bytes. For more information about the file format, see Tuya laser robot vacuum protocol. |
datamap_file | The format is user-defined, but the file name must not exceed 16 bytes. |
descript | The description information. Refer to the format in the mm_bin_mapid_nowtime.txt file. For more information, see Tuya laser robot vacuum protocol. |
map_id | The returned map ID after the data is reported. |
Return value:
Return value | Description |
---|---|
OPRT_OK | The operation succeeded. |
Error code | The error code on a failed operation. |
/***********************************************************
* Function: tuya_iot_map_update_files
* Desc: Robot vacuum function. Update cleaning map info
* Input: map_id
* Input: bitmap & data_map_file
* Return: OPERATE_RET
***********************************************************/
OPERATE_RET tuya_iot_map_update_files(IN CONST UINT_T map_id, IN CONST CHAR_T *bitmap_file, IN CONST CHAR_T *data_map_file);
Function: Update the map data by map ID.
Parameter | Description |
---|---|
map_id | cloud_map_id . The map ID assigned by the cloud server when uploading the map for the first time. |
bitmap_file | The full map file to be updated, used for display on the mobile app. |
data_map_file | The format is user-defined. |
Return value:
Return value | Description |
---|---|
OPRT_OK | The operation succeeded. |
Error code | The error code on a failed operation. |
/***********************************************************
* Function: tuya_iot_map_delete
* Desc: Robot vacuum function. Delete map files in cloud
* Input: map_id
* Return: OPERATE_RET
***********************************************************/
OPERATE_RET tuya_iot_map_delete(IN CONST UINT_T map_id);
Function: Delete map files from the cloud.
Parameter | Description |
---|---|
map_id | cloud_map_id . The map ID assigned by the cloud server. |
Return value:
Return value | Description |
---|---|
OPRT_OK | The operation succeeded. |
Error code | The error code on a failed operation. |
/***********************************************************
* Function: tuya_iot_get_all_maps_info
* Desc: Robot vacuum function. Get map files
* Input: map_info
* Input: info_len
* Output: get all map info (Maximum 5 sets of data)
* Return: OPERATE_RET
***********************************************************/
OPERATE_RET tuya_iot_get_all_maps_info(OUT M_MAP_INFO *map_info, INOUT UINT8_T *info_len);
Function: Get a list of floor map files.
Parameter | Description |
---|---|
map_info | The list of map information. For more information, see the M_MAP_INFO struct. |
info_len | The number of maps to be obtained. Maximum value: 5 . |
Return value:
Return value | Description |
---|---|
OPRT_OK | The operation succeeded. |
Error code | The error code on a failed operation. |
/***********************************************************
* Function: tuya_iot_get_map_files
* Desc: Robot vacuum function. Get map files
* Input: map_id
* Input: map_path
* Output: map files under map_path path.
* Return: OPERATE_RET
***********************************************************/
OPERATE_RET tuya_iot_get_map_files(IN CONST UINT_T map_id, IN CONST CHAR_T *map_path);
Function: Download the map file by map_id
and store it in the specified directory.
Parameter | Description |
---|---|
map_id | cloud_map_id . The map ID assigned by the cloud server. |
map_path | The path where the downloaded map file resides. |
Return value:
Return value | Description |
---|---|
OPRT_OK | The operation succeeded. |
Error code | The error code on a failed operation. |
In the API for reporting map files, the bitmap_file
and datamap_file
map files cannot be empty, nor can they be passed in with the same file. Otherwise, the unique index in the cloud will conflict and an error will occur in the database.
In the APIs for updating, deleting, and obtaining specified map files, map_id
is an ID assigned by the cloud server. Properly keep this ID.
When you use the APIs for transmitting multiple floor maps and the cleaning history, implement a retransmission mechanism to avoid unsuccessful data reporting due to network jitter.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback