2025-01-08 06:26:36 -04:00
|
|
|
#ifndef SENSE_API_MANAGER_H
|
|
|
|
|
#define SENSE_API_MANAGER_H
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <optional>
|
|
|
|
|
#include <functional>
|
2025-01-08 11:49:28 -04:00
|
|
|
#include <senseApis/senseApiLib.h>
|
2025-01-12 14:31:33 -04:00
|
|
|
#include <user/senseDeviceSpec.h>
|
2025-01-08 06:26:36 -04:00
|
|
|
|
2025-07-22 06:48:04 -04:00
|
|
|
namespace smo {
|
2025-01-08 11:49:28 -04:00
|
|
|
namespace sense_api {
|
2025-01-08 06:26:36 -04:00
|
|
|
|
2025-01-12 09:44:08 -04:00
|
|
|
class SenseApiManager
|
|
|
|
|
{
|
2025-01-08 06:26:36 -04:00
|
|
|
public:
|
|
|
|
|
static SenseApiManager& getInstance()
|
|
|
|
|
{
|
2025-01-08 11:49:28 -04:00
|
|
|
static SenseApiManager instance;
|
2025-01-08 06:26:36 -04:00
|
|
|
return instance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SenseApiLib& loadSenseApiLib(const std::string& libraryPath);
|
|
|
|
|
std::optional<std::reference_wrapper<SenseApiLib>> getSenseApiLib(
|
|
|
|
|
const std::string& libraryPath);
|
2025-01-12 14:31:33 -04:00
|
|
|
std::optional<std::reference_wrapper<SenseApiLib>> getSenseApiLibByApiName(
|
|
|
|
|
const std::string& apiName);
|
2025-01-08 06:26:36 -04:00
|
|
|
void unloadSenseApiLib(const std::string& libraryPath);
|
2025-01-12 09:44:49 -04:00
|
|
|
|
|
|
|
|
void initializeSenseApiLib(SenseApiLib& lib);
|
|
|
|
|
void finalizeSenseApiLib(SenseApiLib& lib);
|
|
|
|
|
|
2025-01-08 15:06:31 -04:00
|
|
|
void loadAllSenseApiLibsFromOptions(void);
|
2025-01-12 09:44:49 -04:00
|
|
|
void unloadAllSenseApiLibs(void);
|
|
|
|
|
void initializeAllSenseApiLibs(void);
|
|
|
|
|
void finalizeAllSenseApiLibs(void);
|
2025-01-08 06:26:36 -04:00
|
|
|
|
2025-01-12 14:31:33 -04:00
|
|
|
void attachAllSenseDevicesFromSpecs(void);
|
2025-01-13 21:57:11 -04:00
|
|
|
void attachSenseDevice(const device::SenseDeviceSpec& spec);
|
|
|
|
|
void detachSenseDevice(const device::SenseDeviceSpec& spec);
|
2025-01-12 14:31:33 -04:00
|
|
|
void detachAllSenseDevices(void);
|
|
|
|
|
|
2025-01-11 06:40:43 -04:00
|
|
|
std::string stringifyLibs() const;
|
|
|
|
|
|
2025-01-08 06:26:36 -04:00
|
|
|
private:
|
2025-01-08 11:49:28 -04:00
|
|
|
SenseApiManager() = default;
|
2025-01-08 06:26:36 -04:00
|
|
|
~SenseApiManager() = default;
|
|
|
|
|
|
|
|
|
|
SenseApiManager(const SenseApiManager&) = delete;
|
|
|
|
|
SenseApiManager& operator=(const SenseApiManager&) = delete;
|
|
|
|
|
|
|
|
|
|
std::vector<std::unique_ptr<SenseApiLib>> senseApiLibs;
|
|
|
|
|
};
|
|
|
|
|
|
2025-01-08 11:49:28 -04:00
|
|
|
} // namespace sense_api
|
2025-07-22 06:48:04 -04:00
|
|
|
} // namespace smo
|
2025-01-08 11:49:28 -04:00
|
|
|
|
2025-01-08 06:26:36 -04:00
|
|
|
#endif // SENSE_API_MANAGER_H
|