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
@@ -3,8 +3,8 @@
#include <functional>
#include <optional>
#include <opts.h>
#include <spinscale/asynchronousContinuation.h>
#include <spinscale/callback.h>
#include <spinscale/cps/asynchronousContinuation.h>
#include <spinscale/cps/callback.h>
#include <user/senseApiDesc.h>
#include "protocol.h"
#include "core.h"
@@ -74,7 +74,7 @@ std::optional<std::shared_ptr<Device>> DeviceManager::getDevice(
// GetOrCreateDeviceReq nested class implementation
class DeviceManager::GetOrCreateDeviceReq
: public sscl::NonPostedAsynchronousContinuation<
: public sscl::cps::NonPostedAsynchronousContinuation<
livoxProto1_getOrCreateDeviceReqCbFn>
{
public:
@@ -86,8 +86,8 @@ public:
GetOrCreateDeviceReq(
DeviceManager& mgr,
std::shared_ptr<Device> device,
sscl::Callback<livoxProto1_getOrCreateDeviceReqCbFn> cb)
: sscl::NonPostedAsynchronousContinuation<
sscl::cps::Callback<livoxProto1_getOrCreateDeviceReqCbFn> cb)
: sscl::cps::NonPostedAsynchronousContinuation<
livoxProto1_getOrCreateDeviceReqCbFn>(std::move(cb)),
deviceManager(mgr), pendingDevice(device)
{}
@@ -132,7 +132,7 @@ void DeviceManager::getOrCreateDeviceReq(
int commandTimeoutMs, int retryDelayMs,
const std::string& smoIp, uint8_t smoSubnetNbits,
uint16_t dataPort, uint16_t cmdPort, uint16_t imuPort,
sscl::Callback<livoxProto1_getOrCreateDeviceReqCbFn> callback)
sscl::cps::Callback<livoxProto1_getOrCreateDeviceReqCbFn> callback)
{
// Validate smoIp format using Boost.Asio IPv4 validation
if (!smoIp.empty() && !comms::isValidIPv4(smoIp))
@@ -179,7 +179,7 @@ void DeviceManager::getOrCreateDeviceReq(
}
class DeviceManager::DestroyDeviceReq
: public sscl::NonPostedAsynchronousContinuation<
: public sscl::cps::NonPostedAsynchronousContinuation<
livoxProto1_destroyDeviceReqCbFn>
{
public:
@@ -190,8 +190,8 @@ public:
DestroyDeviceReq(
DeviceManager& mgr,
std::shared_ptr<Device> device,
sscl::Callback<livoxProto1_destroyDeviceReqCbFn> cb)
: sscl::NonPostedAsynchronousContinuation<
sscl::cps::Callback<livoxProto1_destroyDeviceReqCbFn> cb)
: sscl::cps::NonPostedAsynchronousContinuation<
livoxProto1_destroyDeviceReqCbFn>(std::move(cb)),
deviceManager(mgr), pendingDevice(device)
{}
@@ -220,7 +220,7 @@ public:
void DeviceManager::destroyDeviceReq(
std::shared_ptr<Device> dev,
sscl::Callback<livoxProto1_destroyDeviceReqCbFn> callback
sscl::cps::Callback<livoxProto1_destroyDeviceReqCbFn> callback
)
{
/** EXPLANATION: