Move senseApi libs into their own outer subdir
This commit is contained in:
@@ -38,12 +38,10 @@ public:
|
||||
|
||||
class SenseApiLib
|
||||
{
|
||||
public:
|
||||
typedef const CSenseApiDesc* (SenseApiDescGetterFn)(void);
|
||||
|
||||
public:
|
||||
SenseApiLib(const std::string& path)
|
||||
: libraryPath(path), handle(nullptr, reinterpret_cast<void(*)(void*)>(&dlclose))
|
||||
: libraryPath(path),
|
||||
handle(nullptr, reinterpret_cast<void(*)(void*)>(&dlclose))
|
||||
{}
|
||||
|
||||
public:
|
||||
@@ -58,7 +56,7 @@ public:
|
||||
* This getter function should be visible to dlsym() so that Harikoff can
|
||||
* find it in the lib after loading it, and call it.
|
||||
*/
|
||||
std::function<SenseApiDescGetterFn> getSenseApiDescriptor;
|
||||
std::function<getSenseApiDescFn> getSenseApiDescriptor;
|
||||
|
||||
/**
|
||||
* @brief Harikoff will call the `getSenseApiDescriptor` getter function and
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
#ifndef X11_XCB_API_H
|
||||
#define X11_XCB_API_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
class X11XcbApi
|
||||
{
|
||||
public:
|
||||
X11XcbApi(const std::string& displayName);
|
||||
~X11XcbApi();
|
||||
|
||||
void addDevice(const std::string& deviceSpec);
|
||||
void removeDevice(const std::string& deviceSpec);
|
||||
void addAllDevicesFromSpecs(const std::vector<std::string>& deviceSpecs);
|
||||
|
||||
private:
|
||||
std::string displayName;
|
||||
std::vector<std::shared_ptr<DeviceManager::SensorDeviceSpec>> deviceSpecs;
|
||||
// Add other necessary members and methods
|
||||
};
|
||||
|
||||
#endif // X11_XCB_API_H
|
||||
@@ -77,13 +77,13 @@ SenseApiLib& SenseApiManager::loadSenseApiLib(const std::string& libraryPath)
|
||||
}
|
||||
|
||||
// Initialize getSenseApiDescriptor
|
||||
auto func = reinterpret_cast<SenseApiLib::SenseApiDescGetterFn*>(
|
||||
dlsym(lib->handle.get(), HK_SENSE_API_DESC_GETTER_FN_NAME));
|
||||
auto func = reinterpret_cast<getSenseApiDescFn *>(
|
||||
dlsym(lib->handle.get(), HK_GET_SENSE_API_DESC_FN_NAME_STR));
|
||||
if (!func)
|
||||
{
|
||||
throw std::runtime_error(
|
||||
std::string(__func__) + ": dlsym('"
|
||||
HK_SENSE_API_DESC_GETTER_FN_NAME "') failed for library '"
|
||||
HK_GET_SENSE_API_DESC_FN_NAME_STR "') failed for library '"
|
||||
+ lib->libraryPath + "'");
|
||||
}
|
||||
lib->getSenseApiDescriptor = func;
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
#include <senseApis/x11-xcb.h>
|
||||
#include <iostream>
|
||||
|
||||
X11XcbApi::X11XcbApi(const std::string& displayName)
|
||||
: displayName(displayName)
|
||||
{
|
||||
}
|
||||
|
||||
X11XcbApi::~X11XcbApi() {
|
||||
// Add any necessary cleanup code
|
||||
}
|
||||
|
||||
bool X11XcbApi::initialize() {
|
||||
// Add initialization code
|
||||
std::cout << "Initializing X11 XCB API with display: " << displayName << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
void X11XcbApi::shutdown() {
|
||||
// Add shutdown code
|
||||
std::cout << "Shutting down X11 XCB API" << std::endl;
|
||||
}
|
||||
|
||||
void X11XcbApi::addDevice(const std::string& deviceSpec) {
|
||||
// Add code to add a device
|
||||
auto device = std::make_shared<DeviceManager::SensorDeviceSpec>(deviceSpec);
|
||||
deviceSpecs.push_back(device);
|
||||
std::cout << "Adding device with spec: " << deviceSpec << std::endl;
|
||||
}
|
||||
|
||||
void X11XcbApi::removeDevice(const std::string& deviceSpec) {
|
||||
// Add code to remove a device
|
||||
auto it = std::remove_if(deviceSpecs.begin(), deviceSpecs.end(),
|
||||
[&deviceSpec](const std::shared_ptr<DeviceManager::SensorDeviceSpec>& device) {
|
||||
return device->spec == deviceSpec;
|
||||
});
|
||||
if (it != deviceSpecs.end()) {
|
||||
deviceSpecs.erase(it, deviceSpecs.end());
|
||||
std::cout << "Removing device with spec: " << deviceSpec << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void X11XcbApi::addAllDevicesFromSpecs(const std::vector<std::string>& deviceSpecs) {
|
||||
for (const auto& spec : deviceSpecs) {
|
||||
addDevice(spec);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user