diff --git a/smocore/deviceManager/deviceManager.cpp b/smocore/deviceManager/deviceManager.cpp index bd741f6..97a87f4 100644 --- a/smocore/deviceManager/deviceManager.cpp +++ b/smocore/deviceManager/deviceManager.cpp @@ -106,7 +106,7 @@ public: } // Create DeviceRole and add it to both DeviceManager's and Device's collections - auto deviceRole = std::make_shared(spec); + auto deviceRole = std::make_shared(*device, spec); attachedDeviceRoles.push_back(deviceRole); device->deviceRoles.push_back(deviceRole); @@ -357,19 +357,21 @@ public: { for (const auto& spec : DeviceManager::deviceAttachmentSpecs) { - DeviceManager::getInstance().attachSenseDeviceReq( + DeviceManager::getInstance().newDeviceAttachmentSpecInd( spec, {context, std::bind( &AttachAllSenseDevicesFromSpecsReq::attachAllSenseDevicesFromSpecsReq2, context.get(), context, - std::placeholders::_1, std::placeholders::_2)}); + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3)}); } } // Callback methods for the attachment sequence void attachAllSenseDevicesFromSpecsReq2( std::shared_ptr context, - bool success, std::shared_ptr spec + bool success, std::shared_ptr deviceRole, + std::shared_ptr spec ) { if (!success) diff --git a/smocore/include/deviceManager/deviceRole.h b/smocore/include/deviceManager/deviceRole.h index 046fd15..12c6b87 100644 --- a/smocore/include/deviceManager/deviceRole.h +++ b/smocore/include/deviceManager/deviceRole.h @@ -7,14 +7,19 @@ namespace smo { namespace device { +class Device; // Forward declaration + class DeviceRole { public: - DeviceRole(std::shared_ptr spec) - : deviceAttachmentSpec(spec) + DeviceRole( + Device& parentDevice, + std::shared_ptr& spec) + : parentDevice(parentDevice), deviceAttachmentSpec(spec) {} - std::shared_ptr deviceAttachmentSpec; + Device& parentDevice; + std::shared_ptr deviceAttachmentSpec; }; } // namespace device