DevMgr: Move at/detachSenseDevs[FromSpecs] into DeviceMgr::

This is logically cleaner and it begins preparing our next set
of restructuring changes. To wit: we're revamping the device
manager to distinguish between devices and their roles.
This commit is contained in:
2025-09-27 23:16:46 -04:00
parent 52567406ca
commit e6b8d3e85d
5 changed files with 366 additions and 359 deletions
@@ -8,7 +8,9 @@
#include <utility>
#include <iostream>
#include <functional>
#include <user/senseApiDesc.h>
#include <user/deviceAttachmentSpec.h>
#include <asynchronousLoop.h>
#include <deviceManager/device.h>
#include <callback.h>
@@ -44,6 +46,27 @@ public:
std::shared_ptr<DeviceAttachmentSpec> spec,
Callback<newDeviceAttachmentSpecIndCbFn> callback);
// 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;
@@ -62,6 +85,10 @@ public:
private:
class NewDeviceAttachmentSpecInd;
class AttachSenseDeviceReq;
typedef AttachSenseDeviceReq DetachSenseDeviceReq;
class AttachAllSenseDevicesFromSpecsReq;
class DetachAllSenseDevicesReq;
};
} // namespace device
@@ -50,26 +50,6 @@ public:
void initializeAllSenseApiLibs(void);
void finalizeAllSenseApiLibs(void);
typedef sal_mlo_attachDeviceReqCbFn attachSenseDeviceReqCbFn;
typedef sal_mlo_detachDeviceReqCbFn detachSenseDeviceReqCbFn;
void attachSenseDeviceReq(
const std::shared_ptr<device::DeviceAttachmentSpec>& spec,
Callback<attachSenseDeviceReqCbFn> cb);
void detachSenseDeviceReq(
const std::shared_ptr<device::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);
std::string stringifyLibs() const;
private:
@@ -81,11 +61,6 @@ private:
std::vector<std::shared_ptr<SenseApiLib>> senseApiLibs;
class AttachSenseDeviceReq;
typedef AttachSenseDeviceReq DetachSenseDeviceReq;
class AttachAllSenseDevicesFromSpecsReq;
class DetachAllSenseDevicesReq;
public:
static std::optional<std::string> searchForLibInSmoSearchPaths(
const std::string& libraryPath);