| LightHub v4.0.0 Smarthome controller firmware

seekablestream.h
Go to the documentation of this file.
1 #ifndef _SEEKABLESTREAM_H_
2 #define _SEEKABLESTREAM_H_
3
4 #include <Stream.h>
5 #include <Arduino.h>
6
7 #define EOFchar 255
8
9 class seekableStream : public Stream
10 {
11 protected:
12 unsigned int streamSize;
13 bool textMode;
14 uint16_t contentType;
15
16 public:
17 seekableStream(unsigned int size):Stream(),streamSize(size) {};
18 virtual bool checkPermissions(char mode) {return true;};
19 unsigned int getSize() {return streamSize;}
20 void setSize (unsigned int size) {streamSize = size;};
21 virtual unsigned int seek(unsigned int _pos = 0) = 0;
22 virtual int open(String _filename, char mode) = 0;
23 virtual void close() = 0;
24 virtual uint16_t getContentType() {return contentType;};
25 virtual void putEOF() {if (textMode) write (EOFchar);};
26 };
27
28 #endif
seekableStream::seek
virtual unsigned int seek(unsigned int _pos=0)=0
seekableStream::checkPermissions
virtual bool checkPermissions(char mode)
Definition: seekablestream.h:18
seekableStream::seekableStream
seekableStream(unsigned int size)
Definition: seekablestream.h:17
seekableStream::setSize
void setSize(unsigned int size)
Definition: seekablestream.h:20
seekableStream::open
virtual int open(String _filename, char mode)=0
seekableStream::getContentType
virtual uint16_t getContentType()
Definition: seekablestream.h:24
seekableStream::contentType
uint16_t contentType
Definition: seekablestream.h:14
seekableStream
Definition: seekablestream.h:10
seekableStream::streamSize
unsigned int streamSize
Definition: seekablestream.h:12
seekableStream::putEOF
virtual void putEOF()
Definition: seekablestream.h:25
seekableStream::textMode
bool textMode
Definition: seekablestream.h:13
EOFchar
#define EOFchar
Definition: seekablestream.h:7
seekableStream::getSize
unsigned int getSize()
Definition: seekablestream.h:19
seekableStream::close
virtual void close()=0