SenseApis: New senseApiManager and X11XcbApi
Still fleshing these out but ultimately senseApiMgr will manage sense apis, and the X11XcbApi is where we'll connect to Xcb and read the screen.
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
#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