#pragma once #include "StreamingMsgPackEncoder.h" #include class SpiffsStorageWriter { public: SpiffsStorageWriter(const String &fileName) : f_(SPIFFS.open(fileName, "w")), encoder_(&f_), fileName_(fileName) { bool success = f_; Serial.println(success); } ~SpiffsStorageWriter() { f_.close(); Serial.println(fileName_); Serial.println(SPIFFS.exists(fileName_)); } StreamingMsgPackEncoder &encoder() { return encoder_; } private: File f_; StreamingMsgPackEncoder encoder_; String fileName_; }; class SpiffsStorageReader { public: SpiffsStorageReader(const String &fileName) : f_(SPIFFS.open(fileName, "r")) {} ~SpiffsStorageReader() { f_.close(); } uint32_t readBytes(char *buffer, size_t length) { return f_.readBytes(buffer, length); } bool seek(uint32_t pos) { return f_.seek(pos); } private: File f_; };