DevMgr: call newDevAttSpecInd & not attDevReq in body:initReq

This performs a more complete device initialization and attachment
sequence. We'll do the corresponding teardown in the shutdown
sequence later.

We might probably do it as deviceRoleGoneAwayInd()
This commit is contained in:
2025-09-28 01:15:36 -04:00
parent 1a56e2a107
commit 51b70b179c
2 changed files with 14 additions and 7 deletions
+6 -4
View File
@@ -106,7 +106,7 @@ public:
} }
// Create DeviceRole and add it to both DeviceManager's and Device's collections // Create DeviceRole and add it to both DeviceManager's and Device's collections
auto deviceRole = std::make_shared<DeviceRole>(spec); auto deviceRole = std::make_shared<DeviceRole>(*device, spec);
attachedDeviceRoles.push_back(deviceRole); attachedDeviceRoles.push_back(deviceRole);
device->deviceRoles.push_back(deviceRole); device->deviceRoles.push_back(deviceRole);
@@ -357,19 +357,21 @@ public:
{ {
for (const auto& spec : DeviceManager::deviceAttachmentSpecs) for (const auto& spec : DeviceManager::deviceAttachmentSpecs)
{ {
DeviceManager::getInstance().attachSenseDeviceReq( DeviceManager::getInstance().newDeviceAttachmentSpecInd(
spec, spec,
{context, std::bind( {context, std::bind(
&AttachAllSenseDevicesFromSpecsReq::attachAllSenseDevicesFromSpecsReq2, &AttachAllSenseDevicesFromSpecsReq::attachAllSenseDevicesFromSpecsReq2,
context.get(), context, context.get(), context,
std::placeholders::_1, std::placeholders::_2)}); std::placeholders::_1, std::placeholders::_2,
std::placeholders::_3)});
} }
} }
// Callback methods for the attachment sequence // Callback methods for the attachment sequence
void attachAllSenseDevicesFromSpecsReq2( void attachAllSenseDevicesFromSpecsReq2(
std::shared_ptr<AttachAllSenseDevicesFromSpecsReq> context, std::shared_ptr<AttachAllSenseDevicesFromSpecsReq> context,
bool success, std::shared_ptr<DeviceAttachmentSpec> spec bool success, std::shared_ptr<DeviceRole> deviceRole,
std::shared_ptr<DeviceAttachmentSpec> spec
) )
{ {
if (!success) if (!success)
+8 -3
View File
@@ -7,14 +7,19 @@
namespace smo { namespace smo {
namespace device { namespace device {
class Device; // Forward declaration
class DeviceRole class DeviceRole
{ {
public: public:
DeviceRole(std::shared_ptr<DeviceAttachmentSpec> spec) DeviceRole(
: deviceAttachmentSpec(spec) Device& parentDevice,
std::shared_ptr<DeviceAttachmentSpec>& spec)
: parentDevice(parentDevice), deviceAttachmentSpec(spec)
{} {}
std::shared_ptr<DeviceAttachmentSpec> deviceAttachmentSpec; Device& parentDevice;
std::shared_ptr<DeviceAttachmentSpec> deviceAttachmentSpec;
}; };
} // namespace device } // namespace device