DevMgr: Call attachAll*FromKnownListReq in DeviceReattacher

Well, I guess now we have auto-reattaching devices.
This commit is contained in:
2025-09-28 23:26:44 -04:00
parent bd52e49ba3
commit 20d568a063
2 changed files with 17 additions and 1 deletions
+2 -1
View File
@@ -589,7 +589,8 @@ void DeviceManager::attachAllUnattachedDevicesFromKnownListReq(
)
{
// Create a vector to hold unattached device specs
auto unattachedSpecs = std::make_shared<std::vector<DeviceAttachmentSpec>>();
auto unattachedSpecs = std::make_shared<
std::vector<DeviceAttachmentSpec>>();
// Cycle through all DA specs in deviceAttachmentSpecs
for (const auto& spec : deviceAttachmentSpecs)
@@ -2,12 +2,22 @@
#include <iostream>
#include <functional>
#include <componentThread.h>
#include <callback.h>
#include <deviceManager/deviceReattacher.h>
#include <deviceManager/deviceManager.h>
namespace smo {
namespace device {
static void reattachmentCb(AsynchronousLoop& results)
{
if (results.nTotal == 0) { return; }
std::cout << "DeviceReattacher: Successfully reattached "
<< results.nSucceeded << " of " << results.nTotal << " devices"
<< std::endl;
}
DeviceReattacher::DeviceReattacher(
DeviceManager& parent, std::shared_ptr<ComponentThread> ioThread)
: parent(parent), ioThread(ioThread), shouldContinue(false),
@@ -60,6 +70,11 @@ void DeviceReattacher::onTimeout(const boost::system::error_code& error)
return;
}
// Attempt to reattach all unattached devices from the known list
parent.attachAllUnattachedDevicesFromKnownListReq(
Callback<DeviceManager::attachAllUnattachedDevicesFromReqCbFn>(
nullptr, reattachmentCb));
// Schedule the next timeout
scheduleNextTimeout();
}