OTA

    Since:

    1.0

    Version:

    1.0

    Summary

    Files

    Functions

    Function Name

    Description

    (unsigned int flag)

    int 

    Sets the switch for using the default upgrade package format.

    HotaGetUpdateIndex (unsigned int index)

    int 

    Obtains the index of the A/B partition to be upgraded.

    (ErrorCallBackFunc errorCallback, StatusCallBackFunc statusCallback)

    int 

    Initializes the OTA module.

    HotaWrite (unsigned char buffer, unsigned int offset, unsigned int buffSize)

    int 

    Writes specified data into flash memory.

    (unsigned int offset, unsigned int bufLen, unsigned char *buf)

    int 

    Reads the data that has been written into flash memory.

    HotaCancel (void)

    int 

    Cancels an upgrade.

    int 

    Sets the system state to be upgrading after data has been written into flash memory by .

    HotaRestart (void)

    int 

    Restarts the system after an upgrade.

    Function Documentation

    HotaCancel()

    Description:

    Cancels an upgrade.

    If an upgrade fails or is interrupted, you can use this function to cancel it.

    Returns:

    Returns 0 if the operation is successful; returns -1 otherwise.

    HotaGetUpdateIndex()

    Description:

    Obtains the index of the A/B partition to be upgraded.

    In the A/B upgrade scenario, you can use this function to determine whether partition A or B will be upgraded.

    Parameters:

    Returns:

    Returns 0 if the operation is successful; returns -1 otherwise.

    Description:

    Initializes the OTA module.

    Parameters:

    Name

    Description

    errorCallback Indicates the callback invoked when an error occurs during the upgrade. This parameter can be null.
    statusCallback Indicates the callback invoked when the upgrade status changes. This parameter can be null.

    Returns:

    Returns 0 if the operation is successful; returns -1 otherwise.

    HotaRead()

    Description:

    Reads the data that has been written into flash memory.

    This function is required for verifying data correctness when the default upgrade package format is not used. It is not required when the default upgrade package format is used.

    Returns:

    Returns 0 if the operation is successful; returns -1 otherwise.

    HotaRestart()

    Description:

    Restarts the system after an upgrade.

    You need to call this function after you have called the HotaSetBootSettings function.

    Returns:

    Returns 0 if the operation is successful; returns -1 otherwise.

    HotaSetBootSettings()

    Description:

    Sets the system state to be upgrading after data has been written into flash memory by HotaWrite.

    After this operation is successful, you need to call the function to complete the upgrade.

    Returns:

    Returns 0 if the operation is successful; returns -1 otherwise.

    Description:

    Sets the switch for using the default upgrade package format.

    You can call this function to choose the default upgrade package format when developing the system upgrade capability. If the default upgrade package format is used, the system ensures the security and integrity of the upgrade package. If it is not used, you need to ensure the security and integrity of the upgrade package you have chosen. To be specific, you need to call the HotaRead function to read the data that has been written into flash memory, and then verify the data.

    Parameters:

    Name

    Description

    flag Specifies whether to use the default system upgrade package format. The value 1 (default value) means to use it, and 0 means not to use it.

    Returns:

    Returns 0 if the operation is successful; returns -1 otherwise.

    HotaWrite()

      Description:

      Writes specified data into flash memory.

      Parameters:

      Returns: