![]() |
Repetier-Firmware
0.80
|
Base class for SdFile with Print and C++ streams. More...
#include <SdFat.h>
Public Member Functions | |
SdBaseFile () | |
SdBaseFile (const char *path, uint8_t oflag) | |
~SdBaseFile () | |
bool | getWriteError () |
void | clearWriteError () |
void | getpos (fpos_t *pos) |
void | setpos (fpos_t *pos) |
bool | close () |
bool | contiguousRange (uint32_t *bgnBlock, uint32_t *endBlock) |
bool | createContiguous (SdBaseFile *dirFile, const char *path, uint32_t size) |
uint32_t | curCluster () const |
uint32_t | curPosition () const |
bool | dirEntry (dir_t *dir) |
bool | exists (const char *name) |
int16_t | fgets (char *str, int16_t num, char *delim=0) |
uint32_t | fileSize () const |
uint32_t | firstCluster () const |
bool | getFilename (char *name) |
bool | isDir () const |
bool | isFile () const |
bool | isOpen () const |
bool | isSubDir () const |
bool | isRoot () const |
void | ls (Print *pr, uint8_t flags=0, uint8_t indent=0) |
void | ls (uint8_t flags=0) |
bool | mkdir (SdBaseFile *dir, const char *path, bool pFlag=true) |
bool | makeDir (SdBaseFile *dir, const char *path) |
bool | open (SdBaseFile *dirFile, uint16_t index, uint8_t oflag) |
bool | open (SdBaseFile *dirFile, const char *path, uint8_t oflag) |
bool | open (const char *path, uint8_t oflag=O_READ) |
bool | openNext (SdBaseFile *dirFile, uint8_t oflag) |
bool | openRoot (SdVolume *vol) |
int | peek () |
bool | printCreateDateTime (Print *pr) |
bool | printModifyDateTime (Print *pr) |
bool | printName () |
bool | printName (Print *pr) |
int16_t | read () |
int16_t | read (void *buf, uint16_t nbyte) |
int8_t | readDir (dir_t *dir) |
bool | remove () |
void | rewind () |
bool | rename (SdBaseFile *dirFile, const char *newPath) |
bool | rmdir () |
bool | rmDir () |
bool | rmRfStar () |
bool | seekCur (int32_t offset) |
bool | seekEnd (int32_t offset=0) |
bool | seekSet (uint32_t pos) |
bool | sync () |
bool | timestamp (SdBaseFile *file) |
bool | timestamp (uint8_t flag, uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second) |
uint8_t | type () const |
bool | truncate (uint32_t size) |
SdVolume * | volume () const |
int16_t | write (const void *buf, uint16_t nbyte) |
bool | openParent (SdBaseFile *dir) |
bool | addCluster () |
bool | addDirCluster () |
dir_t * | cacheDirEntry (uint8_t action) |
int8_t | lsPrintNext (Print *pr, uint8_t flags, uint8_t indent) |
bool | mkdir (SdBaseFile *parent, const uint8_t dname[11]) |
bool | open (SdBaseFile *dirFile, const uint8_t dname[11], uint8_t oflag) |
bool | openCachedEntry (uint8_t cacheIndex, uint8_t oflags) |
dir_t * | readDirCache () |
bool | contiguousRange (uint32_t &bgnBlock, uint32_t &endBlock) |
bool | createContiguous (SdBaseFile &dirFile, const char *path, uint32_t size) |
bool | dirEntry (dir_t &dir) |
bool | mkdir (SdBaseFile &dir, const char *path) |
bool | open (SdBaseFile &dirFile, const char *path, uint8_t oflag) |
bool | open (SdBaseFile &dirFile, const char *path) |
bool | open (SdBaseFile &dirFile, uint16_t index, uint8_t oflag) |
bool | openRoot (SdVolume &vol) |
int8_t | readDir (dir_t &dir) |
Static Public Member Functions | |
static SdBaseFile * | cwd () |
static void | dateTimeCallback (void(*dateTime)(uint16_t *date, uint16_t *time)) |
static void | dateTimeCallbackCancel () |
static void | dirName (const dir_t &dir, char *name) |
static void | printFatDate (uint16_t fatDate) |
static void | printFatDate (Print *pr, uint16_t fatDate) |
static void | printFatTime (uint16_t fatTime) |
static void | printFatTime (Print *pr, uint16_t fatTime) |
static bool | remove (SdBaseFile *dirFile, const char *path) |
static bool | make83Name (const char *str, uint8_t *name, const char **ptr) |
static void | printDirName (const dir_t &dir, uint8_t width, bool printSlash) |
static void | printDirName (Print *pr, const dir_t &dir, uint8_t width, bool printSlash) |
static void | dateTimeCallback (void(*dateTime)(uint16_t &date, uint16_t &time)) |
static bool | remove (SdBaseFile &dirFile, const char *path) |
Data Fields | |
bool | writeError |
uint8_t | flags_ |
uint8_t | fstate_ |
uint8_t | type_ |
uint32_t | curCluster_ |
uint32_t | curPosition_ |
uint32_t | dirBlock_ |
uint8_t | dirIndex_ |
uint32_t | fileSize_ |
uint32_t | firstCluster_ |
SdVolume * | vol_ |
Static Public Attributes | |
static SdBaseFile * | cwd_ |
static void(* | dateTime_ )(uint16_t *date, uint16_t *time) |
static uint8_t const | F_OFLAG = (O_ACCMODE | O_APPEND | O_SYNC) |
static uint8_t const | F_FILE_DIR_DIRTY = 0X80 |
Static Private Member Functions | |
static void | oldToNew (uint16_t *date, uint16_t *time) |
Static Private Attributes | |
static void(* | oldDateTime_ )(uint16_t &date, uint16_t &time) |
Friends | |
class | SdFat |
Base class for SdFile with Print and C++ streams.
SdBaseFile | ( | ) | [inline] |
Create an instance.
SdBaseFile | ( | const char * | path, |
uint8_t | oflag | ||
) |
~SdBaseFile | ( | ) | [inline] |
bool addCluster | ( | ) |
bool addDirCluster | ( | ) |
dir_t* cacheDirEntry | ( | uint8_t | action | ) |
void clearWriteError | ( | ) | [inline] |
Set writeError to zero
Reimplemented in SdFile.
bool close | ( | ) |
bool contiguousRange | ( | uint32_t * | bgnBlock, |
uint32_t * | endBlock | ||
) |
bool contiguousRange | ( | uint32_t & | bgnBlock, |
uint32_t & | endBlock | ||
) | [inline] |
[out] | bgnBlock | the first block address for the file. |
[out] | endBlock | the last block address for the file. |
bool createContiguous | ( | SdBaseFile * | dirFile, |
const char * | path, | ||
uint32_t | size | ||
) |
bool createContiguous | ( | SdBaseFile & | dirFile, |
const char * | path, | ||
uint32_t | size | ||
) | [inline] |
[in] | dirFile | The directory where the file will be created. |
[in] | path | A path with a valid DOS 8.3 file name. |
[in] | size | The desired file size. |
uint32_t curCluster | ( | ) | const [inline] |
uint32_t curPosition | ( | ) | const [inline] |
static SdBaseFile* cwd | ( | ) | [inline, static] |
static void dateTimeCallback | ( | void(*)(uint16_t *date, uint16_t *time) | dateTime | ) | [inline, static] |
Set the date/time callback function
[in] | dateTime | The user's call back function. The callback function is of the form: |
void dateTime(uint16_t* date, uint16_t* time) { uint16_t year; uint8_t month, day, hour, minute, second; // User gets date and time from GPS or real-time clock here // return date using FAT_DATE macro to format fields *date = FAT_DATE(year, month, day); // return time using FAT_TIME macro to format fields *time = FAT_TIME(hour, minute, second); }
Sets the function that is called when a file is created or when a file's directory entry is modified by sync(). All timestamps, access, creation, and modify, are set when a file is created. sync() maintains the last access date and last modify date/time.
See the timestamp() function.
static void dateTimeCallback | ( | void(*)(uint16_t &date, uint16_t &time) | dateTime | ) | [inline, static] |
[in] | dateTime | The user's call back function. |
static void dateTimeCallbackCancel | ( | ) | [inline, static] |
Cancel the date/time callback function.
[out] | dir | Location for return of the file's directory entry. |
bool exists | ( | const char * | name | ) |
int16_t fgets | ( | char * | str, |
int16_t | num, | ||
char * | delim = 0 |
||
) |
uint32_t fileSize | ( | ) | const [inline] |
uint32_t firstCluster | ( | ) | const [inline] |
bool getFilename | ( | char * | name | ) |
bool getWriteError | ( | ) | [inline] |
Reimplemented in SdFile.
bool isDir | ( | ) | const [inline] |
bool isFile | ( | ) | const [inline] |
bool isOpen | ( | ) | const [inline] |
bool isRoot | ( | ) | const [inline] |
bool isSubDir | ( | ) | const [inline] |
void ls | ( | Print * | pr, |
uint8_t | flags = 0 , |
||
uint8_t | indent = 0 |
||
) |
void ls | ( | uint8_t | flags = 0 | ) |
int8_t lsPrintNext | ( | Print * | pr, |
uint8_t | flags, | ||
uint8_t | indent | ||
) |
static bool make83Name | ( | const char * | str, |
uint8_t * | name, | ||
const char ** | ptr | ||
) | [static] |
bool makeDir | ( | SdBaseFile * | dir, |
const char * | path | ||
) | [inline] |
bool mkdir | ( | SdBaseFile * | dir, |
const char * | path, | ||
bool | pFlag = true |
||
) |
bool mkdir | ( | SdBaseFile * | parent, |
const uint8_t | dname[11] | ||
) |
bool mkdir | ( | SdBaseFile & | dir, |
const char * | path | ||
) | [inline] |
[in] | dir | An open SdFat instance for the directory that will contain the new directory. |
[in] | path | A path with a valid 8.3 DOS name for the new directory. |
static void oldToNew | ( | uint16_t * | date, |
uint16_t * | time | ||
) | [inline, static, private] |
bool open | ( | SdBaseFile * | dirFile, |
uint16_t | index, | ||
uint8_t | oflag | ||
) |
bool open | ( | SdBaseFile * | dirFile, |
const char * | path, | ||
uint8_t | oflag | ||
) |
bool open | ( | SdBaseFile * | dirFile, |
const uint8_t | dname[11], | ||
uint8_t | oflag | ||
) |
bool open | ( | SdBaseFile & | dirFile, |
const char * | path, | ||
uint8_t | oflag | ||
) | [inline] |
[in] | dirFile | An open SdFat instance for the directory containing the file to be opened. |
[in] | path | A path with a valid 8.3 DOS name for the file. |
[in] | oflag | Values for oflag are constructed by a bitwise-inclusive OR of flags O_READ, O_WRITE, O_TRUNC, and O_SYNC. |
bool open | ( | SdBaseFile & | dirFile, |
const char * | path | ||
) | [inline] |
[in] | dirFile | An open SdFat instance for the directory containing the file to be opened. |
[in] | path | A path with a valid 8.3 DOS name for a file to be opened. |
bool open | ( | SdBaseFile & | dirFile, |
uint16_t | index, | ||
uint8_t | oflag | ||
) | [inline] |
[in] | dirFile | An open SdFat instance for the directory. |
[in] | index | The index of the directory entry for the file to be opened. The value for index is (directory file position)/32. |
[in] | oflag | Values for oflag are constructed by a bitwise-inclusive OR of flags O_READ, O_WRITE, O_TRUNC, and O_SYNC. |
bool openCachedEntry | ( | uint8_t | cacheIndex, |
uint8_t | oflags | ||
) |
bool openNext | ( | SdBaseFile * | dirFile, |
uint8_t | oflag | ||
) |
bool openParent | ( | SdBaseFile * | dir | ) |
experimental don't use
[in] | vol | The FAT volume containing the root directory to be opened. |
int peek | ( | ) |
bool printCreateDateTime | ( | Print * | pr | ) |
static void printDirName | ( | const dir_t & | dir, |
uint8_t | width, | ||
bool | printSlash | ||
) | [static] |
static void printDirName | ( | Print * | pr, |
const dir_t & | dir, | ||
uint8_t | width, | ||
bool | printSlash | ||
) | [static] |
static void printFatDate | ( | uint16_t | fatDate | ) | [static] |
static void printFatDate | ( | Print * | pr, |
uint16_t | fatDate | ||
) | [static] |
static void printFatTime | ( | uint16_t | fatTime | ) | [static] |
static void printFatTime | ( | Print * | pr, |
uint16_t | fatTime | ||
) | [static] |
bool printModifyDateTime | ( | Print * | pr | ) |
bool printName | ( | ) |
bool printName | ( | Print * | pr | ) |
int16_t read | ( | ) |
int16_t read | ( | void * | buf, |
uint16_t | nbyte | ||
) |
[out] | dir | The dir_t struct that will receive the data. |
dir_t* readDirCache | ( | ) |
static bool remove | ( | SdBaseFile * | dirFile, |
const char * | path | ||
) | [static] |
bool remove | ( | ) |
static bool remove | ( | SdBaseFile & | dirFile, |
const char * | path | ||
) | [inline, static] |
[in] | dirFile | The directory that contains the file. |
[in] | path | The name of the file to be removed. |
bool rename | ( | SdBaseFile * | dirFile, |
const char * | newPath | ||
) |
void rewind | ( | ) | [inline] |
Set the file's current position to zero.
bool rmdir | ( | ) |
bool rmDir | ( | ) | [inline] |
bool rmRfStar | ( | ) |
bool seekCur | ( | int32_t | offset | ) | [inline] |
Set the files position to current position + pos. See seekSet().
[in] | offset | The new position in bytes from the current position. |
bool seekEnd | ( | int32_t | offset = 0 | ) | [inline] |
Set the files position to end-of-file + offset. See seekSet().
[in] | offset | The new position in bytes from end-of-file. |
bool seekSet | ( | uint32_t | pos | ) |
set position for streams
[out] | pos | struct with value for new position |
bool sync | ( | ) |
bool timestamp | ( | SdBaseFile * | file | ) |
bool timestamp | ( | uint8_t | flag, |
uint16_t | year, | ||
uint8_t | month, | ||
uint8_t | day, | ||
uint8_t | hour, | ||
uint8_t | minute, | ||
uint8_t | second | ||
) |
bool truncate | ( | uint32_t | size | ) |
uint8_t type | ( | ) | const [inline] |
friend class SdFat [friend] |
uint32_t curCluster_ |
uint32_t curPosition_ |
SdBaseFile* cwd_ [static] |
void(* dateTime_)(uint16_t *date, uint16_t *time) [static] |
uint32_t dirBlock_ |
uint8_t dirIndex_ |
uint8_t const F_FILE_DIR_DIRTY = 0X80 [static] |
uint32_t fileSize_ |
uint32_t firstCluster_ |
uint8_t flags_ |
uint8_t fstate_ |
void(* oldDateTime_)(uint16_t &date, uint16_t &time) [static, private] |
uint8_t type_ |
bool writeError |