SenseApiMgr: add initialize/finalizeAllSenseApiLibs()

Also, SenseApiDesc: initializeInd() now takes void. We no longer
try to pass a struct of marionette-role ops into the libs. We'll
be using message queueing for the handshake side of async calls now.
This commit is contained in:
2025-01-12 09:44:49 -04:00
parent c8a7a6678f
commit b85d6f76a6
5 changed files with 51 additions and 3 deletions
+41
View File
@@ -135,6 +135,11 @@ void SenseApiManager::unloadSenseApiLib(const std::string& libraryPath)
<< libraryPath << '\n';
}
void SenseApiManager::unloadAllSenseApiLibs(void)
{
senseApiLibs.clear();
}
void SenseApiManager::loadAllSenseApiLibsFromOptions()
{
const auto& options = OptionParser::getOptions();
@@ -152,5 +157,41 @@ std::string SenseApiManager::stringifyLibs() const
return result;
}
void SenseApiManager::initializeSenseApiLib(SenseApiLib& lib)
{
if (!lib.getSenseApiDesc()->sal_mgmt_libOps->initializeInd)
{
throw std::runtime_error(
std::string(__func__) + ": initializeInd() is NULL for library '"
+ lib.libraryPath + "'");
}
lib.getSenseApiDesc()->sal_mgmt_libOps->initializeInd();
}
void SenseApiManager::finalizeSenseApiLib(SenseApiLib& lib)
{
if (!lib.getSenseApiDesc()->sal_mgmt_libOps->finalizeInd)
{
throw std::runtime_error(
std::string(__func__) + ": finalizeInd() is NULL for library '"
+ lib.libraryPath + "'");
}
lib.getSenseApiDesc()->sal_mgmt_libOps->finalizeInd();
}
void SenseApiManager::initializeAllSenseApiLibs(void)
{
for (auto& lib : senseApiLibs) {
initializeSenseApiLib(*lib);
}
}
void SenseApiManager::finalizeAllSenseApiLibs(void)
{
for (auto& lib : senseApiLibs) {
finalizeSenseApiLib(*lib);
}
}
} // namespace sense_api
} // namespace hk