libiec61850  1.2.0
Macros | Typedefs | Functions
Interface to the native file system (optional)

Macros

#define CONFIG_SYSTEM_FILE_SEPARATOR   '/'
 

Typedefs

typedef void * FileHandle
 
typedef struct sDirectoryHandle * DirectoryHandle
 

Functions

FileHandle FileSystem_openFile (char *pathName, bool readWrite)
 open a file More...
 
int FileSystem_readFile (FileHandle handle, uint8_t *buffer, int maxSize)
 read from an open file More...
 
int FileSystem_writeFile (FileHandle handle, uint8_t *buffer, int size)
 write to an open file More...
 
void FileSystem_closeFile (FileHandle handle)
 close an open file More...
 
bool FileSystem_getFileInfo (char *filename, uint32_t *fileSize, uint64_t *lastModificationTimestamp)
 return attributes of the given file More...
 
bool FileSystem_deleteFile (char *filename)
 delete a file More...
 
bool FileSystem_renameFile (char *oldFilename, char *newFilename)
 rename a file More...
 
DirectoryHandle FileSystem_openDirectory (char *directoryName)
 open the directoy with the specified name More...
 
char * FileSystem_readDirectory (DirectoryHandle directory, bool *isDirectory)
 read the next directory entry More...
 
void FileSystem_closeDirectory (DirectoryHandle directory)
 close a directory More...
 
void FileSystem_setBasePath (char *basePath)
 set local file system base path for the MMS VMD More...
 

Detailed Description

Macro Definition Documentation

#define CONFIG_SYSTEM_FILE_SEPARATOR   '/'

Typedef Documentation

typedef struct sDirectoryHandle* DirectoryHandle
typedef void* FileHandle

Function Documentation

void FileSystem_closeDirectory ( DirectoryHandle  directory)

close a directory

Parameters
directorythe handle to identify the directory
void FileSystem_closeFile ( FileHandle  handle)

close an open file

Parameters
handlethe file handle to identify the file
bool FileSystem_deleteFile ( char *  filename)

delete a file

Parameters
pathNamefull name (path + filename) of the file
Returns
true on success, false on error
bool FileSystem_getFileInfo ( char *  filename,
uint32_t *  fileSize,
uint64_t *  lastModificationTimestamp 
)

return attributes of the given file

This function is used by the MMS layer to determine basic file attributes. The size of the file has to be returned in bytes. The timestamp of the last modification has to be returned as milliseconds since Unix epoch - or 0 if this function is not supported.

Parameters
pathNamefull name (path + filename) of the file
fileSizea pointer where to store the file size
lastModificationTimestampis used to store the timestamp of last modification of the file
Returns
true if file exists, false if not
DirectoryHandle FileSystem_openDirectory ( char *  directoryName)

open the directoy with the specified name

Parameters
directoryName
Returns
a handle for the opened directory to be used in subsequent calls to identify the directory
FileHandle FileSystem_openFile ( char *  pathName,
bool  readWrite 
)

open a file

Parameters
pathNamefull name (path + filename) of the file
readWritetrue opens the file with read and write access - false opens for read access only
Returns
a handle for the file. Has to be used by subsequent calls to file functions to identify the file or NULL if opening fails
char* FileSystem_readDirectory ( DirectoryHandle  directory,
bool *  isDirectory 
)

read the next directory entry

This function returns the next directory entry. The entry is only a valid pointer as long as the FileSystem_closeDirectory or another FileSystem_readDirectory function is not called for the given DirectoryHandle.

Parameters
directorythe handle to identify the directory
isDirectoryreturn value that indicates if the directory entry is itself a directory (true)
Returns
the name of the directory entry
int FileSystem_readFile ( FileHandle  handle,
uint8_t *  buffer,
int  maxSize 
)

read from an open file

This function will read the next block of the file. The maximum number of bytes to read is given. A call to this function will move the file position by the number of bytes read. If the file position reaches the end of file then subsequent calls of this function shall return 0.

Parameters
handlethe file handle to identify the file
bufferthe buffer to write the read data
maxSizemaximum number of bytes to read
Returns
the number of bytes actually read
bool FileSystem_renameFile ( char *  oldFilename,
char *  newFilename 
)

rename a file

Parameters
oldFileNamecurrent full name (path + filename) of the file
newFileNamenew full name (path + filename) of the file
Returns
true on success, false on error
void FileSystem_setBasePath ( char *  basePath)

set local file system base path for the MMS VMD

NOTE: the meaning of this functions is platform specific. It was introduced to simplify the configuration of the VMD base path at runtime. It may not be supported on all platform. Also it is not called by the MMS protocol stack.

Parameters
basePaththe local base path of the MMS VMD
int FileSystem_writeFile ( FileHandle  handle,
uint8_t *  buffer,
int  size 
)

write to an open file

Parameters
handlethe file handle to identify the file
bufferthe buffer with the data to write
sizethe number of bytes to write
Returns
the number of bytes actually written