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.
This commit is contained in:
2025-08-29 15:16:11 -04:00
parent 8f41e164a2
commit 6ef86eea05
10 changed files with 89 additions and 78 deletions
+8 -8
View File
@@ -7,7 +7,7 @@
#include <dlfcn.h>
#include <xcb/xcb.h>
#include <user/senseApiDesc.h>
#include <user/senseDeviceSpec.h>
#include <user/deviceAttachmentSpec.h>
#include <xcbXorg/xcbXorg.h>
#include "xcbWindow.h"
@@ -55,9 +55,9 @@ std::string WindowSelector::stringify() const
}
AttachedWindow::AttachedWindow(
const std::shared_ptr<smo::device::SenseDeviceSpec>& spec
const std::shared_ptr<smo::device::DeviceAttachmentSpec>& spec
)
: deviceSpec(spec)
: deviceAttachmentSpec(spec)
{
// Validate required function pointers are available
if (!xcbXorg.fns.getOrCreateConnection ||
@@ -106,7 +106,7 @@ AttachedWindow::AttachedWindow(
}
void AttachedWindow::parseWindowSelector(
const smo::device::SenseDeviceSpec& spec
const smo::device::DeviceAttachmentSpec& spec
)
{
// Default match type
@@ -148,7 +148,7 @@ void AttachedWindow::parseWindowSelector(
}
}
int AttachedWindow::getRequiredParamAsInt(const smo::device::SenseDeviceSpec& spec,
int AttachedWindow::getRequiredParamAsInt(const smo::device::DeviceAttachmentSpec& spec,
const std::string& paramName)
{
auto it = std::find_if(
@@ -296,7 +296,7 @@ static int xcbWindow_finalizeInd(void)
}
static int xcbWindow_attachDeviceReq(
const std::shared_ptr<smo::device::SenseDeviceSpec>& desc
const std::shared_ptr<smo::device::DeviceAttachmentSpec>& desc
)
{
g_attachedWindows.emplace_back(
@@ -309,12 +309,12 @@ static int xcbWindow_attachDeviceReq(
}
static int xcbWindow_detachDeviceReq(
const std::shared_ptr<smo::device::SenseDeviceSpec>& spec
const std::shared_ptr<smo::device::DeviceAttachmentSpec>& spec
)
{
auto it = std::find_if(g_attachedWindows.begin(), g_attachedWindows.end(),
[&spec](const std::unique_ptr<xcb_window::AttachedWindow>& window) {
return window->getDeviceSpec() == spec;
return window->getDeviceAttachmentSpec() == spec;
}
);
+9 -7
View File
@@ -5,7 +5,7 @@
#include <vector>
#include <memory>
#include <user/senseApiDesc.h>
#include <user/senseDeviceSpec.h>
#include <user/deviceAttachmentSpec.h>
#include <xcbXorg/xcbXorg.h>
namespace xcb_window {
@@ -30,23 +30,25 @@ struct WindowSelector
class AttachedWindow
{
public:
AttachedWindow(const std::shared_ptr<smo::device::SenseDeviceSpec>& spec);
AttachedWindow(
const std::shared_ptr<smo::device::DeviceAttachmentSpec>& spec);
~AttachedWindow();
const std::shared_ptr<smo::device::SenseDeviceSpec>& getDeviceSpec() const
{ return deviceSpec; }
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::SenseDeviceSpec& spec);
void parseWindowSelector(const smo::device::DeviceAttachmentSpec& spec);
int getRequiredParamAsInt(
const smo::device::SenseDeviceSpec& spec,
const smo::device::DeviceAttachmentSpec& spec,
const std::string& paramName);
std::shared_ptr<smo::device::SenseDeviceSpec> deviceSpec;
std::shared_ptr<smo::device::DeviceAttachmentSpec> deviceAttachmentSpec;
WindowSelector windowSelector;
std::string actualWindowName;
std::shared_ptr<xcb_xorg::XcbConnection> xcbConnectionShared;