Files
salmanoff/smocore/include/deviceManager/device.h
T
hayodea 1a56e2a107 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.
2025-09-28 00:50:05 -04:00

39 lines
845 B
C++

#ifndef DEVICE_H
#define DEVICE_H
#include <string>
#include <vector>
#include <memory>
#include <sstream>
#include <user/deviceAttachmentSpec.h>
#include <deviceManager/deviceRole.h>
namespace smo {
namespace device {
class Device
{
public:
Device(const std::string& identifier) : deviceIdentifier(identifier) {}
std::string stringify() const
{
std::ostringstream os;
os << "Device Identifier: " << deviceIdentifier
<< ", Device Roles: " << deviceRoles.size() << std::endl;
for (const auto& deviceRole : deviceRoles) {
os << " " << deviceRole->deviceAttachmentSpec->stringify();
}
return os.str();
}
public:
std::string deviceIdentifier;
std::vector<std::shared_ptr<DeviceRole>> deviceRoles;
};
} // namespace device
} // namespace smo
#endif // DEVICE_H