11 std::shared_ptr<DeviceConfigBase> profile) :
22 std::shared_ptr<DeviceConfigBase> profile) :
25 this->
items = profile->items;
30 const std::uint32_t productCode,
31 const std::uint32_t serialNumber)
33 for (
auto& slaveConfig : slaveConfigs)
36 if (
id.getVendorID() == vendorID &&
id.getProductCode() == productCode &&
37 id.getSerialNumber() == serialNumber)
43 ss <<
"Slave Config with vendorID: " << vendorID <<
" , productCode: " << productCode
44 <<
" , serialNumber: " << serialNumber <<
" not found";
51 for (
auto& slaveConfig : slaveConfigs)
53 if (slaveConfig->getType() == type)
55 if (name ==
"" || slaveConfig->getName() == name)
67 if (slaveConfigs.size() == 1)
69 return **slaveConfigs.begin();
72 "There are more than one SlaveConfigs in this DeviceConfig");
78 auto it = subDeviceConfigs.find(subDeviceName);
79 if (it != subDeviceConfigs.end())
86 std::list<std::reference_wrapper<DeviceConfigBase>>
89 std::list<std::reference_wrapper<DeviceConfigBase>>
list;
90 for (
auto& subDevice : subDeviceConfigs)
92 if (subDevice.second->getType() == subDeviceType)
94 list.push_back(*subDevice.second);
117 for (
auto& slave : slaveConfigs)
119 succ &= slave->checkAllItemsRead(errors);
123 succ &=
controller.second->checkAllItemsRead(errors);
125 for (
auto&
sub : subDeviceConfigs)
127 succ &=
sub.second->checkAllItemsRead(errors);
136 for (
int i = 0; i < indention; i++)
140 s <<
"Device type=" <<
getType() <<
" name=" <<
getName() <<
":" << std::endl;
142 for (
auto& slave : slaveConfigs)
144 slave->print(
s, indention + 1);
149 for (
int i = 0; i < indention + 1; i++)
153 s <<
"Controller: " <<
controller.first <<
":" << std::endl;
157 for (
auto&
sub : subDeviceConfigs)
159 sub.second->print(
s, indention + 1);
162 for (
int i = 0; i < indention + 1; i++)
166 s <<
"Config:" << std::endl;
171 DeviceConfig::addSlaveConfig(std::shared_ptr<SlaveConfig> slaveConfig)
173 slaveConfigs.push_back(slaveConfig);
177 DeviceConfig::addSubDeviceConfig(
const std::string name,
178 std::shared_ptr<DeviceConfigBase> subDeviceConfig)
180 subDeviceConfigs[name] = subDeviceConfig;
187 for (
auto& i : subDeviceConfigs)
189 i.second->onParsingFinished();
191 for (
auto& i : slaveConfigs)
193 i->onParsingFinished();
197 i.second->onParsingFinished();
204 for (
int i = 0; i < indention; i++)
208 s <<
"SubDevice name=" <<
getName() <<
":" << std::endl;
212 for (
int i = 0; i < indention + 1; i++)
216 s <<
"Controller: " <<
controller.first <<
":" << std::endl;
220 for (
int i = 0; i < indention + 1; i++)
224 s <<
"Config:" << std::endl;