64 lines
1.4 KiB
C++
64 lines
1.4 KiB
C++
#ifndef _LIVOX_GEN1_IOURING_ASSEMBLY_ENGINE_H
|
|
#define _LIVOX_GEN1_IOURING_ASSEMBLY_ENGINE_H
|
|
|
|
#include <boostAsioLinkageFix.h>
|
|
#include <cstdint>
|
|
#include <cstddef>
|
|
#include <memory>
|
|
#include <functional>
|
|
#include <vector>
|
|
#include <chrono>
|
|
#include <atomic>
|
|
#include <liburing.h>
|
|
#include <boost/asio/io_service.hpp>
|
|
#include <boost/asio/deadline_timer.hpp>
|
|
#include <livoxProto1/device.h>
|
|
#include "frameAssemblyDesc.h"
|
|
|
|
namespace smo {
|
|
namespace stim_buff {
|
|
|
|
class PcloudStimulusBuffer;
|
|
|
|
class IoUringAssemblyEngine
|
|
{
|
|
public:
|
|
explicit IoUringAssemblyEngine(PcloudStimulusBuffer& parent);
|
|
~IoUringAssemblyEngine() = default;
|
|
|
|
bool setup();
|
|
void finalize();
|
|
void resetAndAssembleFrame();
|
|
void stop();
|
|
|
|
// Telemetry helpers
|
|
static size_t computePointsPerDgram(int returnMode);
|
|
static size_t computePointsPerFrame(int returnMode, size_t nDgramsPerFrame)
|
|
{ return computePointsPerDgram(returnMode) * nDgramsPerFrame; }
|
|
|
|
private:
|
|
PcloudStimulusBuffer& parent;
|
|
|
|
// Cached descriptor for reuse across iterations
|
|
std::shared_ptr<FrameAssemblyDesc> frameAssemblyDesc;
|
|
|
|
// io_uring infrastructure
|
|
struct io_uring ring;
|
|
bool isSetup;
|
|
|
|
// Point cloud data socket descriptor
|
|
std::shared_ptr<boost::asio::posix::stream_descriptor> pcloudDataFdDesc;
|
|
|
|
// Stall detection timer
|
|
boost::asio::deadline_timer stallTimer;
|
|
|
|
void cancelIncompleteAndFillDummies();
|
|
};
|
|
|
|
} // namespace stim_buff
|
|
} // namespace smo
|
|
|
|
#endif // _LIVOX_GEN1_IOURING_ASSEMBLY_ENGINE_H
|
|
|
|
|