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:
@@ -25,7 +25,14 @@ public:
|
|||||||
std::optional<std::reference_wrapper<SenseApiLib>> getSenseApiLib(
|
std::optional<std::reference_wrapper<SenseApiLib>> getSenseApiLib(
|
||||||
const std::string& libraryPath);
|
const std::string& libraryPath);
|
||||||
void unloadSenseApiLib(const std::string& libraryPath);
|
void unloadSenseApiLib(const std::string& libraryPath);
|
||||||
|
|
||||||
|
void initializeSenseApiLib(SenseApiLib& lib);
|
||||||
|
void finalizeSenseApiLib(SenseApiLib& lib);
|
||||||
|
|
||||||
void loadAllSenseApiLibsFromOptions(void);
|
void loadAllSenseApiLibsFromOptions(void);
|
||||||
|
void unloadAllSenseApiLibs(void);
|
||||||
|
void initializeAllSenseApiLibs(void);
|
||||||
|
void finalizeAllSenseApiLibs(void);
|
||||||
|
|
||||||
std::string stringifyLibs() const;
|
std::string stringifyLibs() const;
|
||||||
|
|
||||||
|
|||||||
@@ -135,6 +135,11 @@ void SenseApiManager::unloadSenseApiLib(const std::string& libraryPath)
|
|||||||
<< libraryPath << '\n';
|
<< libraryPath << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SenseApiManager::unloadAllSenseApiLibs(void)
|
||||||
|
{
|
||||||
|
senseApiLibs.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void SenseApiManager::loadAllSenseApiLibsFromOptions()
|
void SenseApiManager::loadAllSenseApiLibsFromOptions()
|
||||||
{
|
{
|
||||||
const auto& options = OptionParser::getOptions();
|
const auto& options = OptionParser::getOptions();
|
||||||
@@ -152,5 +157,41 @@ std::string SenseApiManager::stringifyLibs() const
|
|||||||
return result;
|
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 sense_api
|
||||||
} // namespace hk
|
} // namespace hk
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ struct Csal_mgmt_hkOps
|
|||||||
sal_mho_detachDeviceAckFn *detachDeviceAck;
|
sal_mho_detachDeviceAckFn *detachDeviceAck;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef int (sal_mlo_initializeIndFn)(Csal_mgmt_hkOps *hkOps);
|
typedef int (sal_mlo_initializeIndFn)(void);
|
||||||
typedef int (sal_mlo_finalizeIndFn)(void);
|
typedef int (sal_mlo_finalizeIndFn)(void);
|
||||||
typedef int (sal_mlo_attachDeviceReqFn)(void);
|
typedef int (sal_mlo_attachDeviceReqFn)(void);
|
||||||
typedef int (sal_mlo_detachDeviceReqFn)(void);
|
typedef int (sal_mlo_detachDeviceReqFn)(void);
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ static int initializeHarikoff(int argc, char **argv, char **envp)
|
|||||||
DeviceManager::getInstance().parseAllDeviceSpecs();
|
DeviceManager::getInstance().parseAllDeviceSpecs();
|
||||||
std::cout << DeviceManager::stringifyDeviceSpecs() << std::endl;
|
std::cout << DeviceManager::stringifyDeviceSpecs() << std::endl;
|
||||||
sense_api::SenseApiManager::getInstance().loadAllSenseApiLibsFromOptions();
|
sense_api::SenseApiManager::getInstance().loadAllSenseApiLibsFromOptions();
|
||||||
|
sense_api::SenseApiManager::getInstance().initializeAllSenseApiLibs();
|
||||||
std::cout << sense_api::SenseApiManager::getInstance().stringifyLibs()
|
std::cout << sense_api::SenseApiManager::getInstance().stringifyLibs()
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
|
|||||||
@@ -41,9 +41,8 @@ const CSenseApiDesc *HK_GET_SENSE_API_DESC_FN_NAME(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static sal_mlo_initializeIndFn xcbXorg_initializeInd;
|
static sal_mlo_initializeIndFn xcbXorg_initializeInd;
|
||||||
int xcbXorg_initializeInd(Csal_mgmt_hkOps *hkOps)
|
int xcbXorg_initializeInd(void)
|
||||||
{
|
{
|
||||||
(void)hkOps;
|
|
||||||
std::cerr << "XcbXorg::sal_mlo_initializeInd\n";
|
std::cerr << "XcbXorg::sal_mlo_initializeInd\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user