8#include "platforms/wasm/fs_wasm.h"
9#define FASTLED_HAS_SDCARD 1
10#elif FL_HAS_INCLUDE(<SD.h>) && FL_HAS_INCLUDE(<fs.h>)
12#include "platforms/fs_sdcard_arduino.hpp"
13#define FASTLED_HAS_SDCARD 1
15#define FASTLED_HAS_SDCARD 0
31 fl::size
size()
const override {
return 0; }
32 fl::size
read(
u8 *dst, fl::size bytesToRead)
override {
37 fl::size
pos()
const override {
return 0; }
38 const char *
path()
const override {
return "NULL FILE HANDLE"; }
53 FASTLED_WARN(
"NullFileSystem instantiated as a placeholder, please "
54 "implement a file system for your platform.");
58 bool begin()
override {
return true; }
59 void end()
override {}
61 void close(FileHandlePtr file)
override {
67 FileHandlePtr
openRead(
const char *_path)
override {
70 FileHandlePtr out = ptr;
85 mFs = platform_filesystem;
120 *error =
"Failed to read file: ";
141 *error =
"Failed to read file: ";
159 return mFs->openRead(path);
162 fl::size nFrameHistory) {
163 Video video(pixelsPerFrame, fps, nFrameHistory);
164 FileHandlePtr file =
openRead(path);
174 FileHandlePtr file =
openRead(path);
179 fl::size size = file->size();
182 while (file->available()) {
184 fl::size n = file->read(buf,
sizeof(buf));
186 out->
append((
const char *)buf, n);
190 FASTLED_DBG_IF(!wrote,
"Failed to write any data to the output string.");
196#if !FASTLED_HAS_SDCARD
virtual fl::size size() const =0
virtual fl::size bytesLeft() const
virtual fl::size pos() const =0
bool readText(const char *path, string *out)
FileHandlePtr openRead(const char *path)
bool readJson(const char *path, Json *doc)
bool readScreenMaps(const char *path, fl::fl_map< string, ScreenMap > *out, string *error=nullptr)
bool readScreenMap(const char *path, const char *name, ScreenMap *out, string *error=nullptr)
bool begin(FsImplPtr platform_filesystem)
Video openVideo(const char *path, fl::size pixelsPerFrame, float fps=30.0f, fl::size nFrameHistory=0)
void close(FileHandlePtr file)
static Json parse(const fl::string &txt)
bool available() const override
const char * path() const override
bool seek(fl::size pos) override
fl::size read(u8 *dst, fl::size bytesToRead) override
fl::size size() const override
fl::size pos() const override
bool valid() const override
~NullFileHandle() override
~NullFileSystem() override
void close(FileHandlePtr file) override
FileHandlePtr openRead(const char *_path) override
static bool ParseJson(const char *jsonStrScreenMap, fl::fl_map< string, ScreenMap > *segmentMaps, string *err=nullptr)
void reserve(fl::size newCapacity)
const char * c_str() const
bool begin(fl::FileHandlePtr h)
void setError(const Str &error)
string & append(const BitsetFixed< N > &bs)
#define FASTLED_DBG_IF(COND, MSG)
FastLED's Elegant JSON Library: fl::Json
Implements the FastLED namespace macros.
FL_LINK_WEAK FsImplPtr make_sdcard_filesystem(int cs_pin)
shared_ptr< T > make_shared(Args &&... args)
MapRedBlackTree< Key, T, Compare, fl::allocator_slab< char > > fl_map
#define FASTLED_UNUSED(x)