-
Notifications
You must be signed in to change notification settings - Fork 193
OTA over HTTPS (MEGH-6086) #339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 14 commits
f7646ba
60bb022
aff9701
78a0279
fedddb3
cd4e09c
94f020d
08c11cc
7b10423
beb93ff
12422d2
2fffb75
bb1b220
952c617
6cc26d0
9e8d35c
2f07c87
d4c5448
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,13 @@ typedef enum { | |
OTA_STATUS_REJECTED, | ||
} ota_status_t; | ||
|
||
/** Returns string representation of ota_status_t for reporting | ||
* | ||
* @param status ota_status_t variant | ||
* @return string representation for provided status, "invalid" if not valid status | ||
*/ | ||
char *esp_rmaker_ota_status_to_string(ota_status_t status); | ||
|
||
/** OTA Workflow type */ | ||
typedef enum { | ||
/** OTA will be performed using services and parameters. */ | ||
|
@@ -66,6 +73,20 @@ typedef enum { | |
/** The OTA Handle to be used by the OTA callback */ | ||
typedef void *esp_rmaker_ota_handle_t; | ||
|
||
/** Function Prototype for Reporting Intermediate OTA States | ||
* | ||
* This function is called to notify RainMaker dashbord of OTA Progress | ||
* | ||
* @param ota_job_id Job Id to report. | ||
* @param status OTA status to report. | ||
* @param additional_info Descriptionn to report. | ||
* | ||
* @return ESP_OK on success | ||
* @return error on faliure | ||
*/ | ||
typedef esp_err_t (*esp_rmaker_ota_report_fn_t)(char *ota_job_id, ota_status_t status, char* additional_info); | ||
|
||
|
||
/** OTA Data */ | ||
typedef struct { | ||
/** The OTA URL received from ESP RainMaker Cloud */ | ||
|
@@ -83,6 +104,8 @@ typedef struct { | |
char *priv; | ||
/** OTA Metadata. Applicable only for OTA using Topics. Will be received (if applicable) from the backend, along with the OTA URL */ | ||
char *metadata; | ||
/** The Function to be called for reporting OTA status. This can be used if needed to override transport of OTA*/ | ||
esp_rmaker_ota_report_fn_t report_fn; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a breaking change if I'm not mistaken. Please, increase the component version and update in the dependencies accordingly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated the changelog. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do increase the minor version in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @shreyash-b regarding #339 (comment) please increase the esp-rainmaker's compont minor version. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
} esp_rmaker_ota_data_t; | ||
|
||
/** Function prototype for OTA Callback | ||
|
@@ -223,6 +246,21 @@ esp_err_t esp_rmaker_ota_report_status(esp_rmaker_ota_handle_t ota_handle, ota_s | |
* */ | ||
esp_err_t esp_rmaker_ota_default_cb(esp_rmaker_ota_handle_t handle, esp_rmaker_ota_data_t *ota_data); | ||
|
||
/** Clear Rollback flag | ||
* The default OTA callback stores a value in NVS as a flag to denote if an OTA was recently installed. | ||
* This flag is then read to decide if firmware has been rolled back. | ||
* This function can be called to erase that flag. | ||
*/ | ||
esp_err_t esp_rmaker_ota_erase_rollback_flag(void); | ||
|
||
/** Returns whether OTA validation is pending. | ||
* Returns true if firmware validation is pending after an OTA. | ||
* This can be reset using esp_rmaker_ota_erase_rollback_flag() | ||
* | ||
* @return true if validation is pending, false otherwises | ||
*/ | ||
bool esp_rmaker_ota_is_ota_validation_pending(void); | ||
|
||
/** Fetch OTA Info | ||
* | ||
* For OTA using Topics, this API can be used to explicitly ask the backend if an OTA is available. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
set(priv_req rmaker_common esp_rainmaker esp_timer esp_netif esp_http_client esp-tls app_update mbedtls esp_schedule json_parser json_generator) | ||
|
||
idf_component_register(SRC_DIRS "src" | ||
INCLUDE_DIRS "include" | ||
PRIV_INCLUDE_DIRS "src" | ||
PRIV_REQUIRES ${priv_req} | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
menu "ESP RainMaker HTTPS OTA Config" | ||
config OTA_HTTPS_AUTOFETCH_ENABLED | ||
bool "Enable Autofetch" | ||
default y | ||
help | ||
Enable periodic checking of OTA. | ||
|
||
config OTA_HTTPS_AUTOFETCH_PERIOD | ||
int "Autofetch Period" | ||
depends on OTA_HTTPS_AUTOFETCH_ENABLED | ||
default 2 | ||
help | ||
The time period(in hours) for checking OTA. | ||
If disabled, OTA is only checked once, when HTTPS OTA is enabled. | ||
|
||
config OTA_HTTPS_ROLLBACK_PERIOD | ||
int "Rollback Period" | ||
default 90 | ||
help | ||
The time period for checking if OTA is valid. | ||
If OTA is not marked valid in this timeframe, firmware is rolled back. | ||
|
||
config OTA_HTTPS_APPLY_STACK_SIZE | ||
int "Stack size(in bytes) of the task reponsible for calling the OTA callback" | ||
default 3072 | ||
endmenu |
Uh oh!
There was an error while loading. Please reload this page.