implemented lamp

This commit is contained in:
Jonas Zeunert
2018-12-11 14:42:21 +01:00
parent c24b787c43
commit be7afc6261

View File

@@ -169,6 +169,20 @@ std::shared_ptr<items::Solenoid> create_solenoid(nlohmann::json &solenoid_json,
}
}
std::shared_ptr<items::Lamp> create_lamp(nlohmann::json &lamp_json, std::shared_ptr<IOutputGPIOInterface> output_gpio_interface)
{
try
{
std::string name = lamp_json.at("name");
uint8_t address = lamp_json.at("address").get<uint8_t>();
return std::make_shared<items::Lamp>(output_gpio_interface, address, name);
}
catch(json::type_error &e)
{
// todo log and exit
}
}
std::shared_ptr<items::Sound> create_sound(nlohmann::json &sound_json, std::shared_ptr<IOutputGPIOInterface> &output_gpio_interface, std::chrono::milliseconds deactivation_time)
{
try