diff options
author | Cristian Maglie <c.maglie@bug.st> | 2013-06-07 17:39:03 +0200 |
---|---|---|
committer | Cristian Maglie <c.maglie@bug.st> | 2013-06-07 17:39:03 +0200 |
commit | 842a235ec4352b4d4d040743a87bc7b69daef4f9 (patch) | |
tree | 09d15fa176de76e78fd239c4cc007d76aef96a1e /libraries/Bridge/FileIO.h | |
parent | 514b18bb059f86a7e9f125c529befa914a1cde48 (diff) |
Bridge: Added File I/O
Diffstat (limited to 'libraries/Bridge/FileIO.h')
-rw-r--r-- | libraries/Bridge/FileIO.h | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/libraries/Bridge/FileIO.h b/libraries/Bridge/FileIO.h index a90ff46..19da646 100644 --- a/libraries/Bridge/FileIO.h +++ b/libraries/Bridge/FileIO.h @@ -16,8 +16,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef __SD_H__ -#define __SD_H__ +#ifndef __FILEIO_H__ +#define __FILEIO_H__ #include <Process.h> @@ -26,12 +26,13 @@ #define FILE_READ 0 #define FILE_WRITE 1 +#define FILE_APPEND 2 -class File : public Process { +class File : public Stream { public: - File(); - File(const char *_filename, uint8_t _mode); + File(BridgeClass &b = Bridge); + File(const char *_filename, uint8_t _mode, BridgeClass &b = Bridge); ~File(); virtual size_t write(uint8_t); @@ -46,17 +47,26 @@ public: uint32_t size(); void close(); operator bool(); - char * name(); + const char * name(); boolean isDirectory(void); //File openNextFile(uint8_t mode = O_RDONLY); void rewindDirectory(void); using Print::write; + +private: + void doBuffer(); + uint8_t buffered; + uint8_t readPos; + static const int BUFFER_SIZE = 64; + uint8_t buffer[BUFFER_SIZE]; private: - char *filename; + BridgeClass &bridge; + String filename; uint8_t mode; + uint8_t handle; }; class SDClass { |