StimBuff: Add skeleton common impl with rate limiting

This commit is contained in:
2025-10-31 13:43:23 -04:00
parent 3bf8146ca3
commit ebbb2b1345
3 changed files with 112 additions and 116 deletions
@@ -1,10 +1,6 @@
#ifndef _LIVOX_GEN1_PCLOUD_STIMULUS_BUFFER_H
#define _LIVOX_GEN1_PCLOUD_STIMULUS_BUFFER_H
#include <config.h>
#include <atomic>
#include <boost/asio/deadline_timer.hpp>
#include <spinLock.h>
#include <user/stimulusBuffer.h>
#include <user/stimFrame.h>
#include <livoxProto1/device.h>
@@ -40,25 +36,12 @@ public:
PcloudStimulusBuffer(PcloudStimulusBuffer&&) = default;
PcloudStimulusBuffer& operator=(PcloudStimulusBuffer&&) = default;
// Control methods
void start();
void stop();
public:
device::DeviceAttachmentSpec deviceAttachmentSpec;
std::shared_ptr<livoxProto1::Device> device;
PcloudFormatDesc formatDesc;
StagingBuffer stagingBuffer;
IoUringAssemblyEngine ioUringAssemblyEngine;
private:
std::atomic<bool> shouldContinue;
boost::asio::deadline_timer timer;
SpinLock frameAssemblyRateLimiter;
private:
void scheduleNextTimeout(int delayMs = CONFIG_STIMBUFF_FRAME_PERIOD_MS);
void onTimeout(const boost::system::error_code& error);
};
} // namespace stim_buff