basic application support

This commit is contained in:
Ken Van Hoeylandt
2023-12-25 17:53:58 +01:00
parent 7886d5c2f9
commit e6525364c6
21 changed files with 341 additions and 122 deletions
+32
View File
@@ -0,0 +1,32 @@
#include "nb_app.h"
#include <esp_check.h>
#include <string.h>
static const char* TAG = "nb_app";
esp_err_t nb_app_config_validate(nb_app_config_t* _Nonnull app) {
ESP_RETURN_ON_FALSE(
strlen(app->id) < NB_APP_ID_LENGTH,
ESP_FAIL,
TAG,
"app id cannot be larger than %d characters",
NB_APP_ID_LENGTH - 1
);
ESP_RETURN_ON_FALSE(
strlen(app->name) < NB_APP_NAME_LENGTH,
ESP_FAIL,
TAG,
"app name cannot be larger than %d characters",
NB_APP_NAME_LENGTH - 1
);
ESP_RETURN_ON_FALSE(
(app->on_update == NULL) == (app->update_task_priority == 0 && app->update_task_priority == 0),
ESP_FAIL,
TAG,
"app update is inconsistently configured"
);
return ESP_OK;
}