Files
salmanoff/smocore/include/deviceManager/deviceManager.h
T

96 lines
2.7 KiB
C++
Raw Normal View History

#ifndef DEVICEMANAGER_H
#define DEVICEMANAGER_H
#include <vector>
#include <string>
#include <memory>
#include <opts.h>
#include <utility>
#include <iostream>
2025-09-20 18:23:03 -04:00
#include <functional>
#include <user/senseApiDesc.h>
#include <user/deviceAttachmentSpec.h>
#include <asynchronousLoop.h>
2025-08-29 17:42:13 -04:00
#include <deviceManager/device.h>
#include <deviceManager/deviceRole.h>
#include <callback.h>
2025-07-22 06:48:04 -04:00
namespace smo {
namespace device {
class DeviceManager
{
public:
static DeviceManager& getInstance()
{
static DeviceManager instance;
return instance;
}
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);
static const std::string stringifyDeviceSpecs(void);
2025-08-29 17:42:13 -04:00
// New async function for device attachment
typedef std::function<void(
bool success, std::shared_ptr<DeviceRole> deviceRole,
std::shared_ptr<DeviceAttachmentSpec> deviceSpec)>
newDeviceAttachmentSpecIndCbFn;
void newDeviceAttachmentSpecInd(
2025-08-29 17:42:13 -04:00
std::shared_ptr<DeviceAttachmentSpec> spec,
Callback<newDeviceAttachmentSpecIndCbFn> callback);
2025-08-29 17:42:13 -04:00
// Device attachment/detachment methods moved from SenseApiManager
typedef sense_api::sal_mlo_attachDeviceReqCbFn attachSenseDeviceReqCbFn;
typedef sense_api::sal_mlo_detachDeviceReqCbFn detachSenseDeviceReqCbFn;
void attachSenseDeviceReq(
const std::shared_ptr<DeviceAttachmentSpec>& spec,
Callback<attachSenseDeviceReqCbFn> cb);
void detachSenseDeviceReq(
const std::shared_ptr<DeviceAttachmentSpec>& spec,
Callback<detachSenseDeviceReqCbFn> cb);
typedef std::function<void(AsynchronousLoop &results)>
attachAllSenseDevicesFromSpecsReqCbFn;
typedef std::function<void(AsynchronousLoop &results)>
detachAllSenseDevicesReqCbFn;
void attachAllSenseDevicesFromSpecsReq(
Callback<attachAllSenseDevicesFromSpecsReqCbFn> cb);
void detachAllSenseDevicesReq(
Callback<detachAllSenseDevicesReqCbFn> cb);
private:
DeviceManager() = default;
~DeviceManager() = default;
DeviceManager(const DeviceManager&) = delete;
DeviceManager& operator=(const DeviceManager&) = delete;
public:
2025-08-29 16:12:30 -04:00
std::string allDapSpecs;
static std::vector<std::shared_ptr<DeviceAttachmentSpec>>
deviceAttachmentSpecs;
2025-08-29 17:42:13 -04:00
static std::vector<std::shared_ptr<Device>> devices;
static std::vector<std::shared_ptr<DeviceRole>> attachedDeviceRoles;
private:
class NewDeviceAttachmentSpecInd;
class AttachSenseDeviceReq;
typedef AttachSenseDeviceReq DetachSenseDeviceReq;
class AttachAllSenseDevicesFromSpecsReq;
class DetachAllSenseDevicesReq;
};
} // namespace device
2025-07-22 06:48:04 -04:00
} // namespace smo
#endif // DEVICEMANAGER_H