refactor(structure): move layered firmware modules from main to components
This commit is contained in:
47
components/domain/src/system_runtime.c
Normal file
47
components/domain/src/system_runtime.c
Normal file
@@ -0,0 +1,47 @@
|
||||
#include "system_runtime.h"
|
||||
|
||||
#include "platform_bootstrap.h"
|
||||
#include "wifi_manager.h"
|
||||
|
||||
static bool s_runtime_started;
|
||||
|
||||
esp_err_t system_runtime_start(void) {
|
||||
if (s_runtime_started) {
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t err = platform_bootstrap_init();
|
||||
if (err != ESP_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
err = wifi_manager_start();
|
||||
if (err != ESP_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
s_runtime_started = true;
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t system_runtime_shutdown(void) {
|
||||
if (!s_runtime_started) {
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t err = wifi_manager_stop();
|
||||
s_runtime_started = false;
|
||||
return err;
|
||||
}
|
||||
|
||||
esp_err_t system_runtime_bootstrap(void) {
|
||||
return system_runtime_start();
|
||||
}
|
||||
|
||||
bool system_runtime_wifi_ready(void) {
|
||||
return wifi_manager_is_ready();
|
||||
}
|
||||
|
||||
void system_runtime_get_ip(char *buf, size_t buf_len) {
|
||||
wifi_manager_get_ip(buf, buf_len);
|
||||
}
|
||||
Reference in New Issue
Block a user