mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
<>
Date:
Tue Mar 14 16:40:56 2017 +0000
Revision:
160:d5399cc887bb
Parent:
149:156823d33999
This updates the lib to the mbed lib v138

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 149:156823d33999 1 /* mbed Microcontroller Library
<> 149:156823d33999 2 * Copyright (c) 2006-2013 ARM Limited
<> 149:156823d33999 3 *
<> 149:156823d33999 4 * Licensed under the Apache License, Version 2.0 (the "License");
<> 149:156823d33999 5 * you may not use this file except in compliance with the License.
<> 149:156823d33999 6 * You may obtain a copy of the License at
<> 149:156823d33999 7 *
<> 149:156823d33999 8 * http://www.apache.org/licenses/LICENSE-2.0
<> 149:156823d33999 9 *
<> 149:156823d33999 10 * Unless required by applicable law or agreed to in writing, software
<> 149:156823d33999 11 * distributed under the License is distributed on an "AS IS" BASIS,
<> 149:156823d33999 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<> 149:156823d33999 13 * See the License for the specific language governing permissions and
<> 149:156823d33999 14 * limitations under the License.
<> 149:156823d33999 15 */
<> 149:156823d33999 16 #ifndef MBED_FILESYSTEMLIKE_H
<> 149:156823d33999 17 #define MBED_FILESYSTEMLIKE_H
<> 149:156823d33999 18
<> 149:156823d33999 19 #include "platform/platform.h"
<> 149:156823d33999 20
<> 149:156823d33999 21 #include "drivers/FileBase.h"
<> 149:156823d33999 22 #include "drivers/FileHandle.h"
<> 149:156823d33999 23 #include "drivers/DirHandle.h"
<> 149:156823d33999 24
<> 149:156823d33999 25 namespace mbed {
<> 149:156823d33999 26 /** \addtogroup drivers */
<> 149:156823d33999 27 /** @{*/
<> 149:156823d33999 28
<> 149:156823d33999 29 /** A filesystem-like object is one that can be used to open files
<> 149:156823d33999 30 * though it by fopen("/name/filename", mode)
<> 149:156823d33999 31 *
<> 149:156823d33999 32 * Implementations must define at least open (the default definitions
<> 149:156823d33999 33 * of the rest of the functions just return error values).
<> 149:156823d33999 34 *
<> 149:156823d33999 35 * @Note Synchronization level: Set by subclass
<> 149:156823d33999 36 */
<> 149:156823d33999 37 class FileSystemLike : public FileBase {
<> 149:156823d33999 38
<> 149:156823d33999 39 public:
<> 149:156823d33999 40 /** FileSystemLike constructor
<> 149:156823d33999 41 *
<> 149:156823d33999 42 * @param name The name to use for the filesystem.
<> 149:156823d33999 43 */
<> 160:d5399cc887bb 44 MBED_DEPRECATED_SINCE("mbed-os-5.4",
<> 160:d5399cc887bb 45 "The mbed 2 filesystem classes have been superseeded by the FileSystem api, "
<> 160:d5399cc887bb 46 "Replaced by FileSystem")
<> 149:156823d33999 47 FileSystemLike(const char *name);
<> 149:156823d33999 48
<> 149:156823d33999 49 virtual ~FileSystemLike();
<> 149:156823d33999 50
<> 160:d5399cc887bb 51 MBED_DEPRECATED_SINCE("mbed-os-5.4",
<> 160:d5399cc887bb 52 "The mbed 2 filesystem classes have been superseeded by the FileSystem api, "
<> 160:d5399cc887bb 53 "Replaced by FileSystem")
<> 149:156823d33999 54 static DirHandle *opendir();
<> 149:156823d33999 55 friend class BaseDirHandle;
<> 149:156823d33999 56
<> 149:156823d33999 57 /** Opens a file from the filesystem
<> 149:156823d33999 58 *
<> 149:156823d33999 59 * @param filename The name of the file to open.
<> 149:156823d33999 60 * @param flags One of O_RDONLY, O_WRONLY, or O_RDWR, OR'd with
<> 149:156823d33999 61 * zero or more of O_CREAT, O_TRUNC, or O_APPEND.
<> 149:156823d33999 62 *
<> 149:156823d33999 63 * @returns
<> 149:156823d33999 64 * A pointer to a FileHandle object representing the
<> 149:156823d33999 65 * file on success, or NULL on failure.
<> 149:156823d33999 66 */
<> 149:156823d33999 67 virtual FileHandle *open(const char *filename, int flags) = 0;
<> 149:156823d33999 68
<> 149:156823d33999 69 /** Remove a file from the filesystem.
<> 149:156823d33999 70 *
<> 149:156823d33999 71 * @param filename the name of the file to remove.
<> 149:156823d33999 72 * @param returns 0 on success, -1 on failure.
<> 149:156823d33999 73 */
<> 149:156823d33999 74 virtual int remove(const char *filename) { (void) filename; return -1; };
<> 149:156823d33999 75
<> 149:156823d33999 76 /** Rename a file in the filesystem.
<> 149:156823d33999 77 *
<> 149:156823d33999 78 * @param oldname the name of the file to rename.
<> 149:156823d33999 79 * @param newname the name to rename it to.
<> 149:156823d33999 80 *
<> 149:156823d33999 81 * @returns
<> 149:156823d33999 82 * 0 on success,
<> 149:156823d33999 83 * -1 on failure.
<> 149:156823d33999 84 */
<> 149:156823d33999 85 virtual int rename(const char *oldname, const char *newname) { (void) oldname, (void) newname; return -1; };
<> 149:156823d33999 86
<> 149:156823d33999 87 /** Opens a directory in the filesystem and returns a DirHandle
<> 149:156823d33999 88 * representing the directory stream.
<> 149:156823d33999 89 *
<> 149:156823d33999 90 * @param name The name of the directory to open.
<> 149:156823d33999 91 *
<> 149:156823d33999 92 * @returns
<> 149:156823d33999 93 * A DirHandle representing the directory stream, or
<> 149:156823d33999 94 * NULL on failure.
<> 149:156823d33999 95 */
<> 149:156823d33999 96 virtual DirHandle *opendir(const char *name) { (void) name; return NULL; };
<> 149:156823d33999 97
<> 149:156823d33999 98 /** Creates a directory in the filesystem.
<> 149:156823d33999 99 *
<> 149:156823d33999 100 * @param name The name of the directory to create.
<> 149:156823d33999 101 * @param mode The permissions to create the directory with.
<> 149:156823d33999 102 *
<> 149:156823d33999 103 * @returns
<> 149:156823d33999 104 * 0 on success,
<> 149:156823d33999 105 * -1 on failure.
<> 149:156823d33999 106 */
<> 149:156823d33999 107 virtual int mkdir(const char *name, mode_t mode) { (void) name, (void) mode; return -1; }
<> 149:156823d33999 108
<> 160:d5399cc887bb 109 /** Store information about file in stat structure
<> 160:d5399cc887bb 110 *
<> 160:d5399cc887bb 111 * @param name The name of the file to find information about
<> 160:d5399cc887bb 112 * @param st The stat buffer to write to
<> 160:d5399cc887bb 113 * @returns
<> 160:d5399cc887bb 114 * 0 on success or un-needed,
<> 160:d5399cc887bb 115 * -1 on error
<> 160:d5399cc887bb 116 */
<> 160:d5399cc887bb 117 virtual int stat(const char *name, struct stat *st) { return -1; };
<> 149:156823d33999 118 };
<> 149:156823d33999 119
<> 149:156823d33999 120 } // namespace mbed
<> 149:156823d33999 121
<> 149:156823d33999 122 #endif
<> 149:156823d33999 123
<> 149:156823d33999 124 /** @}*/