DevMgr: Add DeviceRoles; attachedDevices unrelated to device state now

We've decided to add a separate notion of a DeviceRole to track attached
device roles now. We no longer use the collection of deviceSpecs to
track which roles have been attached. Rather, this list will simply
collate all known deviceAttachment specs which are expected to be
maintained in an attached state.

SMO can periodically scan through these and cross-reference this
collection with the collection of attachedDeviceRoles. Then it can
re-try to attach those which aren't currently attached at any given
moment. This will give resilience against device attachment failures
or device resets/malfunctions, at runtime.
This commit is contained in:
2025-09-28 00:50:05 -04:00
parent e6b8d3e85d
commit 1a56e2a107
5 changed files with 62 additions and 32 deletions
@@ -12,6 +12,7 @@
#include <user/deviceAttachmentSpec.h>
#include <asynchronousLoop.h>
#include <deviceManager/device.h>
#include <deviceManager/deviceRole.h>
#include <callback.h>
namespace smo {
@@ -39,7 +40,7 @@ public:
// New async function for device attachment
typedef std::function<void(
bool success, std::shared_ptr<Device> device,
bool success, std::shared_ptr<DeviceRole> deviceRole,
std::shared_ptr<DeviceAttachmentSpec> deviceSpec)>
newDeviceAttachmentSpecIndCbFn;
void newDeviceAttachmentSpecInd(
@@ -75,13 +76,10 @@ private:
public:
std::string allDapSpecs;
static std::vector<std::shared_ptr<InteroceptorDevAttachmentSpec>>
interoceptorDeviceSpecs;
static std::vector<std::shared_ptr<ExtrospectorDevAttachmentSpec>>
extrospectorDeviceSpecs;
static std::vector<std::shared_ptr<DeviceAttachmentSpec>>
deviceAttachmentSpecs;
static std::vector<std::shared_ptr<Device>> devices;
static std::vector<std::shared_ptr<DeviceRole>> attachedDeviceRoles;
private:
class NewDeviceAttachmentSpecInd;