Files
project-vesper/src/Communication/Handlers/SystemHandler/SystemHandler.hpp
T
bonaminandClaude Sonnet 5 64a8bc2b88 feat(SystemHandler,ConfigManager): add system.set_identity sysadmin command (F-060)
Device identity (serial/hw_family/hw_revision) has been read-only from
production firmware since NVS provisioning — serial derives the MQTT
password and hw_family/hw_revision select the OTA channel, so an
uncontrolled write path could desync MQTT auth or brick OTA to the
wrong hardware. This adds one narrow, deliberate exception: an
MQTT-only system.set_identity command for correcting a
mis-provisioned unit or reassigning a serial after a board swap,
without a USB/serial reflash.

Rejected over WebSocket/HTTP/UART by design (same pattern as
identify's WebSocket-only check); requires all three fields together
to avoid partial-identity states; forces a reboot after a successful
write since MQTT credentials/hostname/AP SSID are derived from serial
only once at boot. Firmware does not update the backend device record
itself — that's the caller's (console's) responsibility in the same
operation.

Also includes docs/README.md's rule 6 (console API reference sync
requirement) from an earlier uncommitted session, which this change
follows.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-20 20:09:39 +03:00

47 lines
1.5 KiB
C++

#pragma once
#if HAS_RTC
#include <vector>
#include "../ICommandHandler.hpp"
class ConfigManager;
class Player;
class Telemetry;
class HealthMonitor;
class Timekeeper;
class ClientManager;
class SystemHandler : public ICommandHandler {
public:
SystemHandler(ConfigManager& configManager, Player& player,
Telemetry& telemetry, HealthMonitor& healthMonitor,
Timekeeper& timeKeeper, ClientManager& clientManager);
std::vector<String> commands() const override;
CommandResult execute(const CommandEnvelope& envelope) override;
private:
ConfigManager& _configManager;
Player& _player;
Telemetry& _telemetry;
HealthMonitor& _healthMonitor;
Timekeeper& _timeKeeper;
ClientManager& _clientManager;
CommandResult handlePing(const CommandEnvelope& e);
CommandResult handleIdentify(const CommandEnvelope& e);
CommandResult handleStatus(const CommandEnvelope& e);
CommandResult handleGetTime(const CommandEnvelope& e);
CommandResult handleGetConfig(const CommandEnvelope& e);
CommandResult handleGetDeviceInfo(const CommandEnvelope& e);
CommandResult handleHealth(const CommandEnvelope& e);
CommandResult handleGetAll(const CommandEnvelope& e);
CommandResult handleGetTelemetry(const CommandEnvelope& e);
CommandResult handleFactoryReset(const CommandEnvelope& e);
CommandResult handleRestart(const CommandEnvelope& e);
CommandResult handleSetIdentity(const CommandEnvelope& e);
};
#endif // HAS_RTC