/ firmware / include / services / system.h
system.h
 1  #pragma once
 2  
 3  #include "services/data_logger.h"
 4  #include <identity.h>
 5  #include <storage.h>
 6  #include <networking/wifi.h>
 7  #include "power/sleep.h"
 8  
 9  #include <stddef.h>
10  #include <stdint.h>
11  
12  struct SystemSnapshot {
13    DeviceIdentitySnapshot identity;
14    NetworkStatusSnapshot network;
15    StorageSnapshot storage;
16    uint32_t uptime_seconds;
17    uint32_t heap_free;
18    uint32_t heap_total;
19    uint32_t heap_min_free;
20    uint32_t heap_max_alloc;
21    uint32_t psram_total;
22    uint32_t psram_free;
23    char chip_model[32];
24    uint32_t chip_cores;
25    uint32_t chip_revision;
26    uint32_t cpu_mhz;
27    uint32_t flash_size;
28    uint32_t flash_speed_mhz;
29    uint32_t sketch_size;
30    uint32_t sketch_free;
31    float chip_temperature_celsius;
32    char sdk_version[32];
33    char idf_version[32];
34    char arduino_version[32];
35    char sketch_md5[40];
36    SleepStatusSnapshot sleep;
37    DataLoggerStatusSnapshot data_logger;
38  };
39  
40  struct SystemQuery {
41    StorageKind preferred_storage;
42    SystemSnapshot snapshot;
43  };
44  
45  namespace services::system {
46  
47  bool accessSnapshot(SystemQuery *query);
48  size_t formatUptime(char *buf, size_t len, uint32_t uptime_seconds);
49  
50  }
51