Rename: Sense API => Stim Buff API

This commit is contained in:
2025-10-01 18:47:42 -04:00
parent 56b8e83a09
commit eb5875fe0d
26 changed files with 309 additions and 306 deletions
+1 -1
View File
@@ -88,7 +88,7 @@ endif()
# Add core components
add_subdirectory(smocore)
add_subdirectory(commonLibs)
add_subdirectory(senseApis)
add_subdirectory(stimBuffApis)
add_subdirectory(wilzorApis)
add_subdirectory(devices)
+1 -1
View File
@@ -245,7 +245,7 @@ void DeviceManager::destroyDeviceReq(
}
void main(const std::shared_ptr<smo::ComponentThread> &componentThread,
const smo::sense_api::SmoCallbacks& smoCallbacks)
const smo::stim_buff::SmoCallbacks& smoCallbacks)
{
if (protoState.isInitialized) {
return;
+2 -2
View File
@@ -58,7 +58,7 @@ public:
void main(
const std::shared_ptr<smo::ComponentThread> &componentThread,
const smo::sense_api::SmoCallbacks& smoCallbacks);
const smo::stim_buff::SmoCallbacks& smoCallbacks);
void exit(void);
// Global state structure
@@ -67,7 +67,7 @@ struct ProtoState
bool isInitialized = false;
std::shared_ptr<smo::ComponentThread> componentThread;
std::unique_ptr<DeviceManager> deviceManager;
smo::sense_api::SmoCallbacks smoCallbacks;
smo::stim_buff::SmoCallbacks smoCallbacks;
};
// Access to global state for extern "C" functions
+1 -1
View File
@@ -52,7 +52,7 @@ void livoxProto1_destroyDeviceReq(
void livoxProto1_main(
const std::shared_ptr<smo::ComponentThread>& componentThread,
const smo::sense_api::SmoCallbacks& smoCallbacks)
const smo::stim_buff::SmoCallbacks& smoCallbacks)
{
livoxProto1::main(componentThread, smoCallbacks);
}
+2 -2
View File
@@ -9,7 +9,7 @@
// Forward declarations
namespace smo {
namespace sense_api {
namespace stim_buff {
struct SmoCallbacks;
}
class ComponentThread;
@@ -30,7 +30,7 @@ extern "C" {
*/
typedef void livoxProto1_mainFn(
const std::shared_ptr<smo::ComponentThread>& componentThread,
const smo::sense_api::SmoCallbacks& smoCallbacks);
const smo::stim_buff::SmoCallbacks& smoCallbacks);
/**
* Cleanup the Livox protocol library
+1 -3
View File
@@ -1,3 +1 @@
+edev|avia0|
structural-implexor|livoxGen1()|livoxProto1()
|3JEDK380010Z39
+edev|avia0|structural-qualeiface|livoxGen1()|livoxProto1()|3JEDK380010Z39
+1 -3
View File
@@ -1,3 +1 @@
+edev|win0|
visual-implexor|xcb(dev-substring)|xorg(display=1|screen=0)
|mut
+edev|win0|visual-qualeiface|xcb(dev-substring)|xorg(display=1|screen=0)|mut
+10 -9
View File
@@ -26,15 +26,16 @@
#cmakedefine CONFIG_LIB_XCBXORG_ENABLED
#cmakedefine CONFIG_LIB_ALSA_ENABLED
/* Sense APIs */
#cmakedefine CONFIG_SENSEAPI_XCBWINDOW_ENABLED
#cmakedefine CONFIG_SENSEAPI_V4L_ENABLED
#cmakedefine CONFIG_SENSEAPI_ALSAMIC_ENABLED
#cmakedefine CONFIG_SENSEAPI_LIVOX_ENABLED
#cmakedefine CONFIG_SENSEAPI_R3LIVE_ENABLED
#cmakedefine CONFIG_SENSEAPI_FASTLIO2_ENABLED
#cmakedefine CONFIG_SENSEAPI_ADALIO2_ENABLED
#cmakedefine CONFIG_SENSEAPI_DEEPLIO2_ENABLED
/* Stim Buff APIs */
#cmakedefine CONFIG_STIMBUFFAPI_XCBWINDOW_ENABLED
#cmakedefine CONFIG_STIMBUFFAPI_LIVOXGEN1_ENABLED
#cmakedefine CONFIG_STIMBUFFAPI_V4L_ENABLED
#cmakedefine CONFIG_STIMBUFFAPI_ALSAMIC_ENABLED
#cmakedefine CONFIG_STIMBUFFAPI_LIVOX_ENABLED
#cmakedefine CONFIG_STIMBUFFAPI_R3LIVE_ENABLED
#cmakedefine CONFIG_STIMBUFFAPI_FASTLIO2_ENABLED
#cmakedefine CONFIG_STIMBUFFAPI_ADALIO2_ENABLED
#cmakedefine CONFIG_STIMBUFFAPI_DEEPLIO2_ENABLED
/* Wilzor APIs */
#cmakedefine CONFIG_WILZORAPI_XCBMOUSE_ENABLED
+15 -15
View File
@@ -11,7 +11,7 @@
#include <callback.h>
namespace smo {
namespace sense_api {
namespace stim_buff {
/**
* @brief Threading model descriptor for senseApi libraries.
@@ -82,7 +82,7 @@ struct SmoCallbacks
struct Sal_Mgmt_LibOps
{
/* When Salmanoff loads a sense API lib, it calls this function to initialize
/* When Salmanoff loads a stim buff API lib, it calls this function to initialize
* the lib. When this returns, the lib should be ready to attach devices.
*/
sal_mlo_initializeIndFn *initializeInd;
@@ -109,10 +109,10 @@ struct Sal_Mgmt_LibOps
}
};
/* Exported by all sense API Libraries to tell Salmanoff what API the lib uses
/* Exported by all stim buff API Libraries to tell Salmanoff what API the lib uses
* to connect to providers; and also to state which quale-iface APIs it exports.
*/
class SenseApiDesc
class StimBuffApiDesc
{
public:
class ExportedQualeIfaceApiDesc
@@ -139,7 +139,7 @@ public:
return result;
}
static bool sanityCheck(const SenseApiDesc &desc)
static bool sanityCheck(const StimBuffApiDesc &desc)
{
if (desc.name.empty() || desc.exportedQualeIfaceApis.empty()) {
return false;
@@ -159,18 +159,18 @@ public:
};
#define SMO_GET_SENSE_API_DESC_FN_NAME getSenseApiDesc
#define SMO_GET_SENSE_API_DESC_FN_NAME_STR \
SMO_QUOTE(SMO_GET_SENSE_API_DESC_FN_NAME)
#define SMO_GET_SENSE_API_DESC_FN_TYPEDEF \
SMO_CONCAT(SMO_GET_SENSE_API_DESC_FN_NAME, Fn)
#define SMO_GET_STIM_BUFF_API_DESC_FN_NAME getStimBuffApiDesc
#define SMO_GET_STIM_BUFF_API_DESC_FN_NAME_STR \
SMO_QUOTE(SMO_GET_STIM_BUFF_API_DESC_FN_NAME)
#define SMO_GET_STIM_BUFF_API_DESC_FN_TYPEDEF \
SMO_CONCAT(SMO_GET_STIM_BUFF_API_DESC_FN_NAME, Fn)
/* Every Sense API library must define a global instance of this
/* Every Stim Buff API library must define a global instance of this
* 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 StimBuffApiDesc struct that Smo will tell
* 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 StimBuffApiDesc struct also gives Smo pointers to API functions
* to invoke for communication between Smo and the library.
*
* The SmoCallbacks parameter provides the library with access to
@@ -178,11 +178,11 @@ public:
* The SmoThreadingModelDesc parameter provides the library with access to
* the io_service for network operations and event handling.
*/
typedef const SenseApiDesc &(SMO_GET_SENSE_API_DESC_FN_TYPEDEF)(
typedef const StimBuffApiDesc &(SMO_GET_STIM_BUFF_API_DESC_FN_TYPEDEF)(
const SmoCallbacks& callbacks,
const SmoThreadingModelDesc& threadingModel);
} // namespace sense_api
} // namespace stim_buff
} // namespace smo
#endif // __USER_SENSE_API_LIB_H__
+1 -1
View File
@@ -29,7 +29,7 @@ add_library(smocore STATIC
${YACC_OUTPUT}
# SenseApis
senseApis/senseApiManager.cpp
stimBuffApis/stimBuffApiManager.cpp
# MindManager
mindManager/mindManager.cpp
+11 -10
View File
@@ -6,7 +6,7 @@
#include <body/body.h>
#include <componentThread.h>
#include <mind.h>
#include <senseApis/senseApiManager.h>
#include <stimBuffApis/stimBuffApiManager.h>
#include <deviceManager/deviceManager.h>
namespace smo {
@@ -53,8 +53,8 @@ public:
* Right now we use Marionette, but there's a strong argument for using
* Body instead since it's meant to handle device-management operations.
*/
sense_api::SenseApiManager::getInstance()
.loadAllSenseApiLibsFromOptions(caller);
stim_buff::StimBuffApiManager::getInstance()
.loadAllStimBuffApiLibsFromOptions(caller);
/** EXPLANATION:
* Consider body::initializeReq to have been called if even one of its
@@ -63,15 +63,16 @@ public:
*/
context->parent.bodyComponentInitialized = true;
std::cout << sense_api::SenseApiManager::getInstance().stringifyLibs()
std::cout << stim_buff::StimBuffApiManager::getInstance().stringifyLibs()
<< std::endl;
if (OptionParser::getOptions().verbose)
{
std::cout << __func__ << ": About to initializeAllSenseApiLibs"
std::cout << __func__ << ": About to initializeAllStimBuffApiLibs"
<< '\n';
}
sense_api::SenseApiManager::getInstance().initializeAllSenseApiLibs();
stim_buff::StimBuffApiManager::getInstance()
.initializeAllStimBuffApiLibs();
if (OptionParser::getOptions().verbose)
{
@@ -134,11 +135,11 @@ public:
<< results.nSucceeded << " of " << results.nTotal
<< " sense devices." << "\n";
std::cout << "Mrntt: About to finalize all sense api libs." << "\n";
sense_api::SenseApiManager::getInstance().finalizeAllSenseApiLibs();
std::cout << "Mrntt: About to finalize all stim buff api libs." << "\n";
stim_buff::StimBuffApiManager::getInstance().finalizeAllStimBuffApiLibs();
std::cout << "Mrntt: About to unload all sense api libs." << "\n";
sense_api::SenseApiManager::getInstance().unloadAllSenseApiLibs();
std::cout << "Mrntt: About to unload all stim buff api libs." << "\n";
stim_buff::StimBuffApiManager::getInstance().unloadAllStimBuffApiLibs();
callOriginalCb(results.nSucceeded == results.nTotal);
}
};
+59 -56
View File
@@ -12,7 +12,7 @@
#include <componentThread.h>
#include <deviceManager/deviceManager.h>
#include <deviceManager/deviceReattacher.h>
#include <senseApis/senseApiManager.h>
#include <stimBuffApis/stimBuffApiManager.h>
#include <marionette/marionette.h>
#include <mind.h>
@@ -132,7 +132,7 @@ public:
return;
}
DeviceManager::getInstance().attachSenseDeviceReq(
DeviceManager::getInstance().attachStimBuffDeviceReq(
specPtr,
{context, std::bind(
&NewDeviceAttachmentSpecInd::newDeviceAttachmentSpecInd2,
@@ -209,8 +209,8 @@ public:
return;
}
// Call detachSenseDeviceReq first - only clean up metadata if this succeeds
DeviceManager::getInstance().detachSenseDeviceReq(
// Call detachStimBuffDeviceReq first - only clean up metadata if this succeeds
DeviceManager::getInstance().detachStimBuffDeviceReq(
specPtr,
{context, std::bind(
&RemoveDeviceAttachmentSpecReq::removeDeviceAttachmentSpecReq2,
@@ -329,24 +329,25 @@ void DeviceManager::removeDeviceAttachmentSpecReq(
request.get(), request));
}
class DeviceManager::AttachSenseDeviceReq
: public SerializedAsynchronousContinuation<attachSenseDeviceReqCbFn>
class DeviceManager::AttachStimBuffDeviceReq
: public SerializedAsynchronousContinuation<
DeviceManager::attachStimBuffDeviceReqCbFn>
{
public:
AttachSenseDeviceReq(
AttachStimBuffDeviceReq(
const std::shared_ptr<DeviceAttachmentSpec>& spec,
const std::shared_ptr<ComponentThread> &caller,
Callback<attachSenseDeviceReqCbFn> cb,
std::shared_ptr<sense_api::SenseApiLib> &senseApiLib,
Callback<DeviceManager::attachStimBuffDeviceReqCbFn> cb,
std::shared_ptr<stim_buff::StimBuffApiLib> &stimBuffApiLib,
std::vector<std::reference_wrapper<Qutex>> requiredLocks)
: SerializedAsynchronousContinuation<attachSenseDeviceReqCbFn>(
: SerializedAsynchronousContinuation<attachStimBuffDeviceReqCbFn>(
caller, cb, requiredLocks),
spec(spec), senseApiLib(senseApiLib)
spec(spec), stimBuffApiLib(stimBuffApiLib)
{}
public:
void attachSenseDeviceReq1_posted(
[[maybe_unused]] std::shared_ptr<AttachSenseDeviceReq> context
void attachStimBuffDeviceReq1_posted(
[[maybe_unused]] std::shared_ptr<AttachStimBuffDeviceReq> context
)
{
if (caller->id != ComponentThread::MRNTT)
@@ -358,7 +359,7 @@ public:
return;
}
if (senseApiLib->isBeingDestroyed.load())
if (stimBuffApiLib->isBeingDestroyed.load())
{
std::cerr << std::string(__func__) + ": Library is being destroyed"
<< " for API '" << spec->stimBuffApi << "'. Bailing out.\n";
@@ -366,15 +367,16 @@ public:
return;
}
if (!senseApiLib->senseApiDesc.sal_mgmt_libOps.attachDeviceReq)
if (!stimBuffApiLib->stimBuffApiDesc.sal_mgmt_libOps.attachDeviceReq)
{
std::cerr << std::string(__func__) + ": attachDeviceReq() is NULL "
"for library '" << senseApiLib->libraryPath << "'" << std::endl;
"for library '" << stimBuffApiLib->libraryPath << "'"
<< std::endl;
callOriginalCb(false, spec);
return;
}
releaseQutexEarly(sense_api::SenseApiManager::getInstance().qutex);
releaseQutexEarly(stim_buff::StimBuffApiManager::getInstance().qutex);
/** EXPLANATION:
* We pass in either the body or world thread here, depending on whether
@@ -397,16 +399,16 @@ public:
<< spec->deviceIdentifier << " to body thread" << "\n";
}
senseApiLib->senseApiDesc.sal_mgmt_libOps.attachDeviceReq(
stimBuffApiLib->stimBuffApiDesc.sal_mgmt_libOps.attachDeviceReq(
spec, threadForAttachment,
{context, std::bind(
&AttachSenseDeviceReq::attachSenseDeviceReq2,
&AttachStimBuffDeviceReq::attachStimBuffDeviceReq2,
context.get(), context,
std::placeholders::_1, std::placeholders::_2)});
}
void attachSenseDeviceReq2(
[[maybe_unused]] std::shared_ptr<AttachSenseDeviceReq> context,
void attachStimBuffDeviceReq2(
[[maybe_unused]] std::shared_ptr<AttachStimBuffDeviceReq> context,
bool success,
std::shared_ptr<DeviceAttachmentSpec> deviceSpec
)
@@ -414,8 +416,8 @@ public:
callOriginalCb(success, deviceSpec);
}
void detachSenseDeviceReq1_posted(
[[maybe_unused]] std::shared_ptr<DetachSenseDeviceReq> context
void detachStimBuffDeviceReq1_posted(
[[maybe_unused]] std::shared_ptr<AttachStimBuffDeviceReq> context
)
{
if (caller->id != ComponentThread::MRNTT)
@@ -427,7 +429,7 @@ public:
return;
}
if (senseApiLib->isBeingDestroyed.load())
if (stimBuffApiLib->isBeingDestroyed.load())
{
std::cerr << std::string(__func__) + ": Library is being destroyed"
<< " for API '" << spec->stimBuffApi << "'. Bailing out.\n";
@@ -435,26 +437,27 @@ public:
return;
}
if (!senseApiLib->senseApiDesc.sal_mgmt_libOps.detachDeviceReq)
if (!stimBuffApiLib->stimBuffApiDesc.sal_mgmt_libOps.detachDeviceReq)
{
std::cerr << std::string(__func__) + ": detachDeviceReq() is NULL "
"for library '" << senseApiLib->libraryPath << "'" << std::endl;
"for library '" << stimBuffApiLib->libraryPath << "'"
<< std::endl;
callOriginalCb(false, spec);
return;
}
releaseQutexEarly(sense_api::SenseApiManager::getInstance().qutex);
releaseQutexEarly(stim_buff::StimBuffApiManager::getInstance().qutex);
senseApiLib->senseApiDesc.sal_mgmt_libOps.detachDeviceReq(
stimBuffApiLib->stimBuffApiDesc.sal_mgmt_libOps.detachDeviceReq(
spec,
{context, std::bind(
&DetachSenseDeviceReq::detachSenseDeviceReq2,
&AttachStimBuffDeviceReq::detachStimBuffDeviceReq2,
context.get(), context,
std::placeholders::_1, std::placeholders::_2)});
}
}
void detachSenseDeviceReq2(
[[maybe_unused]] std::shared_ptr<DetachSenseDeviceReq> context,
void detachStimBuffDeviceReq2(
[[maybe_unused]] std::shared_ptr<AttachStimBuffDeviceReq> context,
bool success,
std::shared_ptr<DeviceAttachmentSpec> deviceSpec
)
@@ -464,23 +467,23 @@ public:
public:
std::shared_ptr<DeviceAttachmentSpec> spec;
std::shared_ptr<sense_api::SenseApiLib> senseApiLib;
std::shared_ptr<stim_buff::StimBuffApiLib> stimBuffApiLib;
};
void DeviceManager::attachSenseDeviceReq(
void DeviceManager::attachStimBuffDeviceReq(
const std::shared_ptr<DeviceAttachmentSpec>& spec,
Callback<attachSenseDeviceReqCbFn> cb
Callback<attachStimBuffDeviceReqCbFn> cb
)
{
const auto& caller = ComponentThread::getSelf();
// Get the sense API lib's qutex
auto libOpt = sense_api::SenseApiManager::getInstance()
.getSenseApiLibByApiName(spec->stimBuffApi);
// Get the stim buff API lib's qutex
auto libOpt = stim_buff::StimBuffApiManager::getInstance()
.getStimBuffApiLibByApiName(spec->stimBuffApi);
if (!libOpt)
{
std::cerr << "attachSenseDeviceReq: No library found for API '"
std::cerr << "attachStimBuffDeviceReq: No library found for API '"
<< spec->stimBuffApi << "'" << std::endl;
cb.callbackFn(false, spec);
return;
@@ -488,34 +491,34 @@ void DeviceManager::attachSenseDeviceReq(
auto& lib = *libOpt.value();
auto request = std::make_shared<AttachSenseDeviceReq>(
auto request = std::make_shared<AttachStimBuffDeviceReq>(
spec, caller, cb, libOpt.value(),
LockSet<attachSenseDeviceReqCbFn>::Set{
std::ref(sense_api::SenseApiManager::getInstance().qutex),
LockSet<attachStimBuffDeviceReqCbFn>::Set{
std::ref(stim_buff::StimBuffApiManager::getInstance().qutex),
std::ref(lib.qutex)
});
AttachSenseDeviceReq::LockerAndInvoker lockvoker(
AttachStimBuffDeviceReq::LockerAndInvoker lockvoker(
*request, mrntt::mrntt.thread,
std::bind(
&AttachSenseDeviceReq::attachSenseDeviceReq1_posted,
&AttachStimBuffDeviceReq::attachStimBuffDeviceReq1_posted,
request.get(), request));
}
void DeviceManager::detachSenseDeviceReq(
void DeviceManager::detachStimBuffDeviceReq(
const std::shared_ptr<DeviceAttachmentSpec>& spec,
Callback<detachSenseDeviceReqCbFn> cb
Callback<detachStimBuffDeviceReqCbFn> cb
)
{
const auto& caller = ComponentThread::getSelf();
// Get the sense API lib's qutex
auto libOpt = sense_api::SenseApiManager::getInstance()
.getSenseApiLibByApiName(spec->stimBuffApi);
// Get the stim buff API lib's qutex
auto libOpt = stim_buff::StimBuffApiManager::getInstance()
.getStimBuffApiLibByApiName(spec->stimBuffApi);
if (!libOpt)
{
std::cerr << "detachSenseDeviceReq: No library found for API '"
std::cerr << "detachStimBuffDeviceReq: No library found for API '"
<< spec->stimBuffApi << "'" << std::endl;
cb.callbackFn(false, spec);
return;
@@ -523,17 +526,17 @@ void DeviceManager::detachSenseDeviceReq(
auto& lib = *libOpt.value();
auto request = std::make_shared<DetachSenseDeviceReq>(
auto request = std::make_shared<DetachStimBuffDeviceReq>(
spec, caller, cb, libOpt.value(),
LockSet<detachSenseDeviceReqCbFn>::Set{
std::ref(sense_api::SenseApiManager::getInstance().qutex),
LockSet<detachStimBuffDeviceReqCbFn>::Set{
std::ref(stim_buff::StimBuffApiManager::getInstance().qutex),
std::ref(lib.qutex)
});
DetachSenseDeviceReq::LockerAndInvoker lockvoker(
DetachStimBuffDeviceReq::LockerAndInvoker lockvoker(
*request, mrntt::mrntt.thread,
std::bind(
&DetachSenseDeviceReq::detachSenseDeviceReq1_posted,
&DetachStimBuffDeviceReq::detachStimBuffDeviceReq1_posted,
request.get(), request));
}
@@ -746,7 +749,7 @@ public:
{
for (const auto& deviceRole : DeviceManager::attachedDeviceRoles)
{
DeviceManager::getInstance().detachSenseDeviceReq(
DeviceManager::getInstance().detachStimBuffDeviceReq(
deviceRole->deviceAttachmentSpec,
{context, std::bind(
&DetachAllAttachedDeviceRoles::detachAllAttachedDeviceRoles2,
@@ -61,15 +61,15 @@ public:
Callback<removeDeviceAttachmentSpecReqCbFn> callback);
// Device attachment/detachment methods moved from SenseApiManager
typedef sense_api::sal_mlo_attachDeviceReqCbFn attachSenseDeviceReqCbFn;
typedef sense_api::sal_mlo_detachDeviceReqCbFn detachSenseDeviceReqCbFn;
typedef stim_buff::sal_mlo_attachDeviceReqCbFn attachStimBuffDeviceReqCbFn;
typedef stim_buff::sal_mlo_detachDeviceReqCbFn detachStimBuffDeviceReqCbFn;
void attachSenseDeviceReq(
void attachStimBuffDeviceReq(
const std::shared_ptr<DeviceAttachmentSpec>& spec,
Callback<attachSenseDeviceReqCbFn> cb);
void detachSenseDeviceReq(
Callback<attachStimBuffDeviceReqCbFn> cb);
void detachStimBuffDeviceReq(
const std::shared_ptr<DeviceAttachmentSpec>& spec,
Callback<detachSenseDeviceReqCbFn> cb);
Callback<detachStimBuffDeviceReqCbFn> cb);
typedef std::function<void(AsynchronousLoop &results)>
attachAllUnattachedDevicesFromReqCbFn;
@@ -108,8 +108,8 @@ private:
class NewDeviceAttachmentSpecInd;
class RemoveDeviceAttachmentSpecReq;
class AttachSenseDeviceReq;
typedef AttachSenseDeviceReq DetachSenseDeviceReq;
class AttachStimBuffDeviceReq;
typedef AttachStimBuffDeviceReq DetachStimBuffDeviceReq;
class AttachAllUnattachedDevicesFromReq;
class AttachAllUnattachedDevicesFromKnownListReq;
class DetachAllAttachedDeviceRoles;
@@ -1,78 +0,0 @@
#ifndef SENSE_API_MANAGER_H
#define SENSE_API_MANAGER_H
#include <config.h>
#include <memory>
#include <vector>
#include <string>
#include <optional>
#include <functional>
#include <componentThread.h>
#include <asynchronousLoop.h>
#include <senseApis/senseApiLib.h>
#include <user/deviceAttachmentSpec.h>
#include <callback.h>
#include <qutex.h>
namespace smo {
namespace sense_api {
class SenseApiManager
{
public:
static SenseApiManager& getInstance()
{
static SenseApiManager instance;
return instance;
}
void initialize(void)
{};
void finalize(void)
{};
SenseApiLib& loadSenseApiLib(
const std::string& libraryPath,
const std::shared_ptr<ComponentThread>& componentThread);
std::optional<std::shared_ptr<SenseApiLib>> getSenseApiLib(
const std::string& libraryPath);
std::optional<std::shared_ptr<SenseApiLib>> getSenseApiLibByApiName(
const std::string& apiName);
void unloadSenseApiLib(const std::string& libraryPath);
void initializeSenseApiLib(SenseApiLib& lib);
void finalizeSenseApiLib(SenseApiLib& lib);
void loadAllSenseApiLibsFromOptions(
const std::shared_ptr<ComponentThread>& componentThread);
void unloadAllSenseApiLibs(void);
void initializeAllSenseApiLibs(void);
void finalizeAllSenseApiLibs(void);
std::string stringifyLibs() const;
private:
SenseApiManager()
: qutex("SenseApiManager")
{}
~SenseApiManager() = default;
SenseApiManager(const SenseApiManager&) = delete;
SenseApiManager& operator=(const SenseApiManager&) = delete;
std::vector<std::shared_ptr<SenseApiLib>> senseApiLibs;
public:
Qutex qutex;
public:
static std::optional<std::string> searchForLibInSmoSearchPaths(
const std::string& libraryPath);
};
} // namespace sense_api
} // namespace smo
#endif // SENSE_API_MANAGER_H
@@ -11,12 +11,12 @@
#include <qutex.h>
namespace smo {
namespace sense_api {
namespace stim_buff {
class SenseApiLib
class StimBuffApiLib
{
private:
friend class SenseApiManager;
friend class StimBuffApiManager;
struct DlCloser
{
void operator()(void* handle) const
@@ -28,24 +28,25 @@ private:
};
public:
SenseApiLib(
StimBuffApiLib(
const std::string& path, void *_dlopen_handle,
SMO_GET_SENSE_API_DESC_FN_TYPEDEF *descFn)
: libraryPath(path), qutex("SenseApiLib-" + path), isBeingDestroyed(false),
SMO_GET_STIM_BUFF_API_DESC_FN_TYPEDEF *descFn)
: libraryPath(path), qutex("StimBuffApiLib-" + path),
isBeingDestroyed(false),
dlopen_handle(_dlopen_handle, DlCloser()),
SMO_GET_SENSE_API_DESC_FN_NAME(descFn)
SMO_GET_STIM_BUFF_API_DESC_FN_NAME(descFn)
{}
void setSenseApiDesc(const SenseApiDesc &desc)
void setStimBuffApiDesc(const StimBuffApiDesc &desc)
{
if (!SenseApiDesc::sanityCheck(desc))
if (!StimBuffApiDesc::sanityCheck(desc))
{
throw std::runtime_error(
std::string(__func__) + ": Sanity check failed for sense API "
std::string(__func__) + ": Sanity check failed for stim buff API "
"descriptor in library '" + libraryPath + "'");
}
senseApiDesc = desc;
stimBuffApiDesc = desc;
}
public:
@@ -54,36 +55,36 @@ public:
std::atomic<bool> isBeingDestroyed;
std::unique_ptr<void, DlCloser> dlopen_handle;
/* UNIMPLEMENTED: API-specific cmdline options. These affect this specific
* sense api lib's behaviour globally.
* stim buff api lib's behaviour globally.
*/
std::vector<std::string> options;
/**
* @brief Every sense API lib is required to provide a function that returns
* a SenseApiDesc struct. This struct states which API the lib uses to
* connect Salmanoff to the sense provider it supports.
* @brief Each stim buff API library must provide a function returning a
* StimBuffApiDesc. This struct specifies which API the library uses to
* connect Salmanoff to its supported stim buff provider.
*
* This getter function should be visible to dlsym() so that Salmanoff can
* find it in the lib after loading it, and call it.
*/
std::function<SMO_GET_SENSE_API_DESC_FN_TYPEDEF>
SMO_GET_SENSE_API_DESC_FN_NAME;
std::function<SMO_GET_STIM_BUFF_API_DESC_FN_TYPEDEF>
SMO_GET_STIM_BUFF_API_DESC_FN_NAME;
/**
* @brief Salmanoff will call the `SMO_GET_SENSE_API_DESC_FN_NAME` getter
* @brief Salmanoff will call the `SMO_GET_STIM_BUFF_API_DESC_FN_NAME` getter
* function and use the data it provides in order to fill out this
* descriptor.
*/
SenseApiDesc senseApiDesc;
StimBuffApiDesc stimBuffApiDesc;
std::string stringify() const {
std::string result = "Library Path: " + libraryPath + "\n";
result += "Sense API Descriptor: " + senseApiDesc.stringify() + "\n";
result += "Stim Buff API Descriptor: " + stimBuffApiDesc.stringify() + "\n";
return result;
}
};
} // namespace sense_api
} // namespace stim_buff
} // namespace smo
#endif // SENSE_API_PROVIDER_DESC_H
@@ -0,0 +1,78 @@
#ifndef SENSE_API_MANAGER_H
#define SENSE_API_MANAGER_H
#include <config.h>
#include <memory>
#include <vector>
#include <string>
#include <optional>
#include <functional>
#include <componentThread.h>
#include <asynchronousLoop.h>
#include <stimBuffApis/stimBuffApiLib.h>
#include <user/deviceAttachmentSpec.h>
#include <callback.h>
#include <qutex.h>
namespace smo {
namespace stim_buff {
class StimBuffApiManager
{
public:
static StimBuffApiManager& getInstance()
{
static StimBuffApiManager instance;
return instance;
}
void initialize(void)
{};
void finalize(void)
{};
StimBuffApiLib& loadStimBuffApiLib(
const std::string& libraryPath,
const std::shared_ptr<ComponentThread>& componentThread);
std::optional<std::shared_ptr<StimBuffApiLib>> getStimBuffApiLib(
const std::string& libraryPath);
std::optional<std::shared_ptr<StimBuffApiLib>> getStimBuffApiLibByApiName(
const std::string& apiName);
void unloadStimBuffApiLib(const std::string& libraryPath);
void initializeStimBuffApiLib(StimBuffApiLib& lib);
void finalizeStimBuffApiLib(StimBuffApiLib& lib);
void loadAllStimBuffApiLibsFromOptions(
const std::shared_ptr<ComponentThread>& componentThread);
void unloadAllStimBuffApiLibs(void);
void initializeAllStimBuffApiLibs(void);
void finalizeAllStimBuffApiLibs(void);
std::string stringifyLibs() const;
private:
StimBuffApiManager()
: qutex("StimBuffApiManager")
{}
~StimBuffApiManager() = default;
StimBuffApiManager(const StimBuffApiManager&) = delete;
StimBuffApiManager& operator=(const StimBuffApiManager&) = delete;
std::vector<std::shared_ptr<StimBuffApiLib>> stimBuffApiLibs;
public:
Qutex qutex;
public:
static std::optional<std::string> searchForLibInSmoSearchPaths(
const std::string& libraryPath);
};
} // namespace stim_buff
} // namespace smo
#endif // SENSE_API_MANAGER_H
+3 -3
View File
@@ -1,7 +1,7 @@
#include <iostream>
#include <mindManager/mindManager.h>
#include <deviceManager/deviceManager.h>
#include <senseApis/senseApiManager.h>
#include <stimBuffApis/stimBuffApiManager.h>
#include <salmanoff.h>
@@ -12,7 +12,7 @@ void initializeSalmanoff(void)
std::cout << __func__ << ": Entered." << std::endl;
mind::MindManager::getInstance().initialize();
sense_api::SenseApiManager::getInstance().initialize();
stim_buff::StimBuffApiManager::getInstance().initialize();
device::DeviceManager::getInstance().initialize();
device::DeviceManager::getInstance().collateAllDapSpecs();
device::DeviceManager::getInstance().parseAllDapSpecs();
@@ -23,7 +23,7 @@ void shutdownSalmanoff(void)
{
std::cout << __func__ << ": Entered." << std::endl;
device::DeviceManager::getInstance().finalize();
sense_api::SenseApiManager::getInstance().finalize();
stim_buff::StimBuffApiManager::getInstance().finalize();
mind::MindManager::getInstance().finalize();
}
+1 -1
View File
@@ -7,7 +7,7 @@
#include <componentThread.h>
#include <director/director.h>
#include <simulator/simulator.h>
#include <senseApis/senseApiManager.h>
#include <stimBuffApis/stimBuffApiManager.h>
#include <marionette/marionette.h>
namespace smo {
+2 -2
View File
@@ -129,12 +129,12 @@ std::string OptionParser::stringifyOptions(void) const
}
oss << std::endl;
oss << "Sense API Library Paths: ";
oss << "Stim Buff API Library Paths: ";
for (const auto& path : senseApiLibPath) {
oss << path << " ";
}
oss << std::endl;
oss << "Sense API Libraries: ";
oss << "Stim Buff API Libraries: ";
for (const auto& lib : senseApiLibs) {
oss << lib << " ";
}
@@ -2,8 +2,8 @@
#include <stdexcept>
#include <optional>
#include <filesystem>
#include <senseApis/senseApiManager.h>
#include <senseApis/senseApiLib.h>
#include <stimBuffApis/stimBuffApiManager.h>
#include <stimBuffApis/stimBuffApiLib.h>
#include <opts.h>
#include <asynchronousBridge.h>
#include <asynchronousContinuation.h>
@@ -18,7 +18,7 @@
namespace fs = std::filesystem;
namespace smo {
namespace sense_api {
namespace stim_buff {
/**
* @brief Searches for a library in predefined locations
@@ -45,7 +45,7 @@ static std::optional<std::string> searchForLibInSmoSearchPaths(
const auto& options = OptionParser::getOptions();
if (!options.senseApiLibPath.empty())
{
// Insert all sense API library paths at the beginning of search paths
// Insert all stim buff API library paths at the beginning of search paths
searchPaths.insert(
searchPaths.begin(),
options.senseApiLibPath.begin(),
@@ -79,7 +79,7 @@ static std::shared_ptr<ComponentThread> ComponentThread_getSelf()
return ComponentThread::getSelf();
}
/* Hooks to be provided to senseApiLibs, enabling them to call into Salmanoff
/* Hooks to be provided to stimBuffApiLibs, enabling them to call into Salmanoff
* code.
*/
static SmoCallbacks smoCallbacks =
@@ -93,13 +93,13 @@ static SmoThreadingModelDesc smoThreadingModelDesc = {
.componentThread = nullptr
};
std::optional<std::string> SenseApiManager::searchForLibInSmoSearchPaths(
std::optional<std::string> StimBuffApiManager::searchForLibInSmoSearchPaths(
const std::string& libraryPath)
{
return ::smo::sense_api::searchForLibInSmoSearchPaths(libraryPath);
return ::smo::stim_buff::searchForLibInSmoSearchPaths(libraryPath);
}
SenseApiLib& SenseApiManager::loadSenseApiLib(
StimBuffApiLib& StimBuffApiManager::loadStimBuffApiLib(
const std::string& libraryPath,
const std::shared_ptr<ComponentThread>& componentThread
)
@@ -110,7 +110,7 @@ SenseApiLib& SenseApiManager::loadSenseApiLib(
// Clear any existing error
dlerror();
auto dlopen_handle = std::unique_ptr<void, SenseApiLib::DlCloser>(
auto dlopen_handle = std::unique_ptr<void, StimBuffApiLib::DlCloser>(
dlopen(resolvedPath.c_str(), RTLD_LAZY));
if (!dlopen_handle && fullPath.has_value())
{
@@ -133,13 +133,13 @@ SenseApiLib& SenseApiManager::loadSenseApiLib(
}
// Initialize getSenseApiDescriptor
auto func = reinterpret_cast<SMO_GET_SENSE_API_DESC_FN_TYPEDEF *>(
dlsym(dlopen_handle.get(), SMO_GET_SENSE_API_DESC_FN_NAME_STR));
auto func = reinterpret_cast<SMO_GET_STIM_BUFF_API_DESC_FN_TYPEDEF *>(
dlsym(dlopen_handle.get(), SMO_GET_STIM_BUFF_API_DESC_FN_NAME_STR));
if (!func)
{
throw std::runtime_error(
std::string(__func__) + ": dlsym('"
SMO_GET_SENSE_API_DESC_FN_NAME_STR "') failed for library '"
SMO_GET_STIM_BUFF_API_DESC_FN_NAME_STR "') failed for library '"
+ libraryPath + "'");
}
@@ -148,53 +148,53 @@ SenseApiLib& SenseApiManager::loadSenseApiLib(
smoThreadingModelDesc.componentThread = componentThread;
}
const SenseApiDesc &libApiDesc = func(
const StimBuffApiDesc &libApiDesc = func(
smoCallbacks, smoThreadingModelDesc);
auto lib = std::make_shared<SenseApiLib>(
auto lib = std::make_shared<StimBuffApiLib>(
libraryPath, dlopen_handle.release(), func);
lib->setSenseApiDesc(libApiDesc);
senseApiLibs.push_back(lib);
return *senseApiLibs.back();
lib->setStimBuffApiDesc(libApiDesc);
stimBuffApiLibs.push_back(lib);
return *stimBuffApiLibs.back();
}
std::optional<std::shared_ptr<SenseApiLib>>
SenseApiManager::getSenseApiLib(const std::string& libraryPath)
std::optional<std::shared_ptr<StimBuffApiLib>>
StimBuffApiManager::getStimBuffApiLib(const std::string& libraryPath)
{
auto it = std::find_if(senseApiLibs.begin(), senseApiLibs.end(),
[&libPath = libraryPath](const std::shared_ptr<SenseApiLib>& lib) {
auto it = std::find_if(stimBuffApiLibs.begin(), stimBuffApiLibs.end(),
[&libPath = libraryPath](const std::shared_ptr<StimBuffApiLib>& lib) {
return lib->libraryPath == libPath;
}
);
if (it != senseApiLibs.end()) { return *it; }
if (it != stimBuffApiLibs.end()) { return *it; }
return std::nullopt;
}
std::optional<std::shared_ptr<SenseApiLib>>
SenseApiManager::getSenseApiLibByApiName(const std::string& apiName)
std::optional<std::shared_ptr<StimBuffApiLib>>
StimBuffApiManager::getStimBuffApiLibByApiName(const std::string& apiName)
{
auto it = std::find_if(senseApiLibs.begin(), senseApiLibs.end(),
[&apiName](const std::shared_ptr<SenseApiLib>& lib) {
return lib->senseApiDesc.name == apiName;
auto it = std::find_if(stimBuffApiLibs.begin(), stimBuffApiLibs.end(),
[&apiName](const std::shared_ptr<StimBuffApiLib>& lib) {
return lib->stimBuffApiDesc.name == apiName;
}
);
if (it != senseApiLibs.end()) { return *it; }
if (it != stimBuffApiLibs.end()) { return *it; }
return std::nullopt;
}
void SenseApiManager::unloadSenseApiLib(const std::string& libraryPath)
void StimBuffApiManager::unloadStimBuffApiLib(const std::string& libraryPath)
{
auto it = std::find_if(senseApiLibs.begin(), senseApiLibs.end(),
[&lpath = libraryPath](const std::shared_ptr<SenseApiLib>& lib) {
auto it = std::find_if(stimBuffApiLibs.begin(), stimBuffApiLibs.end(),
[&lpath = libraryPath](const std::shared_ptr<StimBuffApiLib>& lib) {
return lib->libraryPath == lpath;
}
);
if (it != senseApiLibs.end())
if (it != stimBuffApiLibs.end())
{
senseApiLibs.erase(it);
stimBuffApiLibs.erase(it);
return;
}
@@ -202,75 +202,75 @@ void SenseApiManager::unloadSenseApiLib(const std::string& libraryPath)
<< libraryPath << '\n';
}
void SenseApiManager::unloadAllSenseApiLibs(void)
void StimBuffApiManager::unloadAllStimBuffApiLibs(void)
{
senseApiLibs.clear();
stimBuffApiLibs.clear();
}
void SenseApiManager::loadAllSenseApiLibsFromOptions(
void StimBuffApiManager::loadAllStimBuffApiLibsFromOptions(
const std::shared_ptr<ComponentThread>& componentThread
)
{
const auto& options = OptionParser::getOptions();
for (const auto& libPath : options.senseApiLibs) {
loadSenseApiLib(libPath, componentThread);
loadStimBuffApiLib(libPath, componentThread);
}
}
std::string SenseApiManager::stringifyLibs() const
std::string StimBuffApiManager::stringifyLibs() const
{
std::string result;
for (const auto& lib : senseApiLibs) {
for (const auto& lib : stimBuffApiLibs) {
result += lib->stringify() + "\n";
}
return result;
}
void SenseApiManager::initializeSenseApiLib(SenseApiLib& lib)
void StimBuffApiManager::initializeStimBuffApiLib(StimBuffApiLib& lib)
{
/** FIXME:
* When we eventually make this method async, this method should acquire
* the SenseApiManager's main CRUD qutex.
* the StimBuffApiManager's main CRUD qutex.
*/
if (!lib.senseApiDesc.sal_mgmt_libOps.initializeInd)
if (!lib.stimBuffApiDesc.sal_mgmt_libOps.initializeInd)
{
throw std::runtime_error(
std::string(__func__) + ": initializeInd() is NULL for library '"
+ lib.libraryPath + "'");
}
lib.senseApiDesc.sal_mgmt_libOps.initializeInd();
lib.stimBuffApiDesc.sal_mgmt_libOps.initializeInd();
}
void SenseApiManager::finalizeSenseApiLib(SenseApiLib& lib)
void StimBuffApiManager::finalizeStimBuffApiLib(StimBuffApiLib& lib)
{
/** FIXME:
* When we eventually make this method async, this flag should only be set
* after acquiring the SenseApiManager's main CRUD qutex.
* after acquiring the StimBuffApiManager's main CRUD qutex.
*/
lib.isBeingDestroyed.store(true);
if (!lib.senseApiDesc.sal_mgmt_libOps.finalizeInd)
if (!lib.stimBuffApiDesc.sal_mgmt_libOps.finalizeInd)
{
throw std::runtime_error(
std::string(__func__) + ": finalizeInd() is NULL for library '"
+ lib.libraryPath + "'");
}
lib.senseApiDesc.sal_mgmt_libOps.finalizeInd();
lib.stimBuffApiDesc.sal_mgmt_libOps.finalizeInd();
}
void SenseApiManager::initializeAllSenseApiLibs(void)
void StimBuffApiManager::initializeAllStimBuffApiLibs(void)
{
for (auto& lib : senseApiLibs) {
initializeSenseApiLib(*lib);
for (auto& lib : stimBuffApiLibs) {
initializeStimBuffApiLib(*lib);
}
}
void SenseApiManager::finalizeAllSenseApiLibs(void)
void StimBuffApiManager::finalizeAllStimBuffApiLibs(void)
{
for (auto& lib : senseApiLibs) {
finalizeSenseApiLib(*lib);
for (auto& lib : stimBuffApiLibs) {
finalizeStimBuffApiLib(*lib);
}
}
} // namespace sense_api
} // namespace stim_buff
} // namespace smo
@@ -1,14 +1,15 @@
cmake_dependent_option(ENABLE_SENSEAPI_livoxGen1
"Enable Livox Gen1 LiDAR sense API" ON
cmake_dependent_option(ENABLE_STIMBUFFAPI_livoxGen1
"Enable Livox Gen1 LiDAR stim buff API" ON
"ENABLE_LIB_livoxProto1" OFF)
if(ENABLE_SENSEAPI_livoxGen1)
if(ENABLE_STIMBUFFAPI_livoxGen1)
# Set CONFIG variable for config.h
set(CONFIG_STIMBUFFAPI_LIVOXGEN1_ENABLED 1)
add_library(livoxGen1 SHARED
livoxGen1.cpp
)
# Set config define for header generation
add_compile_definitions(CONFIG_SENSEAPI_LIVOXGEN1_ENABLED)
target_include_directories(livoxGen1 PUBLIC
${Boost_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/commonLibs
@@ -16,9 +16,9 @@
namespace smo {
namespace sense_api {
namespace stim_buff {
// Salmanoff hooks, obtained from SMO_GET_SENSE_API_DESC_FN_NAME().
// Salmanoff hooks, obtained from SMO_GET_STIM_BUFF_API_DESC_FN_NAME().
static const SmoCallbacks* smoHooksPtr = nullptr;
static SmoThreadingModelDesc smoThreadingModelDesc;
@@ -157,8 +157,8 @@ extern "C" sal_mlo_finalizeIndFn livoxGen1_finalizeInd;
extern "C" sal_mlo_attachDeviceReqFn livoxGen1_attachDeviceReq;
extern "C" sal_mlo_detachDeviceReqFn livoxGen1_detachDeviceReq;
// Sense API descriptor
static const SenseApiDesc livoxGen1ApiDesc = {
// Stim Buff API descriptor
static const StimBuffApiDesc livoxGen1ApiDesc = {
.name = "livoxGen1",
.exportedQualeIfaceApis = {
{.name = "pcloud"},
@@ -253,7 +253,7 @@ extern "C" int livoxGen1_finalizeInd(void)
extern "C" void livoxGen1_attachDeviceReq(
const std::shared_ptr<smo::device::DeviceAttachmentSpec>& desc,
const std::shared_ptr<smo::ComponentThread>& componentThread,
Callback<smo::sense_api::sal_mlo_attachDeviceReqCbFn> cb
Callback<smo::stim_buff::sal_mlo_attachDeviceReqCbFn> cb
)
{
if (!livoxProto1.livoxProto1_getOrCreateDeviceReq)
@@ -360,7 +360,7 @@ extern "C" void livoxGen1_attachDeviceReq(
extern "C" void livoxGen1_detachDeviceReq(
const std::shared_ptr<smo::device::DeviceAttachmentSpec>& desc,
Callback<smo::sense_api::sal_mlo_detachDeviceReqCbFn> cb
Callback<smo::stim_buff::sal_mlo_detachDeviceReqCbFn> cb
)
{
// Find and remove the device from our collection
@@ -399,12 +399,12 @@ extern "C" void livoxGen1_detachDeviceReq(
}
// Exported function
extern "C" smo::sense_api::SMO_GET_SENSE_API_DESC_FN_TYPEDEF
SMO_GET_SENSE_API_DESC_FN_NAME;
extern "C" smo::stim_buff::SMO_GET_STIM_BUFF_API_DESC_FN_TYPEDEF
SMO_GET_STIM_BUFF_API_DESC_FN_NAME;
const smo::sense_api::SenseApiDesc& SMO_GET_SENSE_API_DESC_FN_NAME(
const smo::sense_api::SmoCallbacks& callbacks,
const smo::sense_api::SmoThreadingModelDesc& threadingModel)
const smo::stim_buff::StimBuffApiDesc& SMO_GET_STIM_BUFF_API_DESC_FN_NAME(
const smo::stim_buff::SmoCallbacks& callbacks,
const smo::stim_buff::SmoThreadingModelDesc& threadingModel)
{
smoHooksPtr = &callbacks;
smoThreadingModelDesc = threadingModel;
@@ -412,5 +412,5 @@ const smo::sense_api::SenseApiDesc& SMO_GET_SENSE_API_DESC_FN_NAME(
return livoxGen1ApiDesc;
}
} // namespace sense_api
} // namespace stim_buff
} // namespace smo
@@ -1,9 +1,12 @@
# XCB/Xorg Window Attaching SenseAPI backend
cmake_dependent_option(ENABLE_SENSEAPI_xcbWindow
"Enable XCB/Xorg Window Attaching SenseAPI backend" ON
# XCB/Xorg Window Attaching StimBuffAPI backend
cmake_dependent_option(ENABLE_STIMBUFFAPI_xcbWindow
"Enable XCB/Xorg Window Attaching StimBuffAPI backend" ON
"ENABLE_LIB_xcbXorg" OFF)
if(ENABLE_SENSEAPI_xcbWindow)
if(ENABLE_STIMBUFFAPI_xcbWindow)
# Set CONFIG variable for config.h
set(CONFIG_STIMBUFFAPI_XCBWINDOW_ENABLED 1)
add_library(xcbWindow SHARED
xcbWindow.cpp
)
@@ -19,9 +22,6 @@ if(ENABLE_SENSEAPI_xcbWindow)
pkg_check_modules(XCB REQUIRED xcb)
target_link_libraries(xcbWindow ${XCB_LIBRARIES})
# Set config define for header generation
add_compile_definitions(CONFIG_SENSEAPI_XCBWINDOW_ENABLED)
# Install rules
install(TARGETS xcbWindow DESTINATION lib)
endif()
@@ -28,9 +28,9 @@ struct XcbXorgDllState
static XcbXorgDllState xcbXorg;
// Salmanoff hooks, obtained from SMO_GET_SENSE_API_DESC_FN_NAME().
static const smo::sense_api::SmoCallbacks* smoHooksPtr = nullptr;
static smo::sense_api::SmoThreadingModelDesc smoThreadingModelDesc;
// Salmanoff hooks, obtained from SMO_GET_STIM_BUFF_API_DESC_FN_NAME().
static const smo::stim_buff::SmoCallbacks* smoHooksPtr = nullptr;
static smo::stim_buff::SmoThreadingModelDesc smoThreadingModelDesc;
// Attached windows.
static std::vector<std::unique_ptr<xcb_window::AttachedWindow>>
@@ -277,7 +277,7 @@ static int xcbWindow_finalizeInd(void)
static void xcbWindow_attachDeviceReq(
const std::shared_ptr<smo::device::DeviceAttachmentSpec>& desc,
const std::shared_ptr<smo::ComponentThread>& componentThread,
smo::Callback<smo::sense_api::sal_mlo_attachDeviceReqCbFn> cb
smo::Callback<smo::stim_buff::sal_mlo_attachDeviceReqCbFn> cb
)
{
// Not used yet, but may be used later.
@@ -302,7 +302,7 @@ static void xcbWindow_attachDeviceReq(
static void xcbWindow_detachDeviceReq(
const std::shared_ptr<smo::device::DeviceAttachmentSpec>& spec,
smo::Callback<smo::sense_api::sal_mlo_detachDeviceReqCbFn> cb
smo::Callback<smo::stim_buff::sal_mlo_detachDeviceReqCbFn> cb
)
{
auto it = std::find_if(g_attachedWindows.begin(), g_attachedWindows.end(),
@@ -328,7 +328,7 @@ static void xcbWindow_detachDeviceReq(
}
// SenseApi descriptor
static smo::sense_api::SenseApiDesc xcbWindowApiDesc = {
static smo::stim_buff::StimBuffApiDesc xcbWindowApiDesc = {
.name = "xcb",
.exportedQualeIfaceApis = { { "visual-qualeiface" } },
.sal_mgmt_libOps = {
@@ -340,12 +340,12 @@ static smo::sense_api::SenseApiDesc xcbWindowApiDesc = {
};
// Exported function
extern "C" smo::sense_api::SMO_GET_SENSE_API_DESC_FN_TYPEDEF
SMO_GET_SENSE_API_DESC_FN_NAME;
extern "C" smo::stim_buff::SMO_GET_STIM_BUFF_API_DESC_FN_TYPEDEF
SMO_GET_STIM_BUFF_API_DESC_FN_NAME;
const smo::sense_api::SenseApiDesc& SMO_GET_SENSE_API_DESC_FN_NAME(
const smo::sense_api::SmoCallbacks& callbacks,
const smo::sense_api::SmoThreadingModelDesc& threadingModel)
const smo::stim_buff::StimBuffApiDesc& SMO_GET_STIM_BUFF_API_DESC_FN_NAME(
const smo::stim_buff::SmoCallbacks& callbacks,
const smo::stim_buff::SmoThreadingModelDesc& threadingModel)
{
smoHooksPtr = &callbacks;
smoThreadingModelDesc = threadingModel;