DevMgr: Call attachAll*FromKnownListReq in DeviceReattacher
Well, I guess now we have auto-reattaching devices.
This commit is contained in:
@@ -589,7 +589,8 @@ void DeviceManager::attachAllUnattachedDevicesFromKnownListReq(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Create a vector to hold unattached device specs
|
// 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
|
// Cycle through all DA specs in deviceAttachmentSpecs
|
||||||
for (const auto& spec : deviceAttachmentSpecs)
|
for (const auto& spec : deviceAttachmentSpecs)
|
||||||
|
|||||||
@@ -2,12 +2,22 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <componentThread.h>
|
#include <componentThread.h>
|
||||||
|
#include <callback.h>
|
||||||
#include <deviceManager/deviceReattacher.h>
|
#include <deviceManager/deviceReattacher.h>
|
||||||
#include <deviceManager/deviceManager.h>
|
#include <deviceManager/deviceManager.h>
|
||||||
|
|
||||||
namespace smo {
|
namespace smo {
|
||||||
namespace device {
|
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(
|
DeviceReattacher::DeviceReattacher(
|
||||||
DeviceManager& parent, std::shared_ptr<ComponentThread> ioThread)
|
DeviceManager& parent, std::shared_ptr<ComponentThread> ioThread)
|
||||||
: parent(parent), ioThread(ioThread), shouldContinue(false),
|
: parent(parent), ioThread(ioThread), shouldContinue(false),
|
||||||
@@ -60,6 +70,11 @@ void DeviceReattacher::onTimeout(const boost::system::error_code& error)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Attempt to reattach all unattached devices from the known list
|
||||||
|
parent.attachAllUnattachedDevicesFromKnownListReq(
|
||||||
|
Callback<DeviceManager::attachAllUnattachedDevicesFromReqCbFn>(
|
||||||
|
nullptr, reattachmentCb));
|
||||||
|
|
||||||
// Schedule the next timeout
|
// Schedule the next timeout
|
||||||
scheduleNextTimeout();
|
scheduleNextTimeout();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user