SenseApis: Add threading model info to initialization info

We provide access to a thread whose event queue the sense API
libs can use for device-independent event management.
This commit is contained in:
2025-09-04 17:35:49 -04:00
parent 1d9b8a2cf6
commit e5a3c41c20
7 changed files with 68 additions and 13 deletions
+27 -1
View File
@@ -6,11 +6,34 @@
#include <string>
#include <memory>
#include <preprocessor.h>
#include <componentThread.h>
#include <user/deviceAttachmentSpec.h>
namespace smo {
namespace sense_api {
/**
* @brief Threading model descriptor for senseApi libraries.
*
* This structure provides senseApi libraries with access to the information and
* resources they need to operate with SMO's threading model.
*/
struct SmoThreadingModelDesc
{
/**
* @brief Shared pointer to ComponentThread for device-independent state management.
*
* This ComponentThread should be used by senseApis for state management
* that's independent of any particular device or attachment spec.
* SMO will usually pass in the Marionette thread here.
*
* State management that's tied to a particular attachment spec should be
* done on the ComponentThread for the thread that SMO provided in the
* attachDeviceReq call.
*/
std::shared_ptr<ComponentThread> componentThread;
};
typedef int (sal_mlo_initializeIndFn)(void);
typedef int (sal_mlo_finalizeIndFn)(void);
typedef int (sal_mlo_attachDeviceReqFn)(
@@ -134,9 +157,12 @@ public:
*
* The SalmanoffCallbacks parameter provides the library with access to
* Salmanoff's hooks.
* 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)(
const SalmanoffCallbacks& callbacks);
const SalmanoffCallbacks& callbacks,
const SmoThreadingModelDesc& threadingModel);
} // namespace sense_api
} // namespace smo