MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / rebuildTrackers

Method rebuildTrackers

app/src/UI/AlarmMonitor.cpp:74–107  ·  view source on GitHub ↗

* @brief Rebuilds the per-dataset tracker list from the Dashboard's dataset map; the baseline * band is re-captured on the next evaluation so layout rebuilds never re-fire alarms. */

Source from the content-addressed store, hash-verified

72 * band is re-captured on the next evaluation so layout rebuilds never re-fire alarms.
73 */
74void UI::AlarmMonitor::rebuildTrackers()
75{
76 m_trackers.clear();
77
78 const auto& datasets = UI::Dashboard::instance().datasets();
79 for (auto it = datasets.cbegin(); it != datasets.cend(); ++it) {
80 const auto& dataset = it.value();
81 if (dataset.alarmBands.empty())
82 continue;
83
84 Tracker tracker;
85 tracker.uniqueId = it.key();
86 tracker.hint = -1;
87 tracker.lastFiredBand = -1;
88 tracker.initialized = false;
89 tracker.rangeMin = qMin(dataset.wgtMin, dataset.wgtMax);
90 tracker.rangeMax = qMax(dataset.wgtMin, dataset.wgtMax);
91 tracker.title = dataset.title;
92 tracker.units = dataset.units;
93 tracker.lastFireMs = {0, 0, 0, 0};
94
95 tracker.bands.reserve(dataset.alarmBands.size());
96 for (const auto& band : dataset.alarmBands) {
97 Band b;
98 b.min = qMin(band.min, band.max);
99 b.max = qMax(band.min, band.max);
100 b.severity = static_cast<int>(band.severity);
101 b.label = band.label;
102 tracker.bands.push_back(std::move(b));
103 }
104
105 m_trackers.push_back(std::move(tracker));
106 }
107}
108
109//--------------------------------------------------------------------------------------------------
110// Alarm evaluation

Callers

nothing calls this directly

Calls 7

cbeginMethod · 0.80
cendMethod · 0.80
emptyMethod · 0.80
keyMethod · 0.80
clearMethod · 0.45
valueMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected