SenseApiDesc,xcbWindow: port to sscl coro framework

SenseApiDesc's exported API now uses coro pointers instead of
CPS fn pointers.
* Do not build this version of SMO with the Livox drivers enabled,
  because SMO has been changed at the smocore level to use coros
  when calling into stimbuffAPI libs. But the Livox drivers
  haven't yet been ported from CPS to coros.

xcbWindow has been ported to expose coros to SMO in its
senseApiDesc exported iface.
This commit is contained in:
2026-05-25 08:21:46 -04:00
parent b5fa20a2b8
commit 3e19d39853
10 changed files with 173 additions and 280 deletions
+19 -31
View File
@@ -8,7 +8,6 @@
#include <memory>
#include <opts.h>
#include <componentThread.h>
#include <cpsBoundary/stimBuffDeviceAReq.h>
#include <deviceManager/deviceManager.h>
#include <deviceManager/deviceReattacher.h>
#include <stimBuffApis/stimBuffApiManager.h>
@@ -33,11 +32,6 @@ void assertMarionetteThread()
}
}
boost::asio::io_service &marionetteIoService()
{
return mrntt::MrnttThreadTag::io_service();
}
} // namespace
DeviceManager::~DeviceManager()
@@ -55,7 +49,7 @@ const std::string DeviceManager::stringifyDeviceSpecs(void)
return oss.str();
}
mrntt::MrnttViralPostingInvoker<cpsBoundary::StimBuffDeviceOpResult>
mrntt::MrnttViralPostingInvoker<stim_buff::StimBuffDeviceOpResult>
DeviceManager::attachStimBuffDeviceCReq(
const std::shared_ptr<DeviceAttachmentSpec>& spec)
{
@@ -67,7 +61,7 @@ DeviceManager::attachStimBuffDeviceCReq(
{
std::cerr << "attachStimBuffDeviceCReq: No library found for API '"
<< spec->stimBuffApi << "'" << std::endl;
co_return cpsBoundary::StimBuffDeviceOpResult{false, spec};
co_return stim_buff::StimBuffDeviceOpResult{false, spec};
}
auto &lib = *libOpt.value();
@@ -76,15 +70,15 @@ DeviceManager::attachStimBuffDeviceCReq(
{
std::cerr << std::string(__func__) + ": Library is being destroyed"
<< " for API '" << spec->stimBuffApi << "'. Bailing out.\n";
co_return cpsBoundary::StimBuffDeviceOpResult{false, spec};
co_return stim_buff::StimBuffDeviceOpResult{false, spec};
}
if (!lib.stimBuffApiDesc.sal_mgmt_libOps.attachDeviceReq)
if (!lib.stimBuffApiDesc.sal_mgmt_libOps.attachDeviceCReq)
{
std::cerr << std::string(__func__) + ": attachDeviceReq() is NULL "
std::cerr << std::string(__func__) + ": attachDeviceCReq() is NULL "
"for library '" << lib.libraryPath << "'"
<< std::endl;
co_return cpsBoundary::StimBuffDeviceOpResult{false, spec};
co_return stim_buff::StimBuffDeviceOpResult{false, spec};
}
sscl::co::CoQutex::ReleaseHandle sbamGuard =
@@ -114,14 +108,11 @@ DeviceManager::attachStimBuffDeviceCReq(
<< spec->deviceIdentifier << " to body thread" << "\n";
}
cpsBoundary::StimBuffDeviceOpResult result = co_await
cpsBoundary::AttachStimBuffDeviceAReq(
spec, lib, threadForAttachment, marionetteIoService());
co_return result;
co_return co_await lib.stimBuffApiDesc.sal_mgmt_libOps.attachDeviceCReq(
spec, threadForAttachment);
}
mrntt::MrnttViralPostingInvoker<cpsBoundary::StimBuffDeviceOpResult>
mrntt::MrnttViralPostingInvoker<stim_buff::StimBuffDeviceOpResult>
DeviceManager::detachStimBuffDeviceCReq(
const std::shared_ptr<DeviceAttachmentSpec>& spec)
{
@@ -133,7 +124,7 @@ DeviceManager::detachStimBuffDeviceCReq(
{
std::cerr << "detachStimBuffDeviceCReq: No library found for API '"
<< spec->stimBuffApi << "'" << std::endl;
co_return cpsBoundary::StimBuffDeviceOpResult{false, spec};
co_return stim_buff::StimBuffDeviceOpResult{false, spec};
}
auto &lib = *libOpt.value();
@@ -142,15 +133,15 @@ DeviceManager::detachStimBuffDeviceCReq(
{
std::cerr << std::string(__func__) + ": Library is being destroyed"
<< " for API '" << spec->stimBuffApi << "'. Bailing out.\n";
co_return cpsBoundary::StimBuffDeviceOpResult{false, spec};
co_return stim_buff::StimBuffDeviceOpResult{false, spec};
}
if (!lib.stimBuffApiDesc.sal_mgmt_libOps.detachDeviceReq)
if (!lib.stimBuffApiDesc.sal_mgmt_libOps.detachDeviceCReq)
{
std::cerr << std::string(__func__) + ": detachDeviceReq() is NULL "
std::cerr << std::string(__func__) + ": detachDeviceCReq() is NULL "
"for library '" << lib.libraryPath << "'"
<< std::endl;
co_return cpsBoundary::StimBuffDeviceOpResult{false, spec};
co_return stim_buff::StimBuffDeviceOpResult{false, spec};
}
sscl::co::CoQutex::ReleaseHandle sbamGuard =
@@ -159,11 +150,8 @@ DeviceManager::detachStimBuffDeviceCReq(
co_await lib.s.lock.getAcquireInvocationAndSuspensionPolicy();
sbamGuard.release();
cpsBoundary::StimBuffDeviceOpResult result = co_await
cpsBoundary::DetachStimBuffDeviceAReq(
spec, lib, marionetteIoService());
co_return result;
co_return co_await lib.stimBuffApiDesc.sal_mgmt_libOps.detachDeviceCReq(
spec);
}
mrntt::MrnttViralPostingInvoker<DeviceManager::DeviceAttachmentIndResult>
@@ -243,7 +231,7 @@ DeviceManager::newDeviceAttachmentSpecIndCReq(
true, existingDeviceRole, specPtr};
}
cpsBoundary::StimBuffDeviceOpResult attachResult =
stim_buff::StimBuffDeviceOpResult attachResult =
co_await attachStimBuffDeviceCReq(specPtr);
if (!attachResult.success)
@@ -295,7 +283,7 @@ DeviceManager::removeDeviceAttachmentSpecCReq(
}
// Call detachStimBuffDeviceCReq first - only clean up metadata if this succeeds
cpsBoundary::StimBuffDeviceOpResult detachResult =
stim_buff::StimBuffDeviceOpResult detachResult =
co_await detachStimBuffDeviceCReq(specPtr);
if (!detachResult.success)
@@ -473,7 +461,7 @@ DeviceManager::detachAllAttachedDeviceRolesCReq()
sscl::co::Group group;
std::vector<
mrntt::MrnttViralPostingInvoker<cpsBoundary::StimBuffDeviceOpResult>>
mrntt::MrnttViralPostingInvoker<stim_buff::StimBuffDeviceOpResult>>
invokers;
invokers.reserve(specsToDetach.size());