ESP32_RTOS_SDK V1.1.0

- Main Page
- Modules
- Data Structures
- Files

Data Structures | Macros | Typedefs | Enumerations | Functions
OTA APIs
System APIs

OTA APIs. More...

## Data Structures

struct | remote_bin_info
struct | server_info
struct | upgrade_info

## Macros

#define | SPI_FLASH_SEC_SIZE 4096

## Typedefs

typedef void(* | upgrade_states_check_callback) (void *arg)
| upgrade check call function type More...

## Enumerations

enum | ota_error_id { UPGRADE_OK, UPGRADE_FLAG_ERROR = 10000, NO_STATION_IP_ERROR = 10001, UPGRADE_MEM_ERROR = 10002, CREATE_SOCKET_ERROR = 10003, SEND_QUEUE_ERROR = 10004, SERVER_CONNECT_ERROR = 10005, SEND_URL_ERROR = 10006, HTTP_HEAD_ERROR = 10007, DOWNLOAD_TIMEOUT_ERROR = 10008, GET_BIN_LENGTH_ERROR = 10009, ERASE_FLASH_ERROR = 10010,
RECV_DATA_ERROR = 10011, BIN_MAGIC_ERROR = 10012, USER_ID_CONFLICT_ERROR = 10013, FLASH_ID_CONFLICT_ERROR = 10014,
CRC_CHECK_FAILED_ERROR = 10015
}
enum | { NO_READY = 1, TENTATIVE, READY }

## Functions

bool | system_upgrade_start (struct upgrade_info *server)
| start upgrade progress More...
bool | system_upgrade_init (uint8 b_id, uint8 start_flash_id)
| init upgrade progress More...
void | system_upgrade_deinit (void)
| deinit upgrade progress More...
enum ota_error_id | system_upgrade_get_error_id (void)
| get error id of upgrade progress More...
uint8 | upgrade_get_process_rate (void)
| get download rate process More...
bool | upgrade_get_remote_bin_info (struct server_info *s_if, struct remote_bin_info *rb_if)
| get bin's sum length and lenth of irom1 part in remote server More...

## Detailed Description

OTA APIs.

## Typedef Documentation

typedef void(* upgrade_states_check_callback) (void *arg)

upgrade check call function type

Parameters

  void | * arg : call back parameter

Returns
  void

## Enumeration Type Documentation

anonymous enum

Enumerator
NO_READY | bin file is broken or not a correct bin file
TENTATIVE | bin file has been downloaded in flash but never run
READY | bin is runing or has run before

enum ota_error_id

Enumerator
UPGRADE_OK | OTA succeed
UPGRADE_FLAG_ERROR | OTA is in progress, can not start it again
NO_STATION_IP_ERROR | ESP32 station does not get IP address
UPGRADE_MEM_ERROR | fail to alloc memory, maybe NULL pointer, or out of memory
CREATE_SOCKET_ERROR | fail to create socket
SEND_QUEUE_ERROR | fail to send message into queue
SERVER_CONNECT_ERROR | fail to connect to the OTA server
SEND_URL_ERROR | fail to send HTTP request
HTTP_HEAD_ERROR | can not parse the HTTP response from OTA server
DOWNLOAD_TIMEOUT_ERROR | OTA time out
GET_BIN_LENGTH_ERROR | fail to get the length of the OTA bin file
ERASE_FLASH_ERROR | fail to erase flash
RECV_DATA_ERROR | fail to receive the OTA bin file
BIN_MAGIC_ERROR | the OTA bin file's magic check fail, invalid bin file
USER_ID_CONFLICT_ERROR | the bin ID is using, can not set the same bin ID when calling system_upgrade_init
FLASH_ID_CONFLICT_ERROR | the new OTA bin will overlap with the current bin, so the downloading is rejected
CRC_CHECK_FAILED_ERROR | the new OTA bin's CRC check fail

## Function Documentation

void system_upgrade_deinit | ( | void |  | ) |

deinit upgrade progress

Attention
  this API should be called in upgrade check call back function or called after it

Parameters

  void |

Returns
  void

enum ota_error_id system_upgrade_get_error_id | ( | void |  | ) |

get error id of upgrade progress

Parameters

  void |

Returns
  enum ota_error_id : explanation in enum ota_error_id

bool system_upgrade_init | ( | uint8 | b_id,
|  | uint8 | start_flash_id
| ) |  |

init upgrade progress

Parameters

  uint8 | b_id : b_id number, must < 5
  uint8 | start_flash_id : define a block in flash is 256KB, a block correspond a flash id start flash id means bin file's start flash id

Returns
  true : succeed
  false : fail

bool system_upgrade_start | ( | struct upgrade_info * | server | ) |

start upgrade progress

Attention
  call this API should init server param firstly

Parameters

  struct | upgrade_info *server : upgrade info contains remote server and callback func

Returns
  true : succeed
  false : fail

uint8 upgrade_get_process_rate | ( | void |  | ) |

get download rate process

Parameters

  void |

Returns
  uint8 : return x means x%

bool upgrade_get_remote_bin_info | ( | struct server_info * | s_if,
|  | struct remote_bin_info * | rb_if
| ) |  |

get bin's sum length and lenth of irom1 part in remote server

Parameters

  struct | server_info *s_if :remote server info
  struct | remote_bin_info *rb_if : point to remote bin's info

Returns
  true : succeed
  false : fail