DAPSpec: QualeIfaceApiParams: Add histbuffMs
This commit is contained in:
@@ -178,11 +178,36 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
// Parse history buffer duration from quale-iface-api-params
|
||||
int histbuffMs = 30000; // Default: 30000ms (30 seconds)
|
||||
const std::vector<std::string> histbuffParamNames = {
|
||||
"history-buffer-duration-ms",
|
||||
"hist-buff-duration-ms",
|
||||
"histbuff-duration-ms",
|
||||
"histbuff-ms"
|
||||
};
|
||||
|
||||
// Loop through synonyms in reverse order; lattermost synonym wins.
|
||||
for (auto synIt = histbuffParamNames.rbegin();
|
||||
synIt != histbuffParamNames.rend(); ++synIt)
|
||||
{
|
||||
const auto& paramName = *synIt;
|
||||
try {
|
||||
histbuffMs = smo::device::DeviceAttachmentSpec
|
||||
::parseRequiredParamAsInt(
|
||||
context->spec->qualeIfaceApiParams, paramName);
|
||||
break; // Found and parsed successfully
|
||||
} catch (const std::exception&) {
|
||||
// Parameter not found or parse error, continue to next synonym
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Create and add PcloudStimulusBuffer to collection now that device is ready
|
||||
StimulusBuffer::PcloudFormatDesc formatDesc;
|
||||
formatDesc.format = StimulusBuffer::PcloudFormatDesc::Format::XYZI;
|
||||
auto pcloudStimBuff = std::make_shared<PcloudStimulusBuffer>(
|
||||
*context->spec, context->deviceTmp, formatDesc, 30);
|
||||
*context->spec, context->deviceTmp, formatDesc, histbuffMs, 30);
|
||||
|
||||
context->stimBuff = pcloudStimBuff;
|
||||
context->deviceTmp->nAttachedStimBuffs++;
|
||||
|
||||
@@ -17,10 +17,11 @@ PcloudStimulusBuffer::PcloudStimulusBuffer(
|
||||
const device::DeviceAttachmentSpec& deviceAttachmentSpec,
|
||||
std::shared_ptr<livoxProto1::Device> &device,
|
||||
const PcloudFormatDesc& formatDesc,
|
||||
int histbuffMs,
|
||||
size_t nDgramsPerStagingBufferFrame)
|
||||
: StimulusBuffer(
|
||||
deviceAttachmentSpec,
|
||||
static_cast<size_t>((1000 * 30) / CONFIG_STIMBUFF_FRAME_PERIOD_MS),
|
||||
static_cast<size_t>(histbuffMs / CONFIG_STIMBUFF_FRAME_PERIOD_MS),
|
||||
openClInputConstraints,
|
||||
device->componentThread->getIoService()),
|
||||
deviceAttachmentSpec(deviceAttachmentSpec), device(device),
|
||||
|
||||
@@ -26,6 +26,7 @@ public:
|
||||
const device::DeviceAttachmentSpec& deviceAttachmentSpec,
|
||||
std::shared_ptr<livoxProto1::Device> &device,
|
||||
const PcloudFormatDesc& formatDesc,
|
||||
int histbuffMs,
|
||||
size_t nDgramsPerStagingBufferFrame);
|
||||
|
||||
~PcloudStimulusBuffer() = default;
|
||||
|
||||
Reference in New Issue
Block a user