Files
energy_storage/src/app/Config.h
2025-09-24 19:06:31 +08:00

66 lines
1.1 KiB
C++

#pragma once
#include <map>
#include <string>
struct AppOption
{
int debug {0};
std::string webSrvUrl;
std::string lunchDate;
std::string exportpath;
struct {
std::string host;
int port;
std::string user;
std::string passwd;
std::string dbname;
} database;
struct {
int useToken {1};
int port {0};
int encryption {1};
std::string encryptKey;
} http;
struct {
std::string host;
std::string username;
std::string password;
int interval {60};
} mqtt;
struct {
float latitude {0};
float longitude {0};
float altitude {0};
} view;
struct VideoInfo {
std::string host;
int port;
std::string user;
std::string passwd;
};
std::map<std::string, VideoInfo> mapVideo;
int windowEnabled {0};
struct {
int enabled {0};
int interval {60};
} stat;
};
class Config
{
public:
static bool init(std::string filename);
static AppOption::VideoInfo* getVideoInfo(std::string name);
static AppOption option;
};