code smells
This commit is contained in:
@@ -146,7 +146,7 @@ std::chrono::milliseconds get_deactivation_time(nlohmann::json &json)
|
||||
{
|
||||
try
|
||||
{
|
||||
uint deactivation_time = json.at("deactivation_time_milliseconds").get<uint>();
|
||||
auto deactivation_time = json.at("deactivation_time_milliseconds").get<uint>();
|
||||
return std::chrono::milliseconds(deactivation_time);
|
||||
}
|
||||
catch(json::type_error &e)
|
||||
@@ -160,7 +160,7 @@ std::shared_ptr<items::Solenoid> create_solenoid(nlohmann::json &solenoid_json,
|
||||
try
|
||||
{
|
||||
std::string name = solenoid_json.at("name");
|
||||
uint8_t address = solenoid_json.at("address").get<uint8_t>();
|
||||
auto address = solenoid_json.at("address").get<uint8_t>();
|
||||
return std::make_shared<items::Solenoid>(output_gpio_interface, address, name, deactivation_time);
|
||||
}
|
||||
catch(json::type_error &e)
|
||||
@@ -174,7 +174,7 @@ std::shared_ptr<items::Lamp> create_lamp(nlohmann::json &lamp_json, std::shared_
|
||||
try
|
||||
{
|
||||
std::string name = lamp_json.at("name");
|
||||
uint8_t address = lamp_json.at("address").get<uint8_t>();
|
||||
auto address = lamp_json.at("address").get<uint8_t>();
|
||||
return std::make_shared<items::Lamp>(output_gpio_interface, address, name);
|
||||
}
|
||||
catch(json::type_error &e)
|
||||
@@ -187,9 +187,9 @@ std::shared_ptr<items::Sound> create_sound(nlohmann::json &sound_json, std::shar
|
||||
{
|
||||
try
|
||||
{
|
||||
uint id = sound_json.at("id").get<uint>();
|
||||
auto id = sound_json.at("id").get<uint>();
|
||||
std::string name = sound_json.at("name");
|
||||
uint8_t address = sound_json.at("address").get<uint8_t>();
|
||||
auto address = sound_json.at("address").get<uint8_t>();
|
||||
return std::make_shared<items::Sound>(output_gpio_interface, address, name, deactivation_time, id);
|
||||
}
|
||||
catch(json::type_error &e)
|
||||
|
||||
Reference in New Issue
Block a user