Implemented client datasource

This commit is contained in:
Martino Ferrari
2026-06-25 00:45:45 +02:00
parent dca4872976
commit 0412c20edd
28 changed files with 3448 additions and 618 deletions
@@ -187,6 +187,22 @@ private:
}
}
/** @brief Batch ring write for signal @p s, with optional trigger check.
* Uses WriteBatch internally (single lock acquisition for all samples). */
inline void WriteSampleBatch(uint32 s, const float64 *t, const float64 *v,
uint32 n) {
rings_[s].WriteBatch(t, v, n);
/* Trigger check must still run per-sample for the watched signal. */
if ((trigSigIdx_ >= 0) && (static_cast<uint32>(trigSigIdx_) == s) &&
(trigEngine_ != static_cast<TriggerEngine *>(0))) {
for (uint32 e = 0u; e < n; e++) {
if ((trigElemIdx_ < 0) || (static_cast<uint32>(trigElemIdx_) == e)) {
trigEngine_->CheckSample(t[e], v[e]);
}
}
}
}
/**
* @brief Decode @p nElems consecutive elements of signal @p desc starting
* at payload offset @p off into @p out (dequantised physical values).
@@ -253,12 +269,23 @@ private:
bool timeSigCalibValid_[UDPSS_MAX_SIGNALS];
/* Last packet arrival wall time per signal — used to interpolate per-element
* timestamps for packed TIMEMODE_PACKET arrays (Go hub lastPktNs). */
* timestamps for packed TIMEMODE_PACKET arrays (Go hub lastPktNs).
* For accumulated scalars this instead holds the previous packet's
* sender-clock seconds (HRT-derived), used to derive the per-sample dt. */
float64 lastPktWallS_[UDPSS_MAX_SIGNALS];
bool lastPktWallValid_[UDPSS_MAX_SIGNALS];
/* Scratch for decoding referenced time-signal arrays (receive thread only). */
float64 *timeScratch_;
/* Accumulated-scalar timing: HRT counter frequency (local == sender on the
* same host) and the previous packet's sample count, used to reconstruct
* per-sample timestamps from the embedded sender HRT instead of the (UDP
* burst-sensitive) packet arrival time. */
float64 hrtFreq_;
uint32 accScalarPrevN_[UDPSS_MAX_SIGNALS];
/* Scratch buffers for decoding arrays (receive thread only). */
float64 *timeScratch_; ///< Time values scratch
float64 *valScratch_; ///< Data values scratch
float64 *tsBatchScratch_; ///< Timestamps scratch for batch write
uint32 timeScratchLen_;
/* Trigger hookup (resolution cache is receive-thread only). */