Merge branch 'master' of github.com:swinginbird/flippr-code

This commit is contained in:
Johannes Wendel
2018-12-11 14:48:27 +01:00
4 changed files with 8 additions and 8 deletions

View File

@@ -146,7 +146,7 @@ std::chrono::milliseconds get_deactivation_time(nlohmann::json &json)
{ {
try 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); return std::chrono::milliseconds(deactivation_time);
} }
catch(json::type_error &e) catch(json::type_error &e)
@@ -160,7 +160,7 @@ std::shared_ptr<items::Solenoid> create_solenoid(nlohmann::json &solenoid_json,
try try
{ {
std::string name = solenoid_json.at("name"); 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); return std::make_shared<items::Solenoid>(output_gpio_interface, address, name, deactivation_time);
} }
catch(json::type_error &e) catch(json::type_error &e)
@@ -174,7 +174,7 @@ std::shared_ptr<items::Lamp> create_lamp(nlohmann::json &lamp_json, std::shared_
try try
{ {
std::string name = lamp_json.at("name"); 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); return std::make_shared<items::Lamp>(output_gpio_interface, address, name);
} }
catch(json::type_error &e) catch(json::type_error &e)
@@ -187,9 +187,9 @@ std::shared_ptr<items::Sound> create_sound(nlohmann::json &sound_json, std::shar
{ {
try try
{ {
uint id = sound_json.at("id").get<uint>(); auto id = sound_json.at("id").get<uint>();
std::string name = sound_json.at("name"); 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); return std::make_shared<items::Sound>(output_gpio_interface, address, name, deactivation_time, id);
} }
catch(json::type_error &e) catch(json::type_error &e)

View File

@@ -20,7 +20,7 @@ class DriverBoardItem : public Item
{ {
public: public:
DriverBoardItem(std::shared_ptr<IOutputGPIOInterface> output_gpio_interface, uint8_t address, std::string name) : DriverBoardItem(std::shared_ptr<IOutputGPIOInterface> output_gpio_interface, uint8_t address, std::string name) :
Item(output_gpio_interface, address, name) {} Item(std::move(output_gpio_interface), address, std::move(name)) {}
~DriverBoardItem() override = default; ~DriverBoardItem() override = default;

View File

@@ -18,7 +18,7 @@ class SoundItem : public Item
{ {
public: public:
SoundItem(std::shared_ptr<IOutputGPIOInterface> output_gpio_interface, uint8_t address, std::string name) : SoundItem(std::shared_ptr<IOutputGPIOInterface> output_gpio_interface, uint8_t address, std::string name) :
Item(output_gpio_interface, address, name) {} Item(std::move(output_gpio_interface), address, std::move(name)) {}
~SoundItem() override = default; ~SoundItem() override = default;
}; };

View File

@@ -12,7 +12,7 @@ namespace utility
{ {
using namespace nlohmann; using namespace nlohmann;
InputSocketHandler::InputSocketHandler(boost::asio::io_service &service, std::string socket_file) : SocketHandler(service, socket_file) {} InputSocketHandler::InputSocketHandler(boost::asio::io_service &service, std::string socket_file) : SocketHandler(service, std::move(socket_file)) {}
void InputSocketHandler::handle(flippR_driver::input::Event &event) void InputSocketHandler::handle(flippR_driver::input::Event &event)
{ {