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