From e45a9ee5d1226e76c98464971abb4839a9c87dd3 Mon Sep 17 00:00:00 2001 From: Hayodea Hekol Date: Sun, 28 Sep 2025 12:52:59 -0400 Subject: [PATCH] DAP.yy: use cmdlineDASpecs; DevMgr: add attachAllUnattachedDevicesFromCmdlineReq This method wraps around attachAllUnattachedDevicesFromReq and supplies it with a sh_ptr<> collection of all DASpecs parsed by the DAP parser from the cmdline. The initialization sequence now correctly initializes all DAP specs given on the cmdline again. --- smocore/body/body.cpp | 4 ++-- smocore/deviceManager/deviceAttachmentPipeSpecp.yy | 4 ++-- smocore/deviceManager/deviceManager.cpp | 11 +++++++++++ smocore/include/deviceManager/deviceManager.h | 3 +++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/smocore/body/body.cpp b/smocore/body/body.cpp index ca2745b..85f59a5 100644 --- a/smocore/body/body.cpp +++ b/smocore/body/body.cpp @@ -78,8 +78,8 @@ public: std::cout << __func__ << ": About to attachAllSenseDevicesFromSpecs" << '\n'; } - device::DeviceManager::getInstance().attachAllUnattachedDevicesFromReq( - std::make_shared>(), + device::DeviceManager::getInstance() + .attachAllUnattachedDevicesFromCmdlineReq( {context, std::bind( &InitializeReq::initializeReq2, context.get(), context, diff --git a/smocore/deviceManager/deviceAttachmentPipeSpecp.yy b/smocore/deviceManager/deviceAttachmentPipeSpecp.yy index 3422eab..4162167 100644 --- a/smocore/deviceManager/deviceAttachmentPipeSpecp.yy +++ b/smocore/deviceManager/deviceAttachmentPipeSpecp.yy @@ -87,7 +87,7 @@ interoceptor_spec: *static_cast($3)); spec->sensorType = $1; - smo::device::DeviceManager::deviceAttachmentSpecs.push_back(spec); + smo::device::DeviceManager::commandLineDASpecs.push_back(*spec); delete $3; } @@ -99,7 +99,7 @@ extrospector_spec: *static_cast($3)); spec->sensorType = $1; - smo::device::DeviceManager::deviceAttachmentSpecs.push_back(spec); + smo::device::DeviceManager::commandLineDASpecs.push_back(*spec); delete $3; } diff --git a/smocore/deviceManager/deviceManager.cpp b/smocore/deviceManager/deviceManager.cpp index 7f20629..cf2a6b9 100644 --- a/smocore/deviceManager/deviceManager.cpp +++ b/smocore/deviceManager/deviceManager.cpp @@ -23,6 +23,8 @@ std::vector> DeviceManager::devices; std::vector> DeviceManager::attachedDeviceRoles; +std::vector + DeviceManager::commandLineDASpecs; const std::string DeviceManager::stringifyDeviceSpecs(void) { @@ -573,6 +575,15 @@ void DeviceManager::attachAllUnattachedDevicesFromReq( request.get(), request)); } +void DeviceManager::attachAllUnattachedDevicesFromCmdlineReq( + Callback cb + ) +{ + auto specs = std::make_shared>( + commandLineDASpecs); + attachAllUnattachedDevicesFromReq(specs, std::move(cb)); +} + class DeviceManager::DetachAllAttachedDeviceRoles : public PostedAsynchronousContinuation< detachAllAttachedDeviceRolesCbFn> diff --git a/smocore/include/deviceManager/deviceManager.h b/smocore/include/deviceManager/deviceManager.h index 14eb939..ae80260 100644 --- a/smocore/include/deviceManager/deviceManager.h +++ b/smocore/include/deviceManager/deviceManager.h @@ -73,6 +73,8 @@ public: void attachAllUnattachedDevicesFromReq( const std::shared_ptr> &specs, Callback cb); + void attachAllUnattachedDevicesFromCmdlineReq( + Callback cb); void detachAllAttachedDeviceRoles( Callback cb); @@ -91,6 +93,7 @@ public: deviceAttachmentSpecs; static std::vector> devices; static std::vector> attachedDeviceRoles; + static std::vector commandLineDASpecs; private: class NewDeviceAttachmentSpecInd;