Rename PcloudStimulusBuffer=>PcloudDataProducer
This prepares us for the split up of classes. We're going to split StimulusBuffer into two base classes: StimulusBuffer and StimulusProducer.
This commit is contained in:
@@ -59,7 +59,7 @@ if(ENABLE_STIMBUFFAPI_livoxGen1)
|
|||||||
add_library(livoxGen1 SHARED
|
add_library(livoxGen1 SHARED
|
||||||
livoxGen1.cpp
|
livoxGen1.cpp
|
||||||
stagingBuffer.cpp
|
stagingBuffer.cpp
|
||||||
pcloudStimulusBuffer.cpp
|
pcloudDataProducer.cpp
|
||||||
ioUringAssemblyEngine.cpp
|
ioUringAssemblyEngine.cpp
|
||||||
openClCollatingAndMeshingEngine.cpp
|
openClCollatingAndMeshingEngine.cpp
|
||||||
openClKernels.cl.S
|
openClKernels.cl.S
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#include <callableTracer.h>
|
#include <callableTracer.h>
|
||||||
#include <spinLock.h>
|
#include <spinLock.h>
|
||||||
#include "ioUringAssemblyEngine.h"
|
#include "ioUringAssemblyEngine.h"
|
||||||
#include "pcloudStimulusBuffer.h"
|
#include "pcloudDataProducer.h"
|
||||||
#include "livoxGen1.h"
|
#include "livoxGen1.h"
|
||||||
|
|
||||||
// #define REGISTER_IOURING_BUFFERS
|
// #define REGISTER_IOURING_BUFFERS
|
||||||
@@ -56,7 +56,7 @@ struct DummyLivoxEthHeader
|
|||||||
};
|
};
|
||||||
|
|
||||||
IoUringAssemblyEngine::IoUringAssemblyEngine(
|
IoUringAssemblyEngine::IoUringAssemblyEngine(
|
||||||
PcloudStimulusBuffer& parent_, size_t nDgramsPerStagingBufferFrame_)
|
PcloudDataProducer& parent_, size_t nDgramsPerStagingBufferFrame_)
|
||||||
: parent(parent_),
|
: parent(parent_),
|
||||||
frameAssemblyDesc(nullptr), ring{},
|
frameAssemblyDesc(nullptr), ring{},
|
||||||
eventfdFd(-1), eventfdDesc(nullptr), eventfd_value(0),
|
eventfdFd(-1), eventfdDesc(nullptr), eventfd_value(0),
|
||||||
|
|||||||
@@ -24,13 +24,13 @@
|
|||||||
namespace smo {
|
namespace smo {
|
||||||
namespace stim_buff {
|
namespace stim_buff {
|
||||||
|
|
||||||
class PcloudStimulusBuffer;
|
class PcloudDataProducer;
|
||||||
|
|
||||||
class IoUringAssemblyEngine
|
class IoUringAssemblyEngine
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit IoUringAssemblyEngine(
|
explicit IoUringAssemblyEngine(
|
||||||
PcloudStimulusBuffer& parent, size_t nDgramsPerStagingBufferFrame);
|
PcloudDataProducer& parent, size_t nDgramsPerStagingBufferFrame);
|
||||||
~IoUringAssemblyEngine() = default;
|
~IoUringAssemblyEngine() = default;
|
||||||
|
|
||||||
bool setup();
|
bool setup();
|
||||||
@@ -53,7 +53,7 @@ private:
|
|||||||
bool stop();
|
bool stop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PcloudStimulusBuffer& parent;
|
PcloudDataProducer& parent;
|
||||||
|
|
||||||
// Cached descriptor for reuse across iterations
|
// Cached descriptor for reuse across iterations
|
||||||
std::shared_ptr<FrameAssemblyDesc> frameAssemblyDesc;
|
std::shared_ptr<FrameAssemblyDesc> frameAssemblyDesc;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
#include <livoxProto1/protocol.h>
|
#include <livoxProto1/protocol.h>
|
||||||
#include <asynchronousContinuation.h>
|
#include <asynchronousContinuation.h>
|
||||||
#include <boost/asio/deadline_timer.hpp>
|
#include <boost/asio/deadline_timer.hpp>
|
||||||
#include "pcloudStimulusBuffer.h"
|
#include "pcloudDataProducer.h"
|
||||||
#include "livoxGen1.h"
|
#include "livoxGen1.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -27,20 +27,20 @@ namespace stim_buff {
|
|||||||
const SmoCallbacks* smoHooksPtr = nullptr;
|
const SmoCallbacks* smoHooksPtr = nullptr;
|
||||||
static SmoThreadingModelDesc smoThreadingModelDesc;
|
static SmoThreadingModelDesc smoThreadingModelDesc;
|
||||||
|
|
||||||
// Local collection of stimulus buffers
|
// Local collection of stimulus producers
|
||||||
static std::vector<std::shared_ptr<StimulusBuffer>> attachedStimBuffs;
|
static std::vector<std::shared_ptr<StimulusBuffer>> attachedDataProducers;
|
||||||
|
|
||||||
// Get stimulus buffer by device attachment spec
|
// Get stimulus producer by device attachment spec
|
||||||
static std::shared_ptr<StimulusBuffer>
|
static std::shared_ptr<StimulusBuffer>
|
||||||
getStimBuff(const std::shared_ptr<smo::device::DeviceAttachmentSpec>& spec)
|
getDataProducer(const std::shared_ptr<smo::device::DeviceAttachmentSpec>& spec)
|
||||||
{
|
{
|
||||||
for (const auto& stimBuff : attachedStimBuffs)
|
for (const auto& dataProducer : attachedDataProducers)
|
||||||
{
|
{
|
||||||
// Compare device selectors to find matching buffer
|
// Compare device selectors to find matching buffer
|
||||||
if (stimBuff->deviceAttachmentSpec->deviceSelector
|
if (dataProducer->deviceAttachmentSpec->deviceSelector
|
||||||
== spec->deviceSelector)
|
== spec->deviceSelector)
|
||||||
{
|
{
|
||||||
return stimBuff;
|
return dataProducer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
const std::shared_ptr<smo::device::DeviceAttachmentSpec> spec;
|
const std::shared_ptr<smo::device::DeviceAttachmentSpec> spec;
|
||||||
std::shared_ptr<PcloudStimulusBuffer> stimBuff;
|
std::shared_ptr<PcloudDataProducer> stimProducer;
|
||||||
std::shared_ptr<livoxProto1::Device> deviceTmp;
|
std::shared_ptr<livoxProto1::Device> deviceTmp;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -193,17 +193,17 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create and add PcloudStimulusBuffer to collection now that device is ready
|
// Create and add PcloudDataProducer to collection now that device is ready
|
||||||
StimulusBuffer::PcloudFormatDesc formatDesc;
|
StimulusBuffer::PcloudFormatDesc formatDesc;
|
||||||
formatDesc.format = StimulusBuffer::PcloudFormatDesc::Format::XYZI;
|
formatDesc.format = StimulusBuffer::PcloudFormatDesc::Format::XYZI;
|
||||||
auto pcloudStimBuff = std::make_shared<PcloudStimulusBuffer>(
|
auto pcloudDataProducer = std::make_shared<PcloudDataProducer>(
|
||||||
context->spec, context->deviceTmp, formatDesc, histbuffMs, 30);
|
context->spec, context->deviceTmp, formatDesc, histbuffMs, 30);
|
||||||
|
|
||||||
context->stimBuff = pcloudStimBuff;
|
context->stimProducer = pcloudDataProducer;
|
||||||
context->deviceTmp->nAttachedStimBuffs++;
|
context->deviceTmp->nAttachedStimBuffs++;
|
||||||
attachedStimBuffs.push_back(pcloudStimBuff);
|
attachedDataProducers.push_back(pcloudDataProducer);
|
||||||
|
|
||||||
pcloudStimBuff->start();
|
pcloudDataProducer->start();
|
||||||
|
|
||||||
if (1 || smoHooksPtr->OptionParser_getOptions().verbose)
|
if (1 || smoHooksPtr->OptionParser_getOptions().verbose)
|
||||||
{
|
{
|
||||||
@@ -221,7 +221,7 @@ public:
|
|||||||
{
|
{
|
||||||
// Initialize timer with device's component thread
|
// Initialize timer with device's component thread
|
||||||
delayTimer = std::make_unique<boost::asio::deadline_timer>(
|
delayTimer = std::make_unique<boost::asio::deadline_timer>(
|
||||||
context->stimBuff->device->componentThread->getIoService());
|
context->stimProducer->device->componentThread->getIoService());
|
||||||
|
|
||||||
delayTimer->expires_from_now(boost::posix_time::milliseconds(5));
|
delayTimer->expires_from_now(boost::posix_time::milliseconds(5));
|
||||||
delayTimer->async_wait(
|
delayTimer->async_wait(
|
||||||
@@ -244,7 +244,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
(*livoxProto1.livoxProto1_device_enablePcloudDataReq)(
|
(*livoxProto1.livoxProto1_device_enablePcloudDataReq)(
|
||||||
context->stimBuff->device,
|
context->stimProducer->device,
|
||||||
{context, std::bind(
|
{context, std::bind(
|
||||||
&AttachDeviceReq::attachDeviceReq5,
|
&AttachDeviceReq::attachDeviceReq5,
|
||||||
context.get(), context,
|
context.get(), context,
|
||||||
@@ -280,16 +280,16 @@ class DetachDeviceReq
|
|||||||
public:
|
public:
|
||||||
DetachDeviceReq(
|
DetachDeviceReq(
|
||||||
const std::shared_ptr<smo::device::DeviceAttachmentSpec>& spec,
|
const std::shared_ptr<smo::device::DeviceAttachmentSpec>& spec,
|
||||||
const std::shared_ptr<PcloudStimulusBuffer>& stimBuff,
|
const std::shared_ptr<PcloudDataProducer>& stimProducer,
|
||||||
smo::Callback<sal_mlo_detachDeviceReqCbFn> cb)
|
smo::Callback<sal_mlo_detachDeviceReqCbFn> cb)
|
||||||
: smo::NonPostedAsynchronousContinuation<sal_mlo_detachDeviceReqCbFn>(
|
: smo::NonPostedAsynchronousContinuation<sal_mlo_detachDeviceReqCbFn>(
|
||||||
std::move(cb)),
|
std::move(cb)),
|
||||||
spec(spec), stimBuff(stimBuff)
|
spec(spec), stimProducer(stimProducer)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const std::shared_ptr<smo::device::DeviceAttachmentSpec> spec;
|
const std::shared_ptr<smo::device::DeviceAttachmentSpec> spec;
|
||||||
std::shared_ptr<PcloudStimulusBuffer> stimBuff;
|
std::shared_ptr<PcloudDataProducer> stimProducer;
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<boost::asio::deadline_timer> delayTimer;
|
std::unique_ptr<boost::asio::deadline_timer> delayTimer;
|
||||||
|
|
||||||
@@ -301,7 +301,7 @@ public:
|
|||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
std::cerr << __func__ << ": Failed to disable pcloud data for "
|
std::cerr << __func__ << ": Failed to disable pcloud data for "
|
||||||
"stimbuff " << context->spec->deviceSelector << std::endl;
|
"stim producer " << context->spec->deviceSelector << std::endl;
|
||||||
// Fallthrough.
|
// Fallthrough.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,7 +315,7 @@ public:
|
|||||||
{
|
{
|
||||||
// Initialize timer with device's component thread
|
// Initialize timer with device's component thread
|
||||||
delayTimer = std::make_unique<boost::asio::deadline_timer>(
|
delayTimer = std::make_unique<boost::asio::deadline_timer>(
|
||||||
context->stimBuff->device->componentThread->getIoService());
|
context->stimProducer->device->componentThread->getIoService());
|
||||||
|
|
||||||
delayTimer->expires_from_now(boost::posix_time::milliseconds(5));
|
delayTimer->expires_from_now(boost::posix_time::milliseconds(5));
|
||||||
delayTimer->async_wait(
|
delayTimer->async_wait(
|
||||||
@@ -337,17 +337,17 @@ public:
|
|||||||
// Fallthrough.
|
// Fallthrough.
|
||||||
}
|
}
|
||||||
|
|
||||||
context->stimBuff->stop();
|
context->stimProducer->stop();
|
||||||
// Remove stimulus buffer from collection before destroying device
|
// Remove stimulus producer from collection before destroying device
|
||||||
context->stimBuff->device->nAttachedStimBuffs--;
|
context->stimProducer->device->nAttachedStimBuffs--;
|
||||||
auto it = std::find(
|
auto it = std::find(
|
||||||
attachedStimBuffs.begin(), attachedStimBuffs.end(),
|
attachedDataProducers.begin(), attachedDataProducers.end(),
|
||||||
context->stimBuff);
|
context->stimProducer);
|
||||||
if (it != attachedStimBuffs.end())
|
if (it != attachedDataProducers.end())
|
||||||
{ attachedStimBuffs.erase(it); }
|
{ attachedDataProducers.erase(it); }
|
||||||
|
|
||||||
(*livoxProto1.livoxProto1_destroyDeviceReq)(
|
(*livoxProto1.livoxProto1_destroyDeviceReq)(
|
||||||
context->stimBuff->device,
|
context->stimProducer->device,
|
||||||
{context, std::bind(
|
{context, std::bind(
|
||||||
&DetachDeviceReq::detachDeviceReq2,
|
&DetachDeviceReq::detachDeviceReq2,
|
||||||
context.get(), context,
|
context.get(), context,
|
||||||
@@ -361,12 +361,12 @@ public:
|
|||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
std::cerr << __func__ << ": Failed to destroy dev "
|
std::cerr << __func__ << ": Failed to destroy dev "
|
||||||
"device " << context->spec->deviceSelector << " for stimbuff."
|
"device " << context->spec->deviceSelector << " for stim "
|
||||||
"\n";
|
"producer.\n";
|
||||||
|
|
||||||
/** NOTE:
|
/** NOTE:
|
||||||
* There's a decent argument for falling through here and still
|
* There's a decent argument for falling through here and still
|
||||||
* removing the stimulus buffer from attachedStimBuffs.
|
* removing the stimulus producer from attachedDataProducers.
|
||||||
*/
|
*/
|
||||||
context->callOriginalCb(false, context->spec);
|
context->callOriginalCb(false, context->spec);
|
||||||
return;
|
return;
|
||||||
@@ -374,8 +374,8 @@ public:
|
|||||||
|
|
||||||
if (1 || smoHooksPtr->OptionParser_getOptions().verbose)
|
if (1 || smoHooksPtr->OptionParser_getOptions().verbose)
|
||||||
{
|
{
|
||||||
std::cout << __func__ << ": Successfully detached pcloud stimbuff "
|
std::cout << __func__ << ": Successfully detached pcloud stim "
|
||||||
"for device " << context->spec->deviceSelector
|
"producer for device " << context->spec->deviceSelector
|
||||||
<< " and possibly also destroyed device.\n";
|
<< " and possibly also destroyed device.\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -489,7 +489,7 @@ extern "C" int livoxGen1_initializeInd(void)
|
|||||||
extern "C" int livoxGen1_finalizeInd(void)
|
extern "C" int livoxGen1_finalizeInd(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
attachedStimBuffs.clear();
|
attachedDataProducers.clear();
|
||||||
|
|
||||||
// Call LivoxProto1 library exit function
|
// Call LivoxProto1 library exit function
|
||||||
if (livoxProto1.livoxProto1_exit) {
|
if (livoxProto1.livoxProto1_exit) {
|
||||||
@@ -517,16 +517,16 @@ extern "C" void livoxGen1_attachDeviceReq(
|
|||||||
|
|
||||||
auto request = std::make_shared<AttachDeviceReq>(desc, cb);
|
auto request = std::make_shared<AttachDeviceReq>(desc, cb);
|
||||||
|
|
||||||
// Check if stimulus buffer already exists in the collection
|
// Check if stimulus producer already exists in the collection
|
||||||
auto pcloudStimBuff = std::static_pointer_cast<PcloudStimulusBuffer>(
|
auto pcloudDataProducer = std::static_pointer_cast<PcloudDataProducer>(
|
||||||
getStimBuff(desc));
|
getDataProducer(desc));
|
||||||
|
|
||||||
if (pcloudStimBuff)
|
if (pcloudDataProducer)
|
||||||
{
|
{
|
||||||
request->stimBuff = pcloudStimBuff;
|
request->stimProducer = pcloudDataProducer;
|
||||||
|
|
||||||
// Check if device's point cloud data is already active
|
// Check if device's point cloud data is already active
|
||||||
if (pcloudStimBuff->device && pcloudStimBuff->device->pcloudDataActive)
|
if (pcloudDataProducer->device && pcloudDataProducer->device->pcloudDataActive)
|
||||||
{
|
{
|
||||||
// Point cloud data is already active, call success callback
|
// Point cloud data is already active, call success callback
|
||||||
request->callOriginalCb(true, request->spec);
|
request->callOriginalCb(true, request->spec);
|
||||||
@@ -537,7 +537,7 @@ extern "C" void livoxGen1_attachDeviceReq(
|
|||||||
* sent to device prior to us reaching here.
|
* sent to device prior to us reaching here.
|
||||||
*/
|
*/
|
||||||
(*livoxProto1.livoxProto1_device_enablePcloudDataReq)(
|
(*livoxProto1.livoxProto1_device_enablePcloudDataReq)(
|
||||||
pcloudStimBuff->device,
|
pcloudDataProducer->device,
|
||||||
{request, std::bind(
|
{request, std::bind(
|
||||||
&AttachDeviceReq::attachDeviceReq5,
|
&AttachDeviceReq::attachDeviceReq5,
|
||||||
request.get(), request,
|
request.get(), request,
|
||||||
@@ -648,22 +648,22 @@ extern "C" void livoxGen1_detachDeviceReq(
|
|||||||
Callback<smo::stim_buff::sal_mlo_detachDeviceReqCbFn> cb
|
Callback<smo::stim_buff::sal_mlo_detachDeviceReqCbFn> cb
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Check if stimulus buffer exists in the collection
|
// Check if stimulus producer exists in the collection
|
||||||
auto stimBuff = std::static_pointer_cast<PcloudStimulusBuffer>(
|
auto stimProducer = std::static_pointer_cast<PcloudDataProducer>(
|
||||||
getStimBuff(desc));
|
getDataProducer(desc));
|
||||||
|
|
||||||
if (!stimBuff)
|
if (!stimProducer)
|
||||||
{
|
{
|
||||||
cb.callbackFn(false, desc);
|
cb.callbackFn(false, desc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto request = std::make_shared<DetachDeviceReq>(
|
auto request = std::make_shared<DetachDeviceReq>(
|
||||||
desc, stimBuff, cb);
|
desc, stimProducer, cb);
|
||||||
|
|
||||||
// Disable point cloud data first
|
// Disable point cloud data first
|
||||||
(*livoxProto1.livoxProto1_device_disablePcloudDataReq)(
|
(*livoxProto1.livoxProto1_device_disablePcloudDataReq)(
|
||||||
stimBuff->device,
|
stimProducer->device,
|
||||||
{request, std::bind(
|
{request, std::bind(
|
||||||
&DetachDeviceReq::detachDeviceReq1,
|
&DetachDeviceReq::detachDeviceReq1,
|
||||||
request.get(), request,
|
request.get(), request,
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#include <user/stimulusFrame.h>
|
#include <user/stimulusFrame.h>
|
||||||
#include "livoxGen1.h"
|
#include "livoxGen1.h"
|
||||||
#include "openClCollatingAndMeshingEngine.h"
|
#include "openClCollatingAndMeshingEngine.h"
|
||||||
#include "pcloudStimulusBuffer.h"
|
#include "pcloudDataProducer.h"
|
||||||
#include "openClKernels.h"
|
#include "openClKernels.h"
|
||||||
#include "frameAssemblyDesc.h"
|
#include "frameAssemblyDesc.h"
|
||||||
#include "ioUringAssemblyEngine.h"
|
#include "ioUringAssemblyEngine.h"
|
||||||
@@ -82,7 +82,7 @@ static bool validateOpenClVersion(
|
|||||||
}
|
}
|
||||||
|
|
||||||
OpenClCollatingAndMeshingEngine::OpenClCollatingAndMeshingEngine(
|
OpenClCollatingAndMeshingEngine::OpenClCollatingAndMeshingEngine(
|
||||||
PcloudStimulusBuffer& parent_)
|
PcloudDataProducer& parent_)
|
||||||
: parent(parent_),
|
: parent(parent_),
|
||||||
platform(nullptr),
|
platform(nullptr),
|
||||||
device(nullptr),
|
device(nullptr),
|
||||||
|
|||||||
@@ -21,12 +21,12 @@
|
|||||||
namespace smo {
|
namespace smo {
|
||||||
namespace stim_buff {
|
namespace stim_buff {
|
||||||
|
|
||||||
class PcloudStimulusBuffer;
|
class PcloudDataProducer;
|
||||||
|
|
||||||
class OpenClCollatingAndMeshingEngine
|
class OpenClCollatingAndMeshingEngine
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit OpenClCollatingAndMeshingEngine(PcloudStimulusBuffer& parent);
|
explicit OpenClCollatingAndMeshingEngine(PcloudDataProducer& parent);
|
||||||
~OpenClCollatingAndMeshingEngine();
|
~OpenClCollatingAndMeshingEngine();
|
||||||
|
|
||||||
// Non-copyable, movable
|
// Non-copyable, movable
|
||||||
@@ -70,7 +70,7 @@ public:
|
|||||||
std::chrono::milliseconds getCollateKernelDuration() const;
|
std::chrono::milliseconds getCollateKernelDuration() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PcloudStimulusBuffer& parent;
|
PcloudDataProducer& parent;
|
||||||
|
|
||||||
// OpenCL infrastructure
|
// OpenCL infrastructure
|
||||||
cl_platform_id platform;
|
cl_platform_id platform;
|
||||||
|
|||||||
+10
-10
@@ -7,7 +7,7 @@
|
|||||||
#include <componentThread.h>
|
#include <componentThread.h>
|
||||||
#include <asynchronousLoop.h>
|
#include <asynchronousLoop.h>
|
||||||
#include <user/stimulusFrame.h>
|
#include <user/stimulusFrame.h>
|
||||||
#include "pcloudStimulusBuffer.h"
|
#include "pcloudDataProducer.h"
|
||||||
#include "frameAssemblyDesc.h"
|
#include "frameAssemblyDesc.h"
|
||||||
|
|
||||||
namespace smo {
|
namespace smo {
|
||||||
@@ -19,7 +19,7 @@ extern const SmoCallbacks* smoHooksPtr;
|
|||||||
static SpMcRingBuffer::InputEngineConstraints openClInputConstraints(
|
static SpMcRingBuffer::InputEngineConstraints openClInputConstraints(
|
||||||
static_cast<size_t>(sysconf(_SC_PAGE_SIZE)), sizeof(void *));
|
static_cast<size_t>(sysconf(_SC_PAGE_SIZE)), sizeof(void *));
|
||||||
|
|
||||||
PcloudStimulusBuffer::PcloudStimulusBuffer(
|
PcloudDataProducer::PcloudDataProducer(
|
||||||
const std::shared_ptr<device::DeviceAttachmentSpec> &deviceAttachmentSpec,
|
const std::shared_ptr<device::DeviceAttachmentSpec> &deviceAttachmentSpec,
|
||||||
std::shared_ptr<livoxProto1::Device> &device,
|
std::shared_ptr<livoxProto1::Device> &device,
|
||||||
const PcloudFormatDesc& formatDesc,
|
const PcloudFormatDesc& formatDesc,
|
||||||
@@ -61,7 +61,7 @@ collationBuffer(
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
std::string errMsg = std::string(__func__) +
|
std::string errMsg = std::string(__func__) +
|
||||||
": PcloudStimulusBuffer constructor called on non-world/body thread " +
|
": PcloudDataProducer constructor called on non-world/body thread " +
|
||||||
smoHooksPtr->ComponentThread_getSelf()->name;
|
smoHooksPtr->ComponentThread_getSelf()->name;
|
||||||
|
|
||||||
std::cout << errMsg << std::endl;
|
std::cout << errMsg << std::endl;
|
||||||
@@ -69,7 +69,7 @@ collationBuffer(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PcloudStimulusBuffer::start()
|
void PcloudDataProducer::start()
|
||||||
{
|
{
|
||||||
// Call ioUringAssemblyEngine setup() as the first step
|
// Call ioUringAssemblyEngine setup() as the first step
|
||||||
if (!ioUringAssemblyEngine.setup())
|
if (!ioUringAssemblyEngine.setup())
|
||||||
@@ -90,7 +90,7 @@ void PcloudStimulusBuffer::start()
|
|||||||
StimulusBuffer::start();
|
StimulusBuffer::start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PcloudStimulusBuffer::stop()
|
void PcloudDataProducer::stop()
|
||||||
{
|
{
|
||||||
// Call base class stop() as the first step
|
// Call base class stop() as the first step
|
||||||
StimulusBuffer::stop();
|
StimulusBuffer::stop();
|
||||||
@@ -103,22 +103,22 @@ void produceStimFrameAck(void)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void PcloudStimulusBuffer::stimFrameProductionTimesliceInd()
|
void PcloudDataProducer::stimFrameProductionTimesliceInd()
|
||||||
{
|
{
|
||||||
produceFrameReq({nullptr, nullptr});
|
produceFrameReq({nullptr, nullptr});
|
||||||
}
|
}
|
||||||
|
|
||||||
class PcloudStimulusBuffer::ProduceFrameReq
|
class PcloudDataProducer::ProduceFrameReq
|
||||||
: public PostedAsynchronousContinuation<produceFrameReqCbFn>
|
: public PostedAsynchronousContinuation<produceFrameReqCbFn>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
PcloudStimulusBuffer& stimBuff;
|
PcloudDataProducer& stimBuff;
|
||||||
AsynchronousLoop frameAssemblyResult;
|
AsynchronousLoop frameAssemblyResult;
|
||||||
StimulusFrame& stimulusFrame;
|
StimulusFrame& stimulusFrame;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ProduceFrameReq(
|
ProduceFrameReq(
|
||||||
PcloudStimulusBuffer& buffer,
|
PcloudDataProducer& buffer,
|
||||||
const std::shared_ptr<ComponentThread>& caller,
|
const std::shared_ptr<ComponentThread>& caller,
|
||||||
Callback<produceFrameReqCbFn> cb)
|
Callback<produceFrameReqCbFn> cb)
|
||||||
: PostedAsynchronousContinuation<produceFrameReqCbFn>(caller, cb),
|
: PostedAsynchronousContinuation<produceFrameReqCbFn>(caller, cb),
|
||||||
@@ -207,7 +207,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void PcloudStimulusBuffer::produceFrameReq(
|
void PcloudDataProducer::produceFrameReq(
|
||||||
smo::Callback<produceFrameReqCbFn> callback)
|
smo::Callback<produceFrameReqCbFn> callback)
|
||||||
{
|
{
|
||||||
/** EXPLANATION:
|
/** EXPLANATION:
|
||||||
+13
-11
@@ -1,7 +1,8 @@
|
|||||||
#ifndef _LIVOX_GEN1_PCLOUD_STIMULUS_BUFFER_H
|
#ifndef _LIVOX_GEN1_PCLOUD_DATA_PRODUCER_H
|
||||||
#define _LIVOX_GEN1_PCLOUD_STIMULUS_BUFFER_H
|
#define _LIVOX_GEN1_PCLOUD_DATA_PRODUCER_H
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <atomic>
|
||||||
#include <user/stimulusBuffer.h>
|
#include <user/stimulusBuffer.h>
|
||||||
#include <livoxProto1/device.h>
|
#include <livoxProto1/device.h>
|
||||||
#include <asynchronousContinuation.h>
|
#include <asynchronousContinuation.h>
|
||||||
@@ -14,31 +15,31 @@ namespace smo {
|
|||||||
namespace stim_buff {
|
namespace stim_buff {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PcloudStimulusBuffer is a specialized StimulusBuffer for point cloud data.
|
* PcloudDataProducer is a specialized StimulusBuffer for point cloud data.
|
||||||
*
|
*
|
||||||
* This class extends StimulusBuffer to handle point cloud-specific stimulus
|
* This class extends StimulusBuffer to handle point cloud-specific stimulus
|
||||||
* frames, particularly those generated from LiDAR point cloud data. It
|
* frames, particularly those generated from LiDAR point cloud data. It
|
||||||
* provides additional functionality for managing point cloud frame metadata
|
* provides additional functionality for managing point cloud frame metadata
|
||||||
* and processing.
|
* and processing.
|
||||||
*/
|
*/
|
||||||
class PcloudStimulusBuffer
|
class PcloudDataProducer
|
||||||
: public StimulusBuffer
|
: public StimulusBuffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit PcloudStimulusBuffer(
|
explicit PcloudDataProducer(
|
||||||
const std::shared_ptr<device::DeviceAttachmentSpec> &deviceAttachmentSpec,
|
const std::shared_ptr<device::DeviceAttachmentSpec> &deviceAttachmentSpec,
|
||||||
std::shared_ptr<livoxProto1::Device> &device,
|
std::shared_ptr<livoxProto1::Device> &device,
|
||||||
const PcloudFormatDesc& formatDesc,
|
const PcloudFormatDesc& formatDesc,
|
||||||
int histbuffMs,
|
int histbuffMs,
|
||||||
size_t nDgramsPerStagingBufferFrame);
|
size_t nDgramsPerStagingBufferFrame);
|
||||||
|
|
||||||
~PcloudStimulusBuffer() = default;
|
~PcloudDataProducer() = default;
|
||||||
|
|
||||||
// Non-copyable, movable
|
// Non-copyable, movable
|
||||||
PcloudStimulusBuffer(const PcloudStimulusBuffer&) = delete;
|
PcloudDataProducer(const PcloudDataProducer&) = delete;
|
||||||
PcloudStimulusBuffer& operator=(const PcloudStimulusBuffer&) = delete;
|
PcloudDataProducer& operator=(const PcloudDataProducer&) = delete;
|
||||||
PcloudStimulusBuffer(PcloudStimulusBuffer&&) = default;
|
PcloudDataProducer(PcloudDataProducer&&) = default;
|
||||||
PcloudStimulusBuffer& operator=(PcloudStimulusBuffer&&) = default;
|
PcloudDataProducer& operator=(PcloudDataProducer&&) = default;
|
||||||
|
|
||||||
// Control methods
|
// Control methods
|
||||||
void start() override;
|
void start() override;
|
||||||
@@ -59,6 +60,7 @@ public:
|
|||||||
StagingBuffer assemblyBuffer;
|
StagingBuffer assemblyBuffer;
|
||||||
IoUringAssemblyEngine ioUringAssemblyEngine;
|
IoUringAssemblyEngine ioUringAssemblyEngine;
|
||||||
StagingBuffer collationBuffer;
|
StagingBuffer collationBuffer;
|
||||||
|
std::atomic<size_t> nAttachedStimBuffs{0};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class ProduceFrameReq;
|
class ProduceFrameReq;
|
||||||
@@ -67,4 +69,4 @@ private:
|
|||||||
} // namespace stim_buff
|
} // namespace stim_buff
|
||||||
} // namespace smo
|
} // namespace smo
|
||||||
|
|
||||||
#endif // _LIVOX_GEN1_PCLOUD_STIMULUS_BUFFER_H
|
#endif // _LIVOX_GEN1_PCLOUD_DATA_PRODUCER_H
|
||||||
Reference in New Issue
Block a user