4#error ("ZephyrSD only supported by zephyr")
7#include <zephyr/fs/fs.h>
8#include <zephyr/storage/disk_access.h>
51 LOGE(
"fs_open(%s) failed: %d", file_path,
rc);
81 bool isOpen()
const {
return is_open; }
83 operator bool()
const {
return is_open; }
96 if (pos >= file_size) {
100 return static_cast<int>(file_size - pos);
120 if (!is_open || buffer ==
nullptr || len == 0) {
126 return rc > 0 ?
static_cast<size_t>(
rc) : 0;
132 if (!is_open || buffer ==
nullptr || len == 0) {
142 size_t written =
static_cast<size_t>(
rc);
145 if (pos > file_size) {
195 return pos >= 0 ?
static_cast<size_t>(pos) : 0;
198 size_t size()
const {
return file_size; }
200 const char*
name()
const {
return path; }
204 bool is_open =
false;
205 const char* path =
nullptr;
206 size_t file_size = 0;
211 if (path ==
nullptr) {
217 if (
fs_stat(path, &entry) == 0) {
218 file_size = entry.size;
224 is_open =
other.is_open;
226 file_size =
other.file_size;
229 other.is_open =
false;
230 other.path =
nullptr;
#define LOGE(...)
Definition AudioLoggerIDF.h:30