Mbed SDK for XRange SX1272 LoRa module
Dependents: XRangePingPong XRange-LoRaWAN-lmic-app lora-transceiver
SX1272 LoRa RF module
https://www.netblocks.eu/xrange-sx1272-lora-datasheet/
api/FileSystemLike.h@339:ac6f3fd999f3, 2016-01-07 (annotated)
- Committer:
- netblocks
- Date:
- Thu Jan 07 13:01:25 2016 +0000
- Revision:
- 339:ac6f3fd999f3
- Parent:
- 336:1e18a06a987b
HSE_VALUE set for XTAL 16Mhz
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dudmuck | 336:1e18a06a987b | 1 | /* mbed Microcontroller Library |
dudmuck | 336:1e18a06a987b | 2 | * Copyright (c) 2006-2013 ARM Limited |
dudmuck | 336:1e18a06a987b | 3 | * |
dudmuck | 336:1e18a06a987b | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
dudmuck | 336:1e18a06a987b | 5 | * you may not use this file except in compliance with the License. |
dudmuck | 336:1e18a06a987b | 6 | * You may obtain a copy of the License at |
dudmuck | 336:1e18a06a987b | 7 | * |
dudmuck | 336:1e18a06a987b | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
dudmuck | 336:1e18a06a987b | 9 | * |
dudmuck | 336:1e18a06a987b | 10 | * Unless required by applicable law or agreed to in writing, software |
dudmuck | 336:1e18a06a987b | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
dudmuck | 336:1e18a06a987b | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
dudmuck | 336:1e18a06a987b | 13 | * See the License for the specific language governing permissions and |
dudmuck | 336:1e18a06a987b | 14 | * limitations under the License. |
dudmuck | 336:1e18a06a987b | 15 | */ |
dudmuck | 336:1e18a06a987b | 16 | #ifndef MBED_FILESYSTEMLIKE_H |
dudmuck | 336:1e18a06a987b | 17 | #define MBED_FILESYSTEMLIKE_H |
dudmuck | 336:1e18a06a987b | 18 | |
dudmuck | 336:1e18a06a987b | 19 | #include "platform.h" |
dudmuck | 336:1e18a06a987b | 20 | |
dudmuck | 336:1e18a06a987b | 21 | #include "FileBase.h" |
dudmuck | 336:1e18a06a987b | 22 | #include "FileHandle.h" |
dudmuck | 336:1e18a06a987b | 23 | #include "DirHandle.h" |
dudmuck | 336:1e18a06a987b | 24 | |
dudmuck | 336:1e18a06a987b | 25 | namespace mbed { |
dudmuck | 336:1e18a06a987b | 26 | |
dudmuck | 336:1e18a06a987b | 27 | /** A filesystem-like object is one that can be used to open files |
dudmuck | 336:1e18a06a987b | 28 | * though it by fopen("/name/filename", mode) |
dudmuck | 336:1e18a06a987b | 29 | * |
dudmuck | 336:1e18a06a987b | 30 | * Implementations must define at least open (the default definitions |
dudmuck | 336:1e18a06a987b | 31 | * of the rest of the functions just return error values). |
dudmuck | 336:1e18a06a987b | 32 | */ |
dudmuck | 336:1e18a06a987b | 33 | class FileSystemLike : public FileBase { |
dudmuck | 336:1e18a06a987b | 34 | |
dudmuck | 336:1e18a06a987b | 35 | public: |
dudmuck | 336:1e18a06a987b | 36 | /** FileSystemLike constructor |
dudmuck | 336:1e18a06a987b | 37 | * |
dudmuck | 336:1e18a06a987b | 38 | * @param name The name to use for the filesystem. |
dudmuck | 336:1e18a06a987b | 39 | */ |
dudmuck | 336:1e18a06a987b | 40 | FileSystemLike(const char *name); |
dudmuck | 336:1e18a06a987b | 41 | |
dudmuck | 336:1e18a06a987b | 42 | virtual ~FileSystemLike(); |
dudmuck | 336:1e18a06a987b | 43 | |
dudmuck | 336:1e18a06a987b | 44 | static DirHandle *opendir(); |
dudmuck | 336:1e18a06a987b | 45 | friend class BaseDirHandle; |
dudmuck | 336:1e18a06a987b | 46 | |
dudmuck | 336:1e18a06a987b | 47 | /** Opens a file from the filesystem |
dudmuck | 336:1e18a06a987b | 48 | * |
dudmuck | 336:1e18a06a987b | 49 | * @param filename The name of the file to open. |
dudmuck | 336:1e18a06a987b | 50 | * @param flags One of O_RDONLY, O_WRONLY, or O_RDWR, OR'd with |
dudmuck | 336:1e18a06a987b | 51 | * zero or more of O_CREAT, O_TRUNC, or O_APPEND. |
dudmuck | 336:1e18a06a987b | 52 | * |
dudmuck | 336:1e18a06a987b | 53 | * @returns |
dudmuck | 336:1e18a06a987b | 54 | * A pointer to a FileHandle object representing the |
dudmuck | 336:1e18a06a987b | 55 | * file on success, or NULL on failure. |
dudmuck | 336:1e18a06a987b | 56 | */ |
dudmuck | 336:1e18a06a987b | 57 | virtual FileHandle *open(const char *filename, int flags) = 0; |
dudmuck | 336:1e18a06a987b | 58 | |
dudmuck | 336:1e18a06a987b | 59 | /** Remove a file from the filesystem. |
dudmuck | 336:1e18a06a987b | 60 | * |
dudmuck | 336:1e18a06a987b | 61 | * @param filename the name of the file to remove. |
dudmuck | 336:1e18a06a987b | 62 | * @param returns 0 on success, -1 on failure. |
dudmuck | 336:1e18a06a987b | 63 | */ |
dudmuck | 336:1e18a06a987b | 64 | virtual int remove(const char *filename) { return -1; }; |
dudmuck | 336:1e18a06a987b | 65 | |
dudmuck | 336:1e18a06a987b | 66 | /** Rename a file in the filesystem. |
dudmuck | 336:1e18a06a987b | 67 | * |
dudmuck | 336:1e18a06a987b | 68 | * @param oldname the name of the file to rename. |
dudmuck | 336:1e18a06a987b | 69 | * @param newname the name to rename it to. |
dudmuck | 336:1e18a06a987b | 70 | * |
dudmuck | 336:1e18a06a987b | 71 | * @returns |
dudmuck | 336:1e18a06a987b | 72 | * 0 on success, |
dudmuck | 336:1e18a06a987b | 73 | * -1 on failure. |
dudmuck | 336:1e18a06a987b | 74 | */ |
dudmuck | 336:1e18a06a987b | 75 | virtual int rename(const char *oldname, const char *newname) { return -1; }; |
dudmuck | 336:1e18a06a987b | 76 | |
dudmuck | 336:1e18a06a987b | 77 | /** Opens a directory in the filesystem and returns a DirHandle |
dudmuck | 336:1e18a06a987b | 78 | * representing the directory stream. |
dudmuck | 336:1e18a06a987b | 79 | * |
dudmuck | 336:1e18a06a987b | 80 | * @param name The name of the directory to open. |
dudmuck | 336:1e18a06a987b | 81 | * |
dudmuck | 336:1e18a06a987b | 82 | * @returns |
dudmuck | 336:1e18a06a987b | 83 | * A DirHandle representing the directory stream, or |
dudmuck | 336:1e18a06a987b | 84 | * NULL on failure. |
dudmuck | 336:1e18a06a987b | 85 | */ |
dudmuck | 336:1e18a06a987b | 86 | virtual DirHandle *opendir(const char *name) { return NULL; }; |
dudmuck | 336:1e18a06a987b | 87 | |
dudmuck | 336:1e18a06a987b | 88 | /** Creates a directory in the filesystem. |
dudmuck | 336:1e18a06a987b | 89 | * |
dudmuck | 336:1e18a06a987b | 90 | * @param name The name of the directory to create. |
dudmuck | 336:1e18a06a987b | 91 | * @param mode The permissions to create the directory with. |
dudmuck | 336:1e18a06a987b | 92 | * |
dudmuck | 336:1e18a06a987b | 93 | * @returns |
dudmuck | 336:1e18a06a987b | 94 | * 0 on success, |
dudmuck | 336:1e18a06a987b | 95 | * -1 on failure. |
dudmuck | 336:1e18a06a987b | 96 | */ |
dudmuck | 336:1e18a06a987b | 97 | virtual int mkdir(const char *name, mode_t mode) { return -1; } |
dudmuck | 336:1e18a06a987b | 98 | |
dudmuck | 336:1e18a06a987b | 99 | // TODO other filesystem functions (mkdir, rm, rn, ls etc) |
dudmuck | 336:1e18a06a987b | 100 | }; |
dudmuck | 336:1e18a06a987b | 101 | |
dudmuck | 336:1e18a06a987b | 102 | } // namespace mbed |
dudmuck | 336:1e18a06a987b | 103 | |
dudmuck | 336:1e18a06a987b | 104 | #endif |