DevAttachment:Rename: api=>stimbuffapi, implexor=>qualeiface

This commit is contained in:
2025-10-01 18:10:58 -04:00
parent b69572eee7
commit a66d91fa31
6 changed files with 33 additions and 31 deletions
+8 -6
View File
@@ -25,6 +25,8 @@ public:
{
return deviceIdentifier == other.deviceIdentifier &&
sensorType == other.sensorType &&
qualeIfaceApi == other.qualeIfaceApi &&
stimBuffApi == other.stimBuffApi &&
provider == other.provider &&
deviceSelector == other.deviceSelector;
}
@@ -32,9 +34,9 @@ public:
public:
std::string deviceIdentifier;
char sensorType;
std::string implexor;
std::string api;
std::vector<std::pair<std::string,std::string>> apiParams;
std::string qualeIfaceApi;
std::string stimBuffApi;
std::vector<std::pair<std::string,std::string>> stimBuffApiParams;
std::string provider;
std::vector<std::pair<std::string,std::string>> providerParams;
std::string deviceSelector;
@@ -44,9 +46,9 @@ public:
std::ostringstream os;
os << "Device Identifier: " << deviceIdentifier
<< ", Sensor Type: " << sensorType
<< ", Implexor: " << implexor << ", API: " << api
<< ", API Params: (";
for (const auto& param : apiParams)
<< ", QualeIface API: " << qualeIfaceApi << ", StimBuff API: " << stimBuffApi
<< ", StimBuff API Params: (";
for (const auto& param : stimBuffApiParams)
{
os << param.first;
if (!param.second.empty()) {
+11 -11
View File
@@ -110,15 +110,15 @@ struct Sal_Mgmt_LibOps
};
/* Exported by all sense API Libraries to tell Salmanoff what API the lib uses
* to connect to providers; and also to state which implexor APIs it exports.
* to connect to providers; and also to state which quale-iface APIs it exports.
*/
class SenseApiDesc
{
public:
class ExportedImplexorApiDesc
class ExportedQualeIfaceApiDesc
{
public:
static bool sanityCheck(const ExportedImplexorApiDesc &desc)
static bool sanityCheck(const ExportedQualeIfaceApiDesc &desc)
{
if (desc.name.empty()) { return false; }
return true;
@@ -132,8 +132,8 @@ public:
std::string stringify() const
{
std::string result = "Name: " + name + "\n";
result += "Exported Implexor APIs:\n";
for (const auto& api : exportedImplexorApis) {
result += "Exported QualeIface APIs:\n";
for (const auto& api : exportedQualeIfaceApis) {
result += " - " + api.name + "\n";
}
return result;
@@ -141,20 +141,20 @@ public:
static bool sanityCheck(const SenseApiDesc &desc)
{
if (desc.name.empty() || desc.exportedImplexorApis.empty()) {
if (desc.name.empty() || desc.exportedQualeIfaceApis.empty()) {
return false;
}
for (const auto& api : desc.exportedImplexorApis) {
if (!ExportedImplexorApiDesc::sanityCheck(api)) { return false; }
for (const auto& api : desc.exportedQualeIfaceApis) {
if (!ExportedQualeIfaceApiDesc::sanityCheck(api)) { return false; }
}
return Sal_Mgmt_LibOps::sanityCheck(desc.sal_mgmt_libOps);
}
std::string name;
// These are the implexors whose APIs this lib exports.
std::vector<ExportedImplexorApiDesc> exportedImplexorApis;
// These are the quale-iface APIs this lib exports.
std::vector<ExportedQualeIfaceApiDesc> exportedQualeIfaceApis;
Sal_Mgmt_LibOps sal_mgmt_libOps;
};
@@ -169,7 +169,7 @@ public:
* function. Salmanoff will search for it and invoke it via dlsym().
*
* The function must return a SenseApiDesc struct that Smo will tell
* Smo what implexors can be used with it & what APIs it exports.
* Smo what quale-iface APIs can be used with it & what APIs it exports.
* The SenseApiDesc struct also gives Smo pointers to API functions
* to invoke for communication between Smo and the library.
*
+3 -3
View File
@@ -160,9 +160,9 @@ extern "C" sal_mlo_detachDeviceReqFn livoxGen1_detachDeviceReq;
// Sense API descriptor
static const SenseApiDesc livoxGen1ApiDesc = {
.name = "livoxGen1",
.exportedImplexorApis = {
{.name = "pointCloudCoords"},
{.name = "pointCloudIntensity"},
.exportedQualeIfaceApis = {
{.name = "pcloud"},
{.name = "pcloudIntensity"},
{.name = "gyro"},
{.name = "accel"}
},
+2 -2
View File
@@ -118,7 +118,7 @@ void AttachedWindow::parseWindowSelector(
windowSelector.matchType = xcb_xorg::window_search::MatchType::SUBSTRING;
// Check if 'dev-id', 'dev-string', or 'dev-substring' is specified
for (const auto& param : spec.apiParams)
for (const auto& param : spec.stimBuffApiParams)
{
if (param.first == "dev-id" || param.first == "devid")
{
@@ -330,7 +330,7 @@ static void xcbWindow_detachDeviceReq(
// SenseApi descriptor
static smo::sense_api::SenseApiDesc xcbWindowApiDesc = {
.name = "xcb",
.exportedImplexorApis = { { "video-implexor" } },
.exportedQualeIfaceApis = { { "visual-qualeiface" } },
.sal_mgmt_libOps = {
.initializeInd = xcbWindow_initializeInd,
.finalizeInd = xcbWindow_finalizeInd,
@@ -110,9 +110,9 @@ spec_body:
$$ = new smo::device::DeviceAttachmentSpec();
$$->deviceIdentifier = std::string($1);
$$->sensorType = '\0'; // This will be set by the parent rule
$$->implexor = std::string($3);
$$->api = std::string($5);
$$->apiParams = std::move(*$7);
$$->qualeIfaceApi = std::string($3);
$$->stimBuffApi = std::string($5);
$$->stimBuffApiParams = std::move(*$7);
$$->provider = std::string($10);
$$->providerParams = std::move(*$12);
$$->deviceSelector = std::string($15);
+6 -6
View File
@@ -361,7 +361,7 @@ public:
if (senseApiLib->isBeingDestroyed.load())
{
std::cerr << std::string(__func__) + ": Library is being destroyed"
<< " for API '" << spec->api << "'. Bailing out." << std::endl;
<< " for API '" << spec->stimBuffApi << "'. Bailing out.\n";
callOriginalCb(false, spec);
return;
}
@@ -430,7 +430,7 @@ public:
if (senseApiLib->isBeingDestroyed.load())
{
std::cerr << std::string(__func__) + ": Library is being destroyed"
<< " for API '" << spec->api << "'. Bailing out." << std::endl;
<< " for API '" << spec->stimBuffApi << "'. Bailing out.\n";
callOriginalCb(false, spec);
return;
}
@@ -476,12 +476,12 @@ void DeviceManager::attachSenseDeviceReq(
// Get the sense API lib's qutex
auto libOpt = sense_api::SenseApiManager::getInstance()
.getSenseApiLibByApiName(spec->api);
.getSenseApiLibByApiName(spec->stimBuffApi);
if (!libOpt)
{
std::cerr << "attachSenseDeviceReq: No library found for API '"
<< spec->api << "'" << std::endl;
<< spec->stimBuffApi << "'" << std::endl;
cb.callbackFn(false, spec);
return;
}
@@ -511,12 +511,12 @@ void DeviceManager::detachSenseDeviceReq(
// Get the sense API lib's qutex
auto libOpt = sense_api::SenseApiManager::getInstance()
.getSenseApiLibByApiName(spec->api);
.getSenseApiLibByApiName(spec->stimBuffApi);
if (!libOpt)
{
std::cerr << "detachSenseDeviceReq: No library found for API '"
<< spec->api << "'" << std::endl;
<< spec->stimBuffApi << "'" << std::endl;
cb.callbackFn(false, spec);
return;
}