mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Added first quick and dirty implementation of own server (HyperionDispmanX.cpp).
This commit is contained in:
38
test/TestConfigFile.cpp
Normal file
38
test/TestConfigFile.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
// STL includes
|
||||
#include <cstdlib>
|
||||
|
||||
// JsonSchema includes
|
||||
#include <utils/jsonschema/JsonFactory.h>
|
||||
|
||||
// hyperion includes
|
||||
#include <hyperion/LedString.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::string homeDir = getenv("RASPILIGHT_HOME");
|
||||
|
||||
const std::string schemaFile = homeDir + "/hyperion.schema.json";
|
||||
const std::string configFile = homeDir + "/hyperion.config.json";
|
||||
|
||||
Json::Value config;
|
||||
if (JsonFactory::load(schemaFile, configFile, config) < 0)
|
||||
{
|
||||
std::cerr << "UNABLE TO LOAD CONFIGURATION" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
const Json::Value& deviceConfig = config["device"];
|
||||
const Json::Value& ledConfig = config["leds"];
|
||||
const Json::Value& colorConfig = config["color"];
|
||||
|
||||
std::cout << "COLOR CONFIGURATION: " << colorConfig.toStyledString() << std::endl;
|
||||
|
||||
const Json::Value& redConfig = colorConfig["red"];
|
||||
double redGamma = redConfig["gamma"].asDouble();
|
||||
std::cout << "RED GAMMA = " << redGamma << std::endl;
|
||||
std::cout << "RED GAMMA = " << colorConfig["red.gamma"].asDouble() << std::endl;
|
||||
LedString ledString = LedString::construct(ledConfig, colorConfig);
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user