Senselib FFI: Use devDesc object in SenseApiLib, also add per-device metadata to xcbXorg

We also had to write conversion constructors and so on to CSenseDeviceDesc.
The technical debt that's being piled up from this C FFI is excessive.
I think we'll end it here. API Libs will have to be written in C++
from now on. API Lib interfaces will be in C++.

We'll use cross compilers to ensure stability for out-of-tree lib
development.
This commit is contained in:
2025-01-13 11:53:38 -04:00
parent 660f0f0e73
commit a4f96c8dfa
4 changed files with 84 additions and 12 deletions
+9 -9
View File
@@ -123,7 +123,7 @@ SenseApiManager::getSenseApiLibByApiName(const std::string& apiName)
{
auto it = std::find_if(senseApiLibs.begin(), senseApiLibs.end(),
[&apiName](const std::unique_ptr<SenseApiLib>& lib) {
return lib->getSenseApiDesc()->name == apiName;
return lib->senseApiDesc.name == apiName;
}
);
@@ -173,24 +173,24 @@ std::string SenseApiManager::stringifyLibs() const
void SenseApiManager::initializeSenseApiLib(SenseApiLib& lib)
{
if (!lib.getSenseApiDesc()->sal_mgmt_libOps->initializeInd)
if (!lib.senseApiDesc.sal_mgmt_libOps->initializeInd)
{
throw std::runtime_error(
std::string(__func__) + ": initializeInd() is NULL for library '"
+ lib.libraryPath + "'");
}
lib.getSenseApiDesc()->sal_mgmt_libOps->initializeInd();
lib.senseApiDesc.sal_mgmt_libOps->initializeInd();
}
void SenseApiManager::finalizeSenseApiLib(SenseApiLib& lib)
{
if (!lib.getSenseApiDesc()->sal_mgmt_libOps->finalizeInd)
if (!lib.senseApiDesc.sal_mgmt_libOps->finalizeInd)
{
throw std::runtime_error(
std::string(__func__) + ": finalizeInd() is NULL for library '"
+ lib.libraryPath + "'");
}
lib.getSenseApiDesc()->sal_mgmt_libOps->finalizeInd();
lib.senseApiDesc.sal_mgmt_libOps->finalizeInd();
}
void SenseApiManager::initializeAllSenseApiLibs(void)
@@ -217,14 +217,14 @@ void SenseApiManager::attachSenseDevice(const SenseDeviceSpec& spec)
+ spec.api + "'");
}
auto& lib = libOpt.value().get();
if (!lib.getSenseApiDesc()->sal_mgmt_libOps->attachDeviceReq)
if (!lib.senseApiDesc.sal_mgmt_libOps->attachDeviceReq)
{
throw std::runtime_error(
std::string(__func__) + ": attachDeviceReq() is NULL for library '"
+ lib.libraryPath + "'");
}
CSenseDeviceSpec cSpec(spec);
lib.getSenseApiDesc()->sal_mgmt_libOps->attachDeviceReq(&cSpec);
lib.senseApiDesc.sal_mgmt_libOps->attachDeviceReq(&cSpec);
}
void SenseApiManager::detachSenseDevice(const SenseDeviceSpec& spec)
@@ -237,14 +237,14 @@ void SenseApiManager::detachSenseDevice(const SenseDeviceSpec& spec)
+ spec.api + "'");
}
auto& lib = libOpt.value().get();
if (!lib.getSenseApiDesc()->sal_mgmt_libOps->detachDeviceReq)
if (!lib.senseApiDesc.sal_mgmt_libOps->detachDeviceReq)
{
throw std::runtime_error(
std::string(__func__) + ": detachDeviceReq() is NULL for library '"
+ lib.libraryPath + "'");
}
CSenseDeviceSpec cSpec(spec);
lib.getSenseApiDesc()->sal_mgmt_libOps->detachDeviceReq(&cSpec);
lib.senseApiDesc.sal_mgmt_libOps->detachDeviceReq(&cSpec);
}
void SenseApiManager::attachAllSenseDevicesFromSpecs(void)