2025-01-05 14:19:53 -04:00
|
|
|
#ifndef DEVICEMANAGER_H
|
|
|
|
|
#define DEVICEMANAGER_H
|
|
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <string>
|
2025-01-08 06:23:34 -04:00
|
|
|
#include <memory>
|
2025-01-05 14:19:53 -04:00
|
|
|
#include <opts.h>
|
2025-01-07 14:11:51 -04:00
|
|
|
#include <utility>
|
|
|
|
|
#include <iostream>
|
2025-09-20 18:23:03 -04:00
|
|
|
#include <functional>
|
2025-08-29 15:16:11 -04:00
|
|
|
#include <user/deviceAttachmentSpec.h>
|
2025-08-29 17:42:13 -04:00
|
|
|
#include <deviceManager/device.h>
|
2025-01-05 14:19:53 -04:00
|
|
|
|
2025-07-22 06:48:04 -04:00
|
|
|
namespace smo {
|
2025-01-13 21:57:11 -04:00
|
|
|
namespace device {
|
|
|
|
|
|
2025-01-05 14:19:53 -04:00
|
|
|
class DeviceManager
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
static DeviceManager& getInstance()
|
|
|
|
|
{
|
|
|
|
|
static DeviceManager instance;
|
|
|
|
|
return instance;
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-12 16:09:26 -04:00
|
|
|
void initialize(void)
|
|
|
|
|
{};
|
|
|
|
|
void finalize(void)
|
|
|
|
|
{};
|
|
|
|
|
|
2025-08-29 16:12:30 -04:00
|
|
|
std::string readDapSpecFile(const std::string& filename);
|
|
|
|
|
void collateAllDapSpecs(void);
|
|
|
|
|
void parseAllDapSpecs(void);
|
2025-08-29 16:33:17 -04:00
|
|
|
|
2025-01-10 18:27:10 -04:00
|
|
|
static const std::string stringifyDeviceSpecs(void);
|
2025-01-05 14:19:53 -04:00
|
|
|
|
2025-08-29 17:42:13 -04:00
|
|
|
// New async function for device attachment
|
2025-09-10 06:51:55 -04:00
|
|
|
typedef std::function<void(
|
|
|
|
|
bool success, std::shared_ptr<Device> device,
|
|
|
|
|
std::shared_ptr<DeviceAttachmentSpec> deviceSpec)>
|
2025-09-15 14:20:08 -04:00
|
|
|
newDeviceAttachmentSpecIndCbFn;
|
2025-09-10 06:51:55 -04:00
|
|
|
void newDeviceAttachmentSpecInd(
|
2025-08-29 17:42:13 -04:00
|
|
|
std::shared_ptr<DeviceAttachmentSpec> spec,
|
2025-09-15 14:20:08 -04:00
|
|
|
newDeviceAttachmentSpecIndCbFn callback);
|
2025-08-29 17:42:13 -04:00
|
|
|
|
2025-01-05 14:19:53 -04:00
|
|
|
private:
|
|
|
|
|
DeviceManager() = default;
|
|
|
|
|
~DeviceManager() = default;
|
|
|
|
|
DeviceManager(const DeviceManager&) = delete;
|
|
|
|
|
DeviceManager& operator=(const DeviceManager&) = delete;
|
2025-01-07 14:11:51 -04:00
|
|
|
|
|
|
|
|
public:
|
2025-08-29 16:12:30 -04:00
|
|
|
std::string allDapSpecs;
|
2025-08-29 15:16:11 -04:00
|
|
|
static std::vector<std::shared_ptr<InteroceptorDevAttachmentSpec>>
|
2025-01-08 06:23:34 -04:00
|
|
|
interoceptorDeviceSpecs;
|
2025-08-29 15:16:11 -04:00
|
|
|
static std::vector<std::shared_ptr<ExtrospectorDevAttachmentSpec>>
|
2025-01-08 06:23:34 -04:00
|
|
|
extrospectorDeviceSpecs;
|
2025-08-29 15:16:11 -04:00
|
|
|
static std::vector<std::shared_ptr<DeviceAttachmentSpec>>
|
2025-08-29 16:33:17 -04:00
|
|
|
deviceAttachmentSpecs;
|
2025-08-29 17:42:13 -04:00
|
|
|
static std::vector<std::shared_ptr<Device>> devices;
|
2025-09-15 14:20:08 -04:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
class NewDeviceAttachmentSpecInd;
|
2025-01-05 14:19:53 -04:00
|
|
|
};
|
|
|
|
|
|
2025-01-13 21:57:11 -04:00
|
|
|
} // namespace device
|
2025-07-22 06:48:04 -04:00
|
|
|
} // namespace smo
|
2025-01-13 21:57:11 -04:00
|
|
|
|
2025-01-05 14:19:53 -04:00
|
|
|
#endif // DEVICEMANAGER_H
|