6#include "platforms/wasm/fs_wasm.h"
7#define FASTLED_HAS_SDCARD 1
8#elif __has_include(<SD.h>) && __has_include(<fs.h>)
10#include "platforms/fs_sdcard_arduino.hpp"
11#define FASTLED_HAS_SDCARD 1
13#define FASTLED_HAS_SDCARD 0
29 fl::size
size()
const override {
return 0; }
30 fl::size
read(
u8 *dst, fl::size bytesToRead)
override {
35 fl::size
pos()
const override {
return 0; }
36 const char *
path()
const override {
return "NULL FILE HANDLE"; }
51 FASTLED_WARN(
"NullFileSystem instantiated as a placeholder, please "
52 "implement a file system for your platform.");
56 bool begin()
override {
return true; }
57 void end()
override {}
59 void close(FileHandlePtr file)
override {
65 FileHandlePtr
openRead(
const char *_path)
override {
68 FileHandlePtr out = ptr;
83 mFs = platform_filesystem;
118 *error =
"Failed to read file: ";
139 *error =
"Failed to read file: ";
157 return mFs->openRead(path);
160 fl::size nFrameHistory) {
161 Video video(pixelsPerFrame, fps, nFrameHistory);
162 FileHandlePtr file =
openRead(path);
172 FileHandlePtr file =
openRead(path);
177 fl::size size = file->size();
180 while (file->available()) {
182 fl::size n = file->read(buf,
sizeof(buf));
184 out->
append((
const char *)buf, n);
188 FASTLED_DBG_IF(!wrote,
"Failed to write any data to the output string.");
194#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.
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)