libiec61850  1.2.0
hal_filesystem.h
Go to the documentation of this file.
1 /*
2  * filesystem_hal.h
3  *
4  * Copyright 2014 Michael Zillgith
5  *
6  * This file is part of libIEC61850.
7  *
8  * libIEC61850 is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * libIEC61850 is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with libIEC61850. If not, see <http://www.gnu.org/licenses/>.
20  *
21  * See COPYING file for the complete license text.
22  */
23 
24 #ifndef FILESYSTEM_HAL_H_
25 #define FILESYSTEM_HAL_H_
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
42 typedef void* FileHandle;
43 typedef struct sDirectoryHandle* DirectoryHandle;
44 
45 #ifndef CONFIG_SYSTEM_FILE_SEPARATOR
46 #define CONFIG_SYSTEM_FILE_SEPARATOR '/'
47 #endif
48 
58 FileHandle
59 FileSystem_openFile(char* pathName, bool readWrite);
60 
75 int
76 FileSystem_readFile(FileHandle handle, uint8_t* buffer, int maxSize);
77 
87 int
88 FileSystem_writeFile(FileHandle handle, uint8_t* buffer, int size);
89 
95 void
96 FileSystem_closeFile(FileHandle handle);
97 
111 bool
112 FileSystem_getFileInfo(char* filename, uint32_t* fileSize, uint64_t* lastModificationTimestamp);
113 
121 bool
122 FileSystem_deleteFile(char* filename);
123 
132 bool
133 FileSystem_renameFile(char* oldFilename, char* newFilename);
134 
142 DirectoryHandle
143 FileSystem_openDirectory(char* directoryName);
144 
157 char*
158 FileSystem_readDirectory(DirectoryHandle directory, bool* isDirectory);
159 
160 
166 void
167 FileSystem_closeDirectory(DirectoryHandle directory);
168 
178 void
179 FileSystem_setBasePath(char* basePath);
180 
185 #ifdef __cplusplus
186 }
187 #endif
188 
189 #endif /* FILESYSTEM_HAL_H_ */
DirectoryHandle FileSystem_openDirectory(char *directoryName)
open the directoy with the specified name
void * FileHandle
Definition: hal_filesystem.h:42
bool FileSystem_getFileInfo(char *filename, uint32_t *fileSize, uint64_t *lastModificationTimestamp)
return attributes of the given file
struct sDirectoryHandle * DirectoryHandle
Definition: hal_filesystem.h:43
bool FileSystem_renameFile(char *oldFilename, char *newFilename)
rename a file
void FileSystem_setBasePath(char *basePath)
set local file system base path for the MMS VMD
void FileSystem_closeFile(FileHandle handle)
close an open file
bool FileSystem_deleteFile(char *filename)
delete a file
int FileSystem_writeFile(FileHandle handle, uint8_t *buffer, int size)
write to an open file
char * FileSystem_readDirectory(DirectoryHandle directory, bool *isDirectory)
read the next directory entry
int FileSystem_readFile(FileHandle handle, uint8_t *buffer, int maxSize)
read from an open file
void FileSystem_closeDirectory(DirectoryHandle directory)
close a directory
FileHandle FileSystem_openFile(char *pathName, bool readWrite)
open a file