fe3f911db4
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.
48 lines
1.4 KiB
C++
48 lines
1.4 KiB
C++
#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);
|
|
}
|
|
}
|