Libspinscale: Initial top-level SMO port to coroutine framework

We haven't ported everything. Just the top-level methods. We'll
dig in to the leaf stuff later. Surprisingly, this all went without
any real difficulties.

Runs like a charm on first try.
This commit is contained in:
2026-05-24 16:12:29 -04:00
parent c539e6e924
commit cde2737876
44 changed files with 1296 additions and 1530 deletions
+10 -10
View File
@@ -11,11 +11,11 @@
#include <user/senseApiDesc.h>
#include <user/deviceAttachmentSpec.h>
#include <user/intrinThresholdParams.h>
#include <spinscale/callback.h>
#include <spinscale/cps/callback.h>
#include <livoxProto1/livoxProto1.h>
#include <livoxProto1/device.h>
#include <livoxProto1/protocol.h>
#include <spinscale/asynchronousContinuation.h>
#include <spinscale/cps/asynchronousContinuation.h>
#include <boost/asio/deadline_timer.hpp>
#include "pcloudStimulusProducer.h"
#include "livoxGen1.h"
@@ -91,13 +91,13 @@ LivoxProto1DllState livoxProto1;
// Continuation classes for async operations
class AttachDeviceReq
: public sscl::NonPostedAsynchronousContinuation<sal_mlo_attachDeviceReqCbFn>
: public sscl::cps::NonPostedAsynchronousContinuation<sal_mlo_attachDeviceReqCbFn>
{
public:
AttachDeviceReq(
const std::shared_ptr<smo::device::DeviceAttachmentSpec>& spec,
sscl::Callback<sal_mlo_attachDeviceReqCbFn> cb)
: sscl::NonPostedAsynchronousContinuation<sal_mlo_attachDeviceReqCbFn>(
sscl::cps::Callback<sal_mlo_attachDeviceReqCbFn> cb)
: sscl::cps::NonPostedAsynchronousContinuation<sal_mlo_attachDeviceReqCbFn>(
std::move(cb)),
spec(spec)
{}
@@ -360,14 +360,14 @@ public:
};
class DetachDeviceReq
: public sscl::NonPostedAsynchronousContinuation<sal_mlo_detachDeviceReqCbFn>
: public sscl::cps::NonPostedAsynchronousContinuation<sal_mlo_detachDeviceReqCbFn>
{
public:
DetachDeviceReq(
const std::shared_ptr<smo::device::DeviceAttachmentSpec>& spec,
const std::shared_ptr<StimulusBuffer>& stimBuffer,
sscl::Callback<sal_mlo_detachDeviceReqCbFn> cb)
: sscl::NonPostedAsynchronousContinuation<sal_mlo_detachDeviceReqCbFn>(
sscl::cps::Callback<sal_mlo_detachDeviceReqCbFn> cb)
: sscl::cps::NonPostedAsynchronousContinuation<sal_mlo_detachDeviceReqCbFn>(
std::move(cb)),
spec(spec), stimBuffer(stimBuffer)
{}
@@ -625,7 +625,7 @@ extern "C" int livoxGen1_finalizeInd(void)
extern "C" void livoxGen1_attachDeviceReq(
const std::shared_ptr<smo::device::DeviceAttachmentSpec>& desc,
const std::shared_ptr<sscl::ComponentThread>& componentThread,
sscl::Callback<smo::stim_buff::sal_mlo_attachDeviceReqCbFn> cb
sscl::cps::Callback<smo::stim_buff::sal_mlo_attachDeviceReqCbFn> cb
)
{
if (!livoxProto1.livoxProto1_getOrCreateDeviceReq)
@@ -825,7 +825,7 @@ extern "C" void livoxGen1_attachDeviceReq(
extern "C" void livoxGen1_detachDeviceReq(
const std::shared_ptr<smo::device::DeviceAttachmentSpec>& desc,
sscl::Callback<smo::stim_buff::sal_mlo_detachDeviceReqCbFn> cb
sscl::cps::Callback<smo::stim_buff::sal_mlo_detachDeviceReqCbFn> cb
)
{
// Case 1: Check if StimBuffer doesn't exist (early return)