/**
 * @file tkl_ota.c
 * @brief this file was auto-generated by tuyaos v&v tools, developer can add implements between BEGIN and END
 *
 * @warning: changes between user 'BEGIN' and 'END' will be keeped when run tuyaos v&v tools
 *           changes in other place will be overwrited and lost
 *
 * @copyright Copyright 2020-2021 Tuya Inc. All Rights Reserved.
 *
 */

// --- BEGIN: user defines and implements ---
#include "tkl_ota.h"
#include "tuya_error_code.h"
// --- END: user defines and implements ---

/**
 * @brief get ota ability
 *
 * @param[out] image_size:  max image size
 * @param[out] type:   TUYA_OTA_TYPE_E, full package or compress package use TUYA_OTA_FULL, difference ota use
 * TUYA_OTA_DIFF
 * @note This API is used for get chip ota ability
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */
OPERATE_RET tkl_ota_get_ability(uint32_t *image_size, TUYA_OTA_TYPE_E *type)
{
    // --- BEGIN: user implements ---
    *image_size = -1;
    *type = TUYA_OTA_FULL | TUYA_OTA_DIFF;

    return OPRT_OK;
    // --- END: user implements ---
}

/**
 * @brief ota start notify
 *
 * @param[in] image_size:  image size
 * @param[in] type:        ota type
 * @param[in] path:        ota path
 *
 * @note This API is used for ota start notify
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */
OPERATE_RET tkl_ota_start_notify(uint32_t image_size, TUYA_OTA_TYPE_E type, TUYA_OTA_PATH_E path)
{
    // --- BEGIN: user implements ---
    return OPRT_OK;
    // --- END: user implements ---
}

/**
 * @brief ota data process
 *
 * @param[in] pack:       point to ota pack
 * @param[in] remain_len: ota pack remain len
 *
 * @note This API is used for ota data process
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */
OPERATE_RET tkl_ota_data_process(TUYA_OTA_DATA_T *pack, uint32_t *remain_len)
{
    // --- BEGIN: user implements ---
    return OPRT_OK;
    // --- END: user implements ---
}

/**
 * @brief ota end notify
 *
 * @param[in] reset:  ota reset
 *
 * @note This API is used for ota end notify
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */
OPERATE_RET tkl_ota_end_notify(BOOL_T reset)
{
    // --- BEGIN: user implements ---
    return OPRT_OK;
    // --- END: user implements ---
}

/**
 * @brief get old firmware info
 *
 * @param[out] image_size:  max image size
 * @param[out] type:        ota type
 *
 * @note This API is used for old firmware info, and only used in resumes transmission at break-points
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */
OPERATE_RET tkl_ota_get_old_firmware_info(TUYA_OTA_FIRMWARE_INFO_T **info)
{
    // --- BEGIN: user implements ---
    return OPRT_NOT_SUPPORTED;
    // --- END: user implements ---
}
