platformIO
lib_deps =
https://github.com/111KNUIM-EaaS/esp32-EaaS
main.cpp
#include <Arduino.h>
#include <EaaS.h>
void setup() {
init_EaaS();
}
void loop() {
loop_eaas();
}
void init_EaaS(void);
π call this function in setup()
void loop_eaas(void *parameter);
π When OTA is running, this function is ready to Get OTA data.
void EaaS_OTA();
π When OTA is running, loop_eaas will call to this function.
void init_EaaS_OTA(char *user, char *passwd);
π« This function is save user and password for EaaS_OTA file.
int flash_EaaS_firmware();
π« This function is flash EaaS_OTA firmware.
return
0
is susses, other is fail.
esp_err_t init_Eaas_nvs (void);
ποΈ This function is init nvs.
esp_err_t open_Eaas_nvs (nvs_handle_t *handle, const char* name);
ποΈ This function is open nvs.
esp_err_t get_sta_ssid (nvs_handle_t *handle, char** ssid);
esp_err_t get_sta_password (nvs_handle_t *handle, char** password);
esp_err_t get_user_password (nvs_handle_t *handle, char** password);
esp_err_t get_nvs_str (nvs_handle_t *handle, const char* name, char** value);
esp_err_t get_mac (nvs_handle_t *handle, uint8_t* mac, char** user_name);
ποΈ This function is get nvs data.
esp_err_t close_Eaas_nvs (nvs_handle_t *handle);
ποΈ This function is close nvs.
void init_EaaS_network(const char* ssid, const char* password, const uint8_t* mac);
π This function is init network.
void init_client(char* user, char* passwd);
π This function is init client and save user and password.
void set_machine_status(const uint8_t status);
π This function is set machine status.
0
: offline
, 1
: booting
, 2
: boot
, 3
: pausing
, 4
: pause
, 5
: otaing
, 6
: ota
uint8_t loop_eaas_status();
π This function is loop eaas, Get status from server.