application class, still broken
This commit is contained in:
@@ -4,25 +4,47 @@
|
||||
#include <cpu.hpp>
|
||||
#include <gpu.hpp>
|
||||
#include <mutex>
|
||||
#include <semaphore>
|
||||
#include <stop_token>
|
||||
#include <sys.hpp>
|
||||
|
||||
namespace app {
|
||||
class Application {
|
||||
struct Sensors {
|
||||
sys::TimeDate td;
|
||||
double avg[3] = {0.0f};
|
||||
sys::Memory ram;
|
||||
sys::Disk home;
|
||||
sys::Network net;
|
||||
sys::sysSensors sys;
|
||||
cpu::cpuSensors cpu;
|
||||
gpu::gpuSensors gpu;
|
||||
double hass_state = 0.0f;
|
||||
std::mutex mtx; // making sure the struct isnt accessed by multiple threads at once
|
||||
};
|
||||
|
||||
struct sensors {
|
||||
sys::TimeDate td;
|
||||
double avg[3] = {0.0f};
|
||||
sys::Memory ram;
|
||||
sys::Disk home;
|
||||
sys::Network net;
|
||||
sys::sysSensors sys;
|
||||
cpu::cpuSensors cpu;
|
||||
gpu::gpuSensors gpu;
|
||||
double hass_state = 0.0f;
|
||||
std::mutex mtx; // making sure the struct isnt accessed by multiple threads at once
|
||||
struct Semaphores {
|
||||
inline static std::binary_semaphore display{0};
|
||||
inline static std::binary_semaphore main{0};
|
||||
};
|
||||
|
||||
std::string lcd_port;
|
||||
uint16_t lcd_interval_ms = 500;
|
||||
uint8_t lcd_contrast = 215;
|
||||
|
||||
std::string cpu_pciaddr = "0000:00:18.3";
|
||||
std::string gpu_pciaddr = "0000:0b:00.0";
|
||||
std::string sys_sensor = "nct6775.656";
|
||||
std::string sys_ifname = "enp4s0f0";
|
||||
std::string home_dir = "/home/drath";
|
||||
|
||||
static void signalHandler(int);
|
||||
static void hassThread(const std::stop_token& st, Sensors& s);
|
||||
static void sensorsThread(const std::stop_token& st, Sensors& s);
|
||||
static void displayThread(const std::stop_token& st, Sensors& s);
|
||||
|
||||
public:
|
||||
explicit Application(const std::string& display_port);
|
||||
void Run();
|
||||
};
|
||||
|
||||
void run();
|
||||
|
||||
} // namespace app
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user