Complete Rebuild, with Subsystems for each component. RTOS Tasks. (help by Claude)

This commit is contained in:
2025-10-01 12:42:00 +03:00
parent 104c1d04d4
commit f696984cd1
57 changed files with 11757 additions and 2290 deletions

View File

@@ -0,0 +1,61 @@
/*
* ═══════════════════════════════════════════════════════════════════════════════════
* FILEMANAGER.HPP - SD Card and File Operations Manager
* ═══════════════════════════════════════════════════════════════════════════════════
*
* 📁 THE FILE SYSTEM ORCHESTRATOR OF VESPER 📁
*
* This class provides a clean, robust interface for all file operations
* including melody file management, configuration persistence, and
* comprehensive error handling with automatic recovery.
*
* 📋 VERSION: 2.0 (Enhanced file management)
* 📅 DATE: 2025
* 👨‍💻 AUTHOR: Advanced Bell Systems
* ═══════════════════════════════════════════════════════════════════════════════════
*/
#ifndef FILEMANAGER_HPP
#define FILEMANAGER_HPP
#include <Arduino.h>
#include <SD.h>
#include <HTTPClient.h>
#include <WiFiClient.h>
#include <ArduinoJson.h>
#include "../Logging/Logging.hpp"
#include "../ConfigManager/ConfigManager.hpp"
class FileManager {
private:
ConfigManager* configManager;
public:
// Constructor
FileManager(ConfigManager* config);
// Core file operations
bool downloadFile(const String& url, const String& directory, const String& filename);
bool addMelody(JsonVariant doc); // Download melody file from JSON data
String listFilesAsJson(const char* dirPath);
// File utilities
bool fileExists(const String& filePath);
bool deleteFile(const String& filePath);
bool createDirectory(const String& dirPath);
size_t getFileSize(const String& filePath);
// ═══════════════════════════════════════════════════════════════════════════════
// HEALTH CHECK METHOD
// ═══════════════════════════════════════════════════════════════════════════════
/** @brief Check if FileManager is in healthy state */
bool isHealthy() const;
private:
// Helper functions
bool initializeSD();
bool ensureDirectoryExists(const String& dirPath);
};
#endif