Files
energy_storage/src/app/Config.h
2025-09-17 19:55:59 +08:00

58 lines
1007 B
C++

#pragma once
#include <map>
#include <string>
struct AppOption
{
int debug {0};
std::string webSrvUrl;
std::string lunchDate;
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;
} 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;
};
class Config
{
public:
static bool init(std::string filename);
static AppOption::VideoInfo* getVideoInfo(std::string name);
static AppOption option;
};