2024-07-16 19:05:20 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include "esp_system.h"
|
|
|
|
|
2024-07-27 13:31:17 +00:00
|
|
|
#include "dev_name.h"
|
|
|
|
#include "storage.h"
|
2024-07-27 14:15:35 +00:00
|
|
|
#include "system.h"
|
2024-07-27 14:34:41 +00:00
|
|
|
#include "crypto.h"
|
2024-07-27 13:31:17 +00:00
|
|
|
|
2024-07-16 19:05:20 +00:00
|
|
|
void app_main(void)
|
|
|
|
{
|
2024-07-27 13:31:17 +00:00
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
if (storage_init() == false)
|
|
|
|
{
|
|
|
|
printf("Failed to init storage!\n");
|
2024-07-27 14:15:35 +00:00
|
|
|
reboot();
|
2024-07-27 13:31:17 +00:00
|
|
|
}
|
|
|
|
|
2024-07-27 14:15:35 +00:00
|
|
|
if (dev_generate_name())
|
2024-07-27 13:31:17 +00:00
|
|
|
{
|
|
|
|
printf("Generated a new device name\n");
|
|
|
|
}
|
|
|
|
|
2024-07-27 14:34:41 +00:00
|
|
|
char *name = dev_name();
|
|
|
|
printf("Dev name: %s\n", name);
|
|
|
|
free(name);
|
|
|
|
|
2024-07-27 14:15:35 +00:00
|
|
|
if (crypto_gen_priv_key())
|
|
|
|
{
|
|
|
|
printf("Generated device private key!\n");
|
|
|
|
}
|
|
|
|
|
2024-07-27 14:34:41 +00:00
|
|
|
reboot();
|
2024-07-16 19:05:20 +00:00
|
|
|
}
|