Implemented and fixed many issues
This commit is contained in:
@@ -91,7 +91,7 @@ public:
|
||||
* WSPort (uint32, default 8090)
|
||||
* MaxPoints (uint32, default 20000) — ring buffer capacity per signal
|
||||
* PushRate (uint32, default 30) — push loop rate in Hz
|
||||
* MaxPushPoints (uint32, default 500) — LTTB threshold for live push
|
||||
* MaxPushPoints (uint32, default 50) — LTTB threshold for live push
|
||||
* StatsRate (uint32, default 1) — stats broadcast rate in Hz
|
||||
* +Sources { +<id> { Label=...; Addr=...; Port=... } }
|
||||
*
|
||||
@@ -152,12 +152,40 @@ private:
|
||||
void BroadcastTriggerState();
|
||||
|
||||
/**
|
||||
* @brief Build and broadcast the version=2 binary capture frame:
|
||||
* [u8 2][f64 trigTime][f64 preSec][f64 postSec][u32 nSig]
|
||||
* {[u16 keyLen][fullKey][u32 N][t f64×N][v f64×N]}
|
||||
* @brief Size every ring so it retains the current trigger window.
|
||||
* Called from the push loop once per stats tick; a no-op once the rings
|
||||
* are large enough. Rates are measured from the rings themselves because
|
||||
* most sources advertise samplingRate = 0.
|
||||
*/
|
||||
void BroadcastTriggerCapture(float64 trigTime, float64 preSec,
|
||||
float64 postSec);
|
||||
void GrowRingsForTrigger();
|
||||
|
||||
/** @return Largest ring capacity currently allocated across all sessions. */
|
||||
uint32 CurrentMaxRingCapacity() const;
|
||||
|
||||
/**
|
||||
* @brief How far source @p i has produced, in the trigger's time base;
|
||||
* @p wallNowS when it publishes no producer clock (its samples are then
|
||||
* stamped on arrival, so they share the hub's wall clock).
|
||||
*/
|
||||
float64 SourceFrontierTime(uint32 i, float64 wallNowS) const;
|
||||
|
||||
/* ---- Trigger capture assembly ---------------------------------------
|
||||
* Sources are harvested one at a time, each as soon as *it* has produced
|
||||
* past the end of the window, rather than all together once the slowest
|
||||
* has. Sources free-run on their own clocks and can lag each other by
|
||||
* seconds; making every source wait for the slowest lets the leaders' ring
|
||||
* buffers roll past the pre-trigger region before it is ever read. */
|
||||
|
||||
/** @brief Start a version=2 capture frame:
|
||||
* [u8 2][f64 trigTime][f64 preSec][f64 postSec][u32 nSig]. */
|
||||
void BeginTriggerCapture(float64 trigTime, float64 preSec, float64 postSec);
|
||||
|
||||
/** @brief Append session @p i's signals to the pending frame, each as
|
||||
* {[u16 keyLen][fullKey][u32 N][t f64×N][v f64×N]}. */
|
||||
void HarvestTriggerCapture(uint32 i, float64 t0, float64 t1);
|
||||
|
||||
/** @brief Patch nSig, broadcast the pending frame and release it. */
|
||||
void FinishTriggerCapture();
|
||||
|
||||
/* ---- Command handlers (called from OnWSCommand) ---------------------- */
|
||||
|
||||
@@ -271,8 +299,10 @@ private:
|
||||
uint32 pushRateHz_;
|
||||
uint32 maxPushPoints_;
|
||||
uint32 statsRateHz_;
|
||||
uint32 ringTemporal_; ///< Ring capacity for multi-element (waveform) signals
|
||||
uint32 ringTemporal_; ///< Initial ring capacity for multi-element (waveform) signals
|
||||
uint32 ringScalar_; ///< Ring capacity for scalar signals
|
||||
uint32 ringMaxPts_; ///< Ceiling a ring may be grown to for a trigger window
|
||||
volatile float64 trigRetentionSec_; ///< Retention the current trigger window needs
|
||||
StreamString sourcesFile_; ///< Persistent dynamic source list (JSON)
|
||||
uint32 nextSourceId_; ///< Counter for generated session ids ("sN")
|
||||
|
||||
@@ -292,7 +322,9 @@ private:
|
||||
static const uint32 kPushBufSize = 8u * 1024u * 1024u;
|
||||
uint8 *pushBuf_;
|
||||
|
||||
/* Decimated output scratch (LTTB): maxPushPoints × 2 arrays per signal */
|
||||
/* Decimated output scratch (LTTB). Sized like the read scratch rather
|
||||
* than maxPushPoints_: a PACKET-timed array raises its own threshold to
|
||||
* one packet's worth of elements, which can exceed maxPushPoints_. */
|
||||
float64 *lttbT_;
|
||||
float64 *lttbV_;
|
||||
|
||||
@@ -311,6 +343,14 @@ private:
|
||||
TrigState lastTrigState_; ///< Last broadcast FSM state
|
||||
bool rearmPending_; ///< Normal-mode auto-rearm scheduled
|
||||
float64 rearmAtWallS_; ///< Wall time of the scheduled auto-rearm
|
||||
float64 collectStartWallS_; ///< Wall time COLLECTING began (watchdog only)
|
||||
|
||||
/* Capture frame under assembly across ticks (push thread only) */
|
||||
MARTe::uint8 *capBuf_; ///< Pending frame, NULL when idle
|
||||
uint32 capCap_; ///< Allocated size of capBuf_
|
||||
uint32 capOff_; ///< Bytes written so far
|
||||
uint32 capNSig_; ///< Signals appended so far
|
||||
bool capHarvested_[kMaxSessions]; ///< Session already appended
|
||||
};
|
||||
|
||||
} /* namespace StreamHub */
|
||||
|
||||
Reference in New Issue
Block a user