mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
d60cca9e20
Former-commit-id: 6630f588a739a08601c0db79abd2cdf0b1c1839c
37 lines
1.1 KiB
C++
37 lines
1.1 KiB
C++
// stl includes
|
|
#include <cctype>
|
|
#include <algorithm>
|
|
|
|
// Bootsequence includes
|
|
#include <bootsequence/BootSequenceFactory.h>
|
|
|
|
// Local Bootsequence includes
|
|
#include "RainbowBootSequence.h"
|
|
#include "KittBootSequence.h"
|
|
|
|
BootSequence * BootSequenceFactory::createBootSequence(Hyperion * hyperion, const Json::Value & jsonConfig)
|
|
{
|
|
std::string type = jsonConfig["type"].asString();
|
|
std::transform(type.begin(), type.end(), type.begin(), ::tolower);
|
|
|
|
if (type == "none")
|
|
{
|
|
return nullptr;
|
|
}
|
|
else if (type == "rainbow")
|
|
{
|
|
std::cout << "SELECTED BOOT SEQUENCE: " << "RAINBOW" << std::endl;
|
|
const unsigned duration_ms = jsonConfig["duration_ms"].asUInt();
|
|
return new RainbowBootSequence(hyperion, duration_ms);
|
|
}
|
|
else if (type == "knightrider" || type == "knight rider" || "knight_rider")
|
|
{
|
|
std::cout << "SELECTED BOOT SEQUENCE: " << "KITT" << std::endl;
|
|
const unsigned duration_ms = jsonConfig["duration_ms"].asUInt();
|
|
return new KittBootSequence(hyperion, duration_ms);
|
|
}
|
|
|
|
std::cerr << "Unknown boot-sequence selected; boot-sequence disabled." << std::endl;
|
|
return nullptr;
|
|
}
|