Repetier-Firmware  0.91
SdBaseFile Class Reference

Base class for SdFile with Print and C++ streams. More...

#include <SdFat.h>

Inheritance diagram for SdBaseFile:
SdFile

Public Member Functions

 SdBaseFile ()
 SdBaseFile (const char *path, uint8_t oflag)
bool getWriteError ()
void clearWriteError ()
void getpos (FatPos_t *pos)
void setpos (FatPos_t *pos)
uint32_t available ()
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)
uint8_t lfn_checksum (const unsigned char *pFCBName)
bool openParentReturnFile (SdBaseFile *dirFile, const char *path, uint8_t *dname, SdBaseFile *newParent, boolean bMakeDirs)
bool isDir () const
bool isFile () const
bool isOpen () const
bool isSubDir () const
bool isRoot () const
void ls (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)
int8_t readDir (dir_t &dir, char *longfilename)
int peek ()
bool printCreateDateTime ()
bool printModifyDateTime ()
int printField (int16_t value, char term)
int printField (uint16_t value, char term)
int printField (int32_t value, char term)
int printField (uint32_t value, char term)
bool printName ()
int16_t read ()
int read (void *buf, size_t nbyte)
int8_t readDir (dir_t *dir, char *longfilename)
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)
SdVolumevolume () const
int write (const void *buf, size_t nbyte)
bool openParent (SdBaseFile *dir)
bool addCluster ()
cache_taddDirCluster ()
dir_tcacheDirEntry (uint8_t action)
int8_t lsPrintNext (uint8_t flags, uint8_t indent)
bool mkdir (SdBaseFile *parent, const uint8_t *dname)
bool open (SdBaseFile *dirFile, const uint8_t *dname, uint8_t oflag, bool bDir)
bool openCachedEntry (uint8_t cacheIndex, uint8_t oflags)
dir_treadDirCache ()
dir_treadDirCacheSpecial ()
dir_tgetLongFilename (dir_t *dir, char *longFilename, int8_t cVFATNeeded, uint32_t *pwIndexPos)
bool findSpace (dir_t *dir, int8_t cVFATNeeded, int8_t *pcVFATFound, uint32_t *pwIndexPos)
uint8_t lsRecursive (SdBaseFile *parent, uint8_t level, char *findFilename, SdBaseFile *pParentFound)
bool setDirSize ()
bool contiguousRange (uint32_t &bgnBlock, uint32_t &endBlock) __attribute__((error("use contiguousRange(&bgnBlock
bool createContiguous (SdBaseFile &dirFile, const char *path, uint32_t size) __attribute__((error("use createContiguous(&bgnBlock
bool dirEntry (dir_t &dir) __attribute__((error("use dirEntry(&dir)")))
bool mkdir (SdBaseFile &dir, const char *path) __attribute__((error("use mkdir(&dir
bool open (SdBaseFile &dirFile, const char *path, uint8_t oflag) __attribute__((error("use open(&dirFile
bool open (SdBaseFile &dirFile, const char *path) __attribute__((error("use open(&dirFile
bool open (SdBaseFile &dirFile, uint16_t index, uint8_t oflag) __attribute__((error("use open(&dirFile
bool openRoot (SdVolume &vol) __attribute__((error("use openRoot(&vol)")))
int8_t readDir (dir_t &dir) __attribute__((error("use readDir(&dir)")))

Static Public Member Functions

static SdBaseFilecwd ()
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 printFatTime (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 dateTimeCallback (void(*dateTime)(uint16_t &date, uint16_t &time)) __attribute__((error("use void dateTimeCallback(""void (*dateTime)(uint16_t* date
static bool remove (SdBaseFile &dirFile, const char *path) __attribute__((error("use remove(&dirFile

Data Fields

bool writeError
uint8_t flags_
uint8_t fstate_
uint8_t type_
uint8_t dirIndex_
SdVolumevol_
uint32_t curCluster_
uint32_t curPosition_
uint32_t dirBlock_
uint32_t fileSize_
uint32_t firstCluster_
char * pathend
bool & endBlock
static void uint16_t * time
bool path
bool oflag
bool O_RDWR
bool index
static bool path

Static Public Attributes

static SdBaseFilecwd_
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

Friends

class SdFat

Detailed Description

Base class for SdFile with Print and C++ streams.


Constructor & Destructor Documentation

SdBaseFile ( ) [inline]

Create an instance.

SdBaseFile ( const char *  path,
uint8_t  oflag 
)

Member Function Documentation

bool addCluster ( )
uint32_t available ( void  ) [inline]
Returns:
number of bytes available from yhe current position to EOF
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 
)
bool createContiguous ( SdBaseFile dirFile,
const char *  path,
uint32_t  size 
)
bool createContiguous ( SdBaseFile dirFile,
const char *  path,
uint32_t  size 
)
uint32_t curCluster ( ) const [inline]
Returns:
The current cluster number for a file or directory.
uint32_t curPosition ( ) const [inline]
Returns:
The current position for a file or directory.
static SdBaseFile* cwd ( ) [inline, static]
Returns:
Current working directory
static void dateTimeCallback ( void(*)(uint16_t *date, uint16_t *time dateTime) [inline, static]

Set the date/time callback function

Parameters:
[in]dateTimeThe 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) [static]
static void dateTimeCallbackCancel ( ) [inline, static]

Cancel the date/time callback function.

bool dirEntry ( dir_t dir)
bool dirEntry ( dir_t dir)
static void dirName ( const dir_t dir,
char *  name 
) [static]
bool exists ( const char *  name)
int16_t fgets ( char *  str,
int16_t  num,
char *  delim = 0 
)
uint32_t fileSize ( ) const [inline]
Returns:
The total number of bytes in a file or directory.
bool findSpace ( dir_t dir,
int8_t  cVFATNeeded,
int8_t *  pcVFATFound,
uint32_t *  pwIndexPos 
)
uint32_t firstCluster ( ) const [inline]
Returns:
The first cluster number for a file or directory.
bool getFilename ( char *  name)
dir_t* getLongFilename ( dir_t dir,
char *  longFilename,
int8_t  cVFATNeeded,
uint32_t *  pwIndexPos 
)
void getpos ( FatPos_t pos)

get position for streams

Parameters:
[out]posstruct to receive position
bool getWriteError ( ) [inline]
Returns:
value of writeError

Reimplemented in SdFile.

bool isDir ( ) const [inline]
Returns:
True if this is a directory else false.
bool isFile ( ) const [inline]
Returns:
True if this is a normal file else false.
bool isOpen ( ) const [inline]
Returns:
True if this is an open file/directory else false.
bool isRoot ( ) const [inline]
Returns:
True if this is the root directory.
bool isSubDir ( ) const [inline]
Returns:
True if this is a subdirectory else false.
uint8_t lfn_checksum ( const unsigned char *  pFCBName)
void ls ( uint8_t  flags = 0,
uint8_t  indent = 0 
)
void ls ( uint8_t  flags = 0)
int8_t lsPrintNext ( uint8_t  flags,
uint8_t  indent 
)
uint8_t lsRecursive ( SdBaseFile parent,
uint8_t  level,
char *  findFilename,
SdBaseFile pParentFound 
)
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 
)
bool mkdir ( 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 open ( SdBaseFile dirFile,
const uint8_t *  dname,
uint8_t  oflag,
bool  bDir 
)
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 openCachedEntry ( uint8_t  cacheIndex,
uint8_t  oflags 
)
bool openNext ( SdBaseFile dirFile,
uint8_t  oflag 
)
bool openParent ( SdBaseFile dir)

experimental don't use

bool openParentReturnFile ( SdBaseFile dirFile,
const char *  path,
uint8_t *  dname,
SdBaseFile newParent,
boolean  bMakeDirs 
)
bool openRoot ( SdVolume vol)
bool openRoot ( SdVolume vol)
int peek ( )
static void printDirName ( const dir_t dir,
uint8_t  width,
bool  printSlash 
) [static]
static void printFatDate ( uint16_t  fatDate) [static]
static void printFatTime ( uint16_t  fatTime) [static]
int printField ( int16_t  value,
char  term 
)
int printField ( uint16_t  value,
char  term 
)
int printField ( int32_t  value,
char  term 
)
int printField ( uint32_t  value,
char  term 
)
bool printName ( )
int16_t read ( )
int read ( void *  buf,
size_t  nbyte 
)
int8_t readDir ( dir_t dir,
char *  longfilename 
) [inline]
int8_t readDir ( dir_t dir,
char *  longfilename 
)
int8_t readDir ( dir_t dir)
static bool remove ( SdBaseFile dirFile,
const char *  path 
) [static]
bool remove ( )
static bool remove ( SdBaseFile dirFile,
const char *  path 
) [static]
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().

Parameters:
[in]offsetThe new position in bytes from the current position.
Returns:
true for success or false for failure.
bool seekEnd ( int32_t  offset = 0) [inline]

Set the files position to end-of-file + offset. See seekSet().

Parameters:
[in]offsetThe new position in bytes from end-of-file.
Returns:
true for success or false for failure.
bool seekSet ( uint32_t  pos)
bool setDirSize ( )
void setpos ( FatPos_t pos)

set position for streams

Parameters:
[out]posstruct 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]

Type of file. You should use isFile() or isDir() instead of type() if possible.

Returns:
The file or directory type.
SdVolume* volume ( ) const [inline]
Returns:
SdVolume that contains this file.
int write ( const void *  buf,
size_t  nbyte 
)

Reimplemented in SdFile.


Friends And Related Function Documentation

friend class SdFat [friend]

Field Documentation

uint32_t curCluster_
uint32_t curPosition_
SdBaseFile* cwd_ [static]
void(* dateTime_)(uint16_t *date, uint16_t *time) [static]
uint32_t dirBlock_
uint8_t dirIndex_
bool & endBlock
uint8_t const F_FILE_DIR_DIRTY = 0X80 [static]
uint8_t const F_OFLAG = (O_ACCMODE | O_APPEND | O_SYNC) [static]
uint32_t fileSize_
uint32_t firstCluster_
uint8_t flags_
uint8_t fstate_
bool index
bool O_RDWR
bool oflag
bool path
bool path
char* pathend
void uint16_t* time
uint8_t type_
bool writeError

writeError is set to true if an error occurs during a write(). Set writeError to false before calling print() and/or write() and check for true after calls to print() and/or write().


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Typedefs Friends Defines