added individual solenoid deactivation time

This commit is contained in:
Jonas Zeunert
2018-12-11 15:05:47 +01:00
parent f1bb186faa
commit 838d3227c6
4 changed files with 39 additions and 34 deletions

View File

@@ -161,6 +161,12 @@ std::shared_ptr<items::Solenoid> create_solenoid(nlohmann::json &solenoid_json,
{
std::string name = solenoid_json.at("name");
auto address = solenoid_json.at("address").get<uint8_t>();
if(solenoid_json.find("deactivation_time_milliseconds") != solenoid_json.end())
{
deactivation_time = get_deactivation_time(solenoid_json);
}
return std::make_shared<items::Solenoid>(output_gpio_interface, address, name, deactivation_time);
}
catch(json::type_error &e)
@@ -188,9 +194,9 @@ std::shared_ptr<items::Sound> create_sound(nlohmann::json &sound_json, std::shar
try
{
auto id = sound_json.at("id").get<uint>();
std::string name = sound_json.at("name");
std::string description = sound_json.at("description");
auto address = sound_json.at("address").get<uint8_t>();
return std::make_shared<items::Sound>(output_gpio_interface, address, name, deactivation_time, id);
return std::make_shared<items::Sound>(output_gpio_interface, address, description, deactivation_time, id);
}
catch(json::type_error &e)
{