20 #include "devicenodelogic.h" 21 #include "devicenodegateway.h" 25 std::shared_ptr<Device> DeviceNodeLogic::findDeviceByName(
const std::string name)
27 std::vector<std::shared_ptr<Device>>::iterator item =
28 std::find_if(m_devList.begin(), m_devList.end(),
29 [&] (std::shared_ptr<Device>
const &d) {
return d->getName() == name; });
31 return (item == std::end(m_devList)) ?
nullptr : *item;
34 bool DeviceNodeLogic::updateDeviceList(Device &dev)
36 auto item = findDeviceByName(dev.getName());
38 if (item ==
nullptr) {
39 auto newDevice = std::make_shared<Device>(dev);
40 m_devList.push_back(std::move(newDevice));
42 item->calculateDeviceMode(dev.getMode());
48 const std::vector<std::shared_ptr<Device>> &DeviceNodeLogic::getDevList()
Developers guide to adding a config item: