Files
MeshCore/src/helpers/PrefsSaveReplyGuard.h
T
mikecarper 4fb7b83ac9 Report CLI save failures and validate advert intervals
Roll back failed password and advert changes, propagate identity-store results, and report unsaved common and observer settings. Correct observer filter persistence and KISS OTA capability claims. Add fault-injection and packaging regressions.
2026-09-15 20:05:30 -07:00

22 lines
612 B
C++

#pragma once
#include <stdint.h>
#include <string.h>
// Legacy setters can apply live settings before saving. Never let their final
// OK overwrite a persistence error, including through nested CLI dispatch.
class PrefsSaveReplyGuard {
const uint32_t& _failures;
const uint32_t _start;
char* _reply;
public:
PrefsSaveReplyGuard(const uint32_t& failures, char* reply)
: _failures(failures), _start(failures), _reply(reply) {}
~PrefsSaveReplyGuard() {
if (_failures != _start) {
strcpy(_reply, "Error: settings not saved; unsaved changes may remain active until reboot");
}
}
};