LivoxProto1: port to sscl::co framework

Code now actually looks a lot cleaner, tbh.
This commit is contained in:
2026-05-28 20:13:12 -04:00
parent bbc16dc4c4
commit 25efccf6c5
20 changed files with 1275 additions and 2145 deletions
+6 -11
View File
@@ -11,7 +11,7 @@
#include "broadcastListener.h"
#include "udpCommandDemuxer.h"
#include "livoxProto1.h"
#include <spinscale/cps/callback.h>
#include <spinscale/co/invokers.h>
namespace livoxProto1 {
@@ -23,17 +23,16 @@ public:
static void deviceGoneAwayInd(const comms::DiscoveredDevice &device);
void getOrCreateDeviceReq(
sscl::co::ViralNonPostingInvoker<LivoxProto1GetOrCreateDeviceResult>
getOrCreateDeviceCReq(
const std::string &deviceIdentifier,
const std::shared_ptr<sscl::ComponentThread>& componentThread,
int commandTimeoutMs, int retryDelayMs,
const std::string& smoIp, uint8_t smoSubnetNbits,
uint16_t dataPort, uint16_t cmdPort, uint16_t imuPort,
sscl::cps::Callback<livoxProto1_getOrCreateDeviceReqCbFn> callback);
uint16_t dataPort, uint16_t cmdPort, uint16_t imuPort);
void destroyDeviceReq(
std::shared_ptr<Device> device,
sscl::cps::Callback<livoxProto1_destroyDeviceReqCbFn> callback);
sscl::co::ViralNonPostingInvoker<bool> destroyDeviceCReq(
std::shared_ptr<Device> device);
std::optional<std::shared_ptr<Device>> getDevice(
const std::string &deviceIdentifier);
@@ -52,10 +51,6 @@ public:
std::vector<std::shared_ptr<Device>> devices;
comms::BroadcastListener broadcastListener;
comms::UdpCommandDemuxer udpCommandDemuxer;
// Nested continuation class for async device creation
class GetOrCreateDeviceReq;
class DestroyDeviceReq;
};
void main(