2025-05-19 09:54:33 +08:00
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
|
|
#include <thread>
|
|
|
|
|
|
|
|
|
|
|
|
#include "Operator.h"
|
2025-08-20 19:00:22 +08:00
|
|
|
|
#include "app/AppData.h"
|
2025-07-31 17:56:08 +08:00
|
|
|
|
|
2025-09-01 20:08:40 +08:00
|
|
|
|
class MqttClient;
|
|
|
|
|
|
|
2025-05-19 09:54:33 +08:00
|
|
|
|
class Application
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
static Application& instance()
|
|
|
|
|
|
{
|
|
|
|
|
|
static Application app;
|
|
|
|
|
|
return app;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-22 19:06:50 +08:00
|
|
|
|
static AppData& data()
|
|
|
|
|
|
{
|
2025-09-01 20:08:40 +08:00
|
|
|
|
return Application::instance().appdata;
|
2025-08-22 19:06:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-05-19 09:54:33 +08:00
|
|
|
|
void init();
|
2025-07-18 09:08:09 +08:00
|
|
|
|
|
2025-09-01 20:08:40 +08:00
|
|
|
|
Operator& getOperator() { return op; }
|
2025-05-19 09:54:33 +08:00
|
|
|
|
|
|
|
|
|
|
void runThreadMain();
|
|
|
|
|
|
|
2025-07-18 09:08:09 +08:00
|
|
|
|
void runThreadDevice();
|
|
|
|
|
|
|
2025-08-20 19:00:22 +08:00
|
|
|
|
public:
|
2025-09-01 20:08:40 +08:00
|
|
|
|
bool isQuit = false;
|
2025-05-19 09:54:33 +08:00
|
|
|
|
|
|
|
|
|
|
// 登录的管理员信息
|
2025-09-01 20:08:40 +08:00
|
|
|
|
Operator op;
|
2025-08-20 19:00:22 +08:00
|
|
|
|
|
|
|
|
|
|
// 应用数据
|
2025-09-01 20:08:40 +08:00
|
|
|
|
AppData appdata;
|
|
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<MqttClient> mqttCli;
|
2025-05-19 09:54:33 +08:00
|
|
|
|
};
|