| 245 | } |
| 246 | |
| 247 | void ServerImpl::addExternalDevice(std::string const &path, |
| 248 | std::string const &deviceName, |
| 249 | std::string const &server, |
| 250 | std::string const &descriptor) { |
| 251 | Json::Value descriptorVal; |
| 252 | Json::Reader reader; |
| 253 | if (!reader.parse(descriptor, descriptorVal)) { |
| 254 | BOOST_ASSERT_MSG(0, "Should never get here - string descriptor " |
| 255 | "handed to us should have been generated from " |
| 256 | "a JSON value."); |
| 257 | return; |
| 258 | } |
| 259 | m_callControlled([&] { |
| 260 | /// Get the node |
| 261 | auto &node = m_tree.getNodeByPath(path); |
| 262 | |
| 263 | /// Create the DeviceElement and set it as the node value |
| 264 | auto elt = common::elements::DeviceElement{deviceName, server}; |
| 265 | elt.getDescriptor() = descriptorVal; |
| 266 | node.value() = elt; |
| 267 | m_treeDirty.set(); |
| 268 | |
| 269 | /// Process device descriptor |
| 270 | common::processDeviceDescriptorFromExistingDevice(node, elt); |
| 271 | }); |
| 272 | } |
| 273 | |
| 274 | bool ServerImpl::addString(std::string const &path, |
| 275 | std::string const &value) { |
nothing calls this directly
no test coverage detected