Files
salmanoff/senseApis/xcbWindow/xcbWindow.h
T
hayodea 6ef86eea05 Rename DSL: deviceSpec => deviceAttachmentSpec
This language is used broadly to specify how to attach (and thus
also how to detach) devices to/from Salmanoff. The next bit of work
we'll do is split off the DSL parsing from the management of the
list of parsed binary attached spec objects.

We'll be creating a PipeDeviceAttachmentParser, and later on when
we support URDF, we'll create a URDFDeviceAttachmentParser.
2025-08-29 15:16:11 -04:00

60 lines
1.6 KiB
C++

#ifndef XCB_WINDOW_SENSE_API_H
#define XCB_WINDOW_SENSE_API_H
#include <string>
#include <vector>
#include <memory>
#include <user/senseApiDesc.h>
#include <user/deviceAttachmentSpec.h>
#include <xcbXorg/xcbXorg.h>
namespace xcb_window {
/**
* @brief Window selector for X11 windows
*/
struct WindowSelector
{
xcb_xorg::window_search::MatchType matchType;
int display;
int screen;
uint32_t windowId;
std::string windowName;
std::string stringify() const;
};
/**
* @brief Represents an attached X11 window device
*/
class AttachedWindow
{
public:
AttachedWindow(
const std::shared_ptr<smo::device::DeviceAttachmentSpec>& spec);
~AttachedWindow();
const std::shared_ptr<smo::device::DeviceAttachmentSpec>&
getDeviceAttachmentSpec() const
{ return deviceAttachmentSpec; }
const WindowSelector& getWindowSelector() const { return windowSelector; }
const std::string& getActualWindowName() const { return actualWindowName; }
void* getXcbConnection() const { return xcbConnectionShared.get(); }
std::string stringify() const;
private:
void parseWindowSelector(const smo::device::DeviceAttachmentSpec& spec);
int getRequiredParamAsInt(
const smo::device::DeviceAttachmentSpec& spec,
const std::string& paramName);
std::shared_ptr<smo::device::DeviceAttachmentSpec> deviceAttachmentSpec;
WindowSelector windowSelector;
std::string actualWindowName;
std::shared_ptr<xcb_xorg::XcbConnection> xcbConnectionShared;
};
} // namespace xcb_window
#endif // XCB_WINDOW_SENSE_API_H