
Kaif Kutchwala 201267448 ELEC2645 Project
Dependencies: mbed
SDFileSystem/FATFileSystem/FATFileHandle.h@31:e1f80d181779, 2020-05-26 (annotated)
- Committer:
- KaifK
- Date:
- Tue May 26 15:50:46 2020 +0000
- Revision:
- 31:e1f80d181779
- Parent:
- 21:d5b1160f349f
Final Submission. I have read and agreed with Statement of Academic Integrity.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
KaifK | 21:d5b1160f349f | 1 | /* mbed Microcontroller Library |
KaifK | 21:d5b1160f349f | 2 | * Copyright (c) 2006-2012 ARM Limited |
KaifK | 21:d5b1160f349f | 3 | * |
KaifK | 21:d5b1160f349f | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
KaifK | 21:d5b1160f349f | 5 | * of this software and associated documentation files (the "Software"), to deal |
KaifK | 21:d5b1160f349f | 6 | * in the Software without restriction, including without limitation the rights |
KaifK | 21:d5b1160f349f | 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
KaifK | 21:d5b1160f349f | 8 | * copies of the Software, and to permit persons to whom the Software is |
KaifK | 21:d5b1160f349f | 9 | * furnished to do so, subject to the following conditions: |
KaifK | 21:d5b1160f349f | 10 | * |
KaifK | 21:d5b1160f349f | 11 | * The above copyright notice and this permission notice shall be included in |
KaifK | 21:d5b1160f349f | 12 | * all copies or substantial portions of the Software. |
KaifK | 21:d5b1160f349f | 13 | * |
KaifK | 21:d5b1160f349f | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
KaifK | 21:d5b1160f349f | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
KaifK | 21:d5b1160f349f | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
KaifK | 21:d5b1160f349f | 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
KaifK | 21:d5b1160f349f | 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
KaifK | 21:d5b1160f349f | 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
KaifK | 21:d5b1160f349f | 20 | * SOFTWARE. |
KaifK | 21:d5b1160f349f | 21 | */ |
KaifK | 21:d5b1160f349f | 22 | #ifndef MBED_FATFILEHANDLE_H |
KaifK | 21:d5b1160f349f | 23 | #define MBED_FATFILEHANDLE_H |
KaifK | 21:d5b1160f349f | 24 | |
KaifK | 21:d5b1160f349f | 25 | #include "FileHandle.h" |
KaifK | 21:d5b1160f349f | 26 | |
KaifK | 21:d5b1160f349f | 27 | using namespace mbed; |
KaifK | 21:d5b1160f349f | 28 | |
KaifK | 21:d5b1160f349f | 29 | class FATFileHandle : public FileHandle { |
KaifK | 21:d5b1160f349f | 30 | public: |
KaifK | 21:d5b1160f349f | 31 | |
KaifK | 21:d5b1160f349f | 32 | FATFileHandle(FIL fh); |
KaifK | 21:d5b1160f349f | 33 | virtual int close(); |
KaifK | 21:d5b1160f349f | 34 | virtual ssize_t write(const void* buffer, size_t length); |
KaifK | 21:d5b1160f349f | 35 | virtual ssize_t read(void* buffer, size_t length); |
KaifK | 21:d5b1160f349f | 36 | virtual int isatty(); |
KaifK | 21:d5b1160f349f | 37 | virtual off_t lseek(off_t position, int whence); |
KaifK | 21:d5b1160f349f | 38 | virtual int fsync(); |
KaifK | 21:d5b1160f349f | 39 | virtual off_t flen(); |
KaifK | 21:d5b1160f349f | 40 | |
KaifK | 21:d5b1160f349f | 41 | virtual off_t seek(off_t position, int whence) { return lseek(position, whence); } |
KaifK | 21:d5b1160f349f | 42 | virtual off_t size() { return flen(); } |
KaifK | 21:d5b1160f349f | 43 | |
KaifK | 21:d5b1160f349f | 44 | protected: |
KaifK | 21:d5b1160f349f | 45 | |
KaifK | 21:d5b1160f349f | 46 | FIL _fh; |
KaifK | 21:d5b1160f349f | 47 | |
KaifK | 21:d5b1160f349f | 48 | }; |
KaifK | 21:d5b1160f349f | 49 | |
KaifK | 21:d5b1160f349f | 50 | #endif |