diff --git a/CMakeLists.txt b/CMakeLists.txt index 9bb1882..02d06b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/commonLibs/livoxProto1/core.cpp b/commonLibs/livoxProto1/core.cpp index 6fb0539..65bb0dc 100644 --- a/commonLibs/livoxProto1/core.cpp +++ b/commonLibs/livoxProto1/core.cpp @@ -245,7 +245,7 @@ void DeviceManager::destroyDeviceReq( } void main(const std::shared_ptr &componentThread, - const smo::sense_api::SmoCallbacks& smoCallbacks) + const smo::stim_buff::SmoCallbacks& smoCallbacks) { if (protoState.isInitialized) { return; diff --git a/commonLibs/livoxProto1/core.h b/commonLibs/livoxProto1/core.h index 5ac0677..1f8e207 100644 --- a/commonLibs/livoxProto1/core.h +++ b/commonLibs/livoxProto1/core.h @@ -58,7 +58,7 @@ public: void main( const std::shared_ptr &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 componentThread; std::unique_ptr deviceManager; - smo::sense_api::SmoCallbacks smoCallbacks; + smo::stim_buff::SmoCallbacks smoCallbacks; }; // Access to global state for extern "C" functions diff --git a/commonLibs/livoxProto1/livoxProto1.cpp b/commonLibs/livoxProto1/livoxProto1.cpp index 553f104..fd785c7 100644 --- a/commonLibs/livoxProto1/livoxProto1.cpp +++ b/commonLibs/livoxProto1/livoxProto1.cpp @@ -52,7 +52,7 @@ void livoxProto1_destroyDeviceReq( void livoxProto1_main( const std::shared_ptr& componentThread, - const smo::sense_api::SmoCallbacks& smoCallbacks) + const smo::stim_buff::SmoCallbacks& smoCallbacks) { livoxProto1::main(componentThread, smoCallbacks); } diff --git a/commonLibs/livoxProto1/livoxProto1.h b/commonLibs/livoxProto1/livoxProto1.h index 53015a7..25553c5 100644 --- a/commonLibs/livoxProto1/livoxProto1.h +++ b/commonLibs/livoxProto1/livoxProto1.h @@ -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& componentThread, - const smo::sense_api::SmoCallbacks& smoCallbacks); + const smo::stim_buff::SmoCallbacks& smoCallbacks); /** * Cleanup the Livox protocol library diff --git a/devices/avia0.dapss b/devices/avia0.dapss index 042df83..42cf8d0 100644 --- a/devices/avia0.dapss +++ b/devices/avia0.dapss @@ -1,3 +1 @@ -+edev|avia0| - structural-implexor|livoxGen1()|livoxProto1() - |3JEDK380010Z39 ++edev|avia0|structural-qualeiface|livoxGen1()|livoxProto1()|3JEDK380010Z39 diff --git a/devices/win0.dapss b/devices/win0.dapss index 04c8bc5..8f96f1f 100644 --- a/devices/win0.dapss +++ b/devices/win0.dapss @@ -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 diff --git a/include/config.h.in b/include/config.h.in index f1c5891..6b7e6fb 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -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 diff --git a/include/user/senseApiDesc.h b/include/user/senseApiDesc.h index 4b99806..6704077 100644 --- a/include/user/senseApiDesc.h +++ b/include/user/senseApiDesc.h @@ -11,7 +11,7 @@ #include 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__ diff --git a/smocore/CMakeLists.txt b/smocore/CMakeLists.txt index 5d395dc..289aeca 100644 --- a/smocore/CMakeLists.txt +++ b/smocore/CMakeLists.txt @@ -29,7 +29,7 @@ add_library(smocore STATIC ${YACC_OUTPUT} # SenseApis - senseApis/senseApiManager.cpp + stimBuffApis/stimBuffApiManager.cpp # MindManager mindManager/mindManager.cpp diff --git a/smocore/body/body.cpp b/smocore/body/body.cpp index 85f59a5..b0a177b 100644 --- a/smocore/body/body.cpp +++ b/smocore/body/body.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include 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); } }; diff --git a/smocore/deviceManager/deviceManager.cpp b/smocore/deviceManager/deviceManager.cpp index d6c5f52..a460309 100644 --- a/smocore/deviceManager/deviceManager.cpp +++ b/smocore/deviceManager/deviceManager.cpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include @@ -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 +class DeviceManager::AttachStimBuffDeviceReq +: public SerializedAsynchronousContinuation< + DeviceManager::attachStimBuffDeviceReqCbFn> { public: - AttachSenseDeviceReq( + AttachStimBuffDeviceReq( const std::shared_ptr& spec, const std::shared_ptr &caller, - Callback cb, - std::shared_ptr &senseApiLib, + Callback cb, + std::shared_ptr &stimBuffApiLib, std::vector> requiredLocks) - : SerializedAsynchronousContinuation( + : SerializedAsynchronousContinuation( caller, cb, requiredLocks), - spec(spec), senseApiLib(senseApiLib) + spec(spec), stimBuffApiLib(stimBuffApiLib) {} public: - void attachSenseDeviceReq1_posted( - [[maybe_unused]] std::shared_ptr context + void attachStimBuffDeviceReq1_posted( + [[maybe_unused]] std::shared_ptr 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 context, + void attachStimBuffDeviceReq2( + [[maybe_unused]] std::shared_ptr context, bool success, std::shared_ptr deviceSpec ) @@ -414,8 +416,8 @@ public: callOriginalCb(success, deviceSpec); } - void detachSenseDeviceReq1_posted( - [[maybe_unused]] std::shared_ptr context + void detachStimBuffDeviceReq1_posted( + [[maybe_unused]] std::shared_ptr 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 context, + void detachStimBuffDeviceReq2( + [[maybe_unused]] std::shared_ptr context, bool success, std::shared_ptr deviceSpec ) @@ -464,23 +467,23 @@ public: public: std::shared_ptr spec; - std::shared_ptr senseApiLib; + std::shared_ptr stimBuffApiLib; }; -void DeviceManager::attachSenseDeviceReq( +void DeviceManager::attachStimBuffDeviceReq( const std::shared_ptr& spec, - Callback cb + Callback 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( + auto request = std::make_shared( spec, caller, cb, libOpt.value(), - LockSet::Set{ - std::ref(sense_api::SenseApiManager::getInstance().qutex), + LockSet::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& spec, - Callback cb + Callback 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( + auto request = std::make_shared( spec, caller, cb, libOpt.value(), - LockSet::Set{ - std::ref(sense_api::SenseApiManager::getInstance().qutex), + LockSet::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, diff --git a/smocore/include/deviceManager/deviceManager.h b/smocore/include/deviceManager/deviceManager.h index e2490e4..ada17eb 100644 --- a/smocore/include/deviceManager/deviceManager.h +++ b/smocore/include/deviceManager/deviceManager.h @@ -61,15 +61,15 @@ public: Callback 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& spec, - Callback cb); - void detachSenseDeviceReq( + Callback cb); + void detachStimBuffDeviceReq( const std::shared_ptr& spec, - Callback cb); + Callback cb); typedef std::function 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; diff --git a/smocore/include/senseApis/senseApiManager.h b/smocore/include/senseApis/senseApiManager.h deleted file mode 100644 index 33ec8bb..0000000 --- a/smocore/include/senseApis/senseApiManager.h +++ /dev/null @@ -1,78 +0,0 @@ -#ifndef SENSE_API_MANAGER_H -#define SENSE_API_MANAGER_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -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); - - std::optional> getSenseApiLib( - const std::string& libraryPath); - std::optional> 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); - - 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> senseApiLibs; - -public: - Qutex qutex; - -public: - static std::optional searchForLibInSmoSearchPaths( - const std::string& libraryPath); -}; - -} // namespace sense_api -} // namespace smo - -#endif // SENSE_API_MANAGER_H diff --git a/smocore/include/senseApis/senseApiLib.h b/smocore/include/stimBuffApis/stimBuffApiLib.h similarity index 54% rename from smocore/include/senseApis/senseApiLib.h rename to smocore/include/stimBuffApis/stimBuffApiLib.h index f59831b..eb1f784 100644 --- a/smocore/include/senseApis/senseApiLib.h +++ b/smocore/include/stimBuffApis/stimBuffApiLib.h @@ -11,12 +11,12 @@ #include 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 isBeingDestroyed; std::unique_ptr 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 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_NAME; + std::function + 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 diff --git a/smocore/include/stimBuffApis/stimBuffApiManager.h b/smocore/include/stimBuffApis/stimBuffApiManager.h new file mode 100644 index 0000000..0047738 --- /dev/null +++ b/smocore/include/stimBuffApis/stimBuffApiManager.h @@ -0,0 +1,78 @@ +#ifndef SENSE_API_MANAGER_H +#define SENSE_API_MANAGER_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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); + + std::optional> getStimBuffApiLib( + const std::string& libraryPath); + std::optional> 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); + + 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> stimBuffApiLibs; + +public: + Qutex qutex; + +public: + static std::optional searchForLibInSmoSearchPaths( + const std::string& libraryPath); +}; + +} // namespace stim_buff +} // namespace smo + +#endif // SENSE_API_MANAGER_H diff --git a/smocore/marionette/salmanoff.cpp b/smocore/marionette/salmanoff.cpp index b66c396..47e2964 100644 --- a/smocore/marionette/salmanoff.cpp +++ b/smocore/marionette/salmanoff.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include @@ -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(); } diff --git a/smocore/mind.cpp b/smocore/mind.cpp index e993934..497bc63 100644 --- a/smocore/mind.cpp +++ b/smocore/mind.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include namespace smo { diff --git a/smocore/opts.cpp b/smocore/opts.cpp index 6997cac..f9f3969 100644 --- a/smocore/opts.cpp +++ b/smocore/opts.cpp @@ -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 << " "; } diff --git a/smocore/senseApis/senseApiManager.cpp b/smocore/stimBuffApis/stimBuffApiManager.cpp similarity index 63% rename from smocore/senseApis/senseApiManager.cpp rename to smocore/stimBuffApis/stimBuffApiManager.cpp index 2b0adf2..81fc374 100644 --- a/smocore/senseApis/senseApiManager.cpp +++ b/smocore/stimBuffApis/stimBuffApiManager.cpp @@ -2,8 +2,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include @@ -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 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_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 SenseApiManager::searchForLibInSmoSearchPaths( +std::optional 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 ) @@ -110,7 +110,7 @@ SenseApiLib& SenseApiManager::loadSenseApiLib( // Clear any existing error dlerror(); - auto dlopen_handle = std::unique_ptr( + auto dlopen_handle = std::unique_ptr( 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( - dlsym(dlopen_handle.get(), SMO_GET_SENSE_API_DESC_FN_NAME_STR)); + auto func = reinterpret_cast( + 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( + auto lib = std::make_shared( 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> -SenseApiManager::getSenseApiLib(const std::string& libraryPath) +std::optional> +StimBuffApiManager::getStimBuffApiLib(const std::string& libraryPath) { - auto it = std::find_if(senseApiLibs.begin(), senseApiLibs.end(), - [&libPath = libraryPath](const std::shared_ptr& lib) { + auto it = std::find_if(stimBuffApiLibs.begin(), stimBuffApiLibs.end(), + [&libPath = libraryPath](const std::shared_ptr& lib) { return lib->libraryPath == libPath; } ); - if (it != senseApiLibs.end()) { return *it; } + if (it != stimBuffApiLibs.end()) { return *it; } return std::nullopt; } -std::optional> -SenseApiManager::getSenseApiLibByApiName(const std::string& apiName) +std::optional> +StimBuffApiManager::getStimBuffApiLibByApiName(const std::string& apiName) { - auto it = std::find_if(senseApiLibs.begin(), senseApiLibs.end(), - [&apiName](const std::shared_ptr& lib) { - return lib->senseApiDesc.name == apiName; + auto it = std::find_if(stimBuffApiLibs.begin(), stimBuffApiLibs.end(), + [&apiName](const std::shared_ptr& 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& lib) { + auto it = std::find_if(stimBuffApiLibs.begin(), stimBuffApiLibs.end(), + [&lpath = libraryPath](const std::shared_ptr& 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 ) { 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 diff --git a/senseApis/CMakeLists.txt b/stimBuffApis/CMakeLists.txt similarity index 100% rename from senseApis/CMakeLists.txt rename to stimBuffApis/CMakeLists.txt diff --git a/senseApis/livoxGen1/CMakeLists.txt b/stimBuffApis/livoxGen1/CMakeLists.txt similarity index 58% rename from senseApis/livoxGen1/CMakeLists.txt rename to stimBuffApis/livoxGen1/CMakeLists.txt index 7d61fc5..ba4b8ad 100644 --- a/senseApis/livoxGen1/CMakeLists.txt +++ b/stimBuffApis/livoxGen1/CMakeLists.txt @@ -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 diff --git a/senseApis/livoxGen1/livoxGen1.cpp b/stimBuffApis/livoxGen1/livoxGen1.cpp similarity index 95% rename from senseApis/livoxGen1/livoxGen1.cpp rename to stimBuffApis/livoxGen1/livoxGen1.cpp index c4aa30c..481c778 100644 --- a/senseApis/livoxGen1/livoxGen1.cpp +++ b/stimBuffApis/livoxGen1/livoxGen1.cpp @@ -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& desc, const std::shared_ptr& componentThread, - Callback cb + Callback cb ) { if (!livoxProto1.livoxProto1_getOrCreateDeviceReq) @@ -360,7 +360,7 @@ extern "C" void livoxGen1_attachDeviceReq( extern "C" void livoxGen1_detachDeviceReq( const std::shared_ptr& desc, - Callback cb + Callback 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 diff --git a/senseApis/xcbWindow/CMakeLists.txt b/stimBuffApis/xcbWindow/CMakeLists.txt similarity index 67% rename from senseApis/xcbWindow/CMakeLists.txt rename to stimBuffApis/xcbWindow/CMakeLists.txt index d58b0ae..3b27425 100644 --- a/senseApis/xcbWindow/CMakeLists.txt +++ b/stimBuffApis/xcbWindow/CMakeLists.txt @@ -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() diff --git a/senseApis/xcbWindow/xcbWindow.cpp b/stimBuffApis/xcbWindow/xcbWindow.cpp similarity index 94% rename from senseApis/xcbWindow/xcbWindow.cpp rename to stimBuffApis/xcbWindow/xcbWindow.cpp index 3e97120..9aa84a6 100644 --- a/senseApis/xcbWindow/xcbWindow.cpp +++ b/stimBuffApis/xcbWindow/xcbWindow.cpp @@ -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> @@ -277,7 +277,7 @@ static int xcbWindow_finalizeInd(void) static void xcbWindow_attachDeviceReq( const std::shared_ptr& desc, const std::shared_ptr& componentThread, - smo::Callback cb + smo::Callback 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& spec, - smo::Callback cb + smo::Callback 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; diff --git a/senseApis/xcbWindow/xcbWindow.h b/stimBuffApis/xcbWindow/xcbWindow.h similarity index 100% rename from senseApis/xcbWindow/xcbWindow.h rename to stimBuffApis/xcbWindow/xcbWindow.h