Complete Rebuild, with Subsystems for each component. RTOS Tasks. (help by Claude)
This commit is contained in:
61
vesper/src/FileManager/FileManager.hpp
Normal file
61
vesper/src/FileManager/FileManager.hpp
Normal 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
|
||||
Reference in New Issue
Block a user