Complete IoT monitoring platform for Acuvim II power meters via ESP32. Firmware (Phases 1-7): - ESP32-WROVER-B (TTGO T-Call v1.4) with RS485 Modbus RTU - WiFi STA+AP concurrent mode with GSM/GPRS failover - Transport abstraction layer with 4 priority modes - MQTT protocol with 20 commands, LWT, QoS, exponential backoff - SD card offline buffering with JSONL rotation and non-blocking drain - OTA firmware updates with dual partition rollback protection - Watchdog timer, crash loop detection, Acuvim health monitoring - Captive portal provisioning with AP mode Console backend (Phase 8): - .NET 10 minimal API with PostgreSQL + EF Core - JWT authentication, SignalR real-time updates - MQTTnet 5.x bridge service with health monitoring - Device, telemetry, firmware, alert, group management - Rate limiting, security headers, Swagger/OpenAPI Frontend (Phase 9): - React 18 + TypeScript + Vite with Ant Design 5 - ECharts telemetry visualization, TanStack Query - SignalR live updates, device management UI - Dashboard, fleet management, firmware deployment Testing & Production (Phase 10): - 28 firmware unit tests (Modbus, JSON, config, version) - 23 xUnit backend tests (device, telemetry, command, alert) - Docker Compose with nginx, TLS MQTT, PostgreSQL - Production deployment, commissioning, and troubleshooting docs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
46 lines
1.1 KiB
C++
46 lines
1.1 KiB
C++
#ifndef HEARTBEAT_MANAGER_H
|
|
#define HEARTBEAT_MANAGER_H
|
|
|
|
#include <Arduino.h>
|
|
#include "config_manager.h"
|
|
#include "transport_manager.h"
|
|
#include "mqtt_client.h"
|
|
#include "acuvim_reader.h"
|
|
#include "gsm_manager.h"
|
|
#include "wifi_manager.h"
|
|
#include "sd_manager.h"
|
|
#include "ota_manager.h"
|
|
|
|
class HeartbeatManager {
|
|
public:
|
|
void begin(ConfigManager& config, TransportManager& transport,
|
|
MqttClient& mqtt, AcuvimReader& acuvim,
|
|
WifiManager& wifi, GsmManager& gsm,
|
|
SdManager& sd, OtaManager& ota);
|
|
void loop();
|
|
void sendNow();
|
|
|
|
uint32_t getBootCount() const { return _bootCount; }
|
|
uint32_t getHeartbeatCount() const { return _heartbeatCount; }
|
|
|
|
private:
|
|
ConfigManager* _config;
|
|
TransportManager* _transport;
|
|
MqttClient* _mqtt;
|
|
AcuvimReader* _acuvim;
|
|
WifiManager* _wifi;
|
|
GsmManager* _gsm;
|
|
SdManager* _sd;
|
|
OtaManager* _ota;
|
|
|
|
unsigned long _lastHeartbeatMs;
|
|
uint32_t _heartbeatCount;
|
|
uint32_t _bootCount;
|
|
bool _sentInitial;
|
|
|
|
String buildPayload();
|
|
void loadBootCount();
|
|
};
|
|
|
|
#endif
|