22 #ifndef BayEOSBuffer_h
23 #define BayEOSBuffer_h
24 #define __PROG_TYPES_COMPAT__
28 #define SERIAL_DEBUG 0
30 #define SECONDS_PER_DAY 86400L
36 DateTime (uint16_t year, uint8_t month, uint8_t day,
37 uint8_t hour =0, uint8_t min =0, uint8_t sec =0);
38 DateTime (
const char* date,
const char* time);
40 uint16_t year()
const;
41 uint8_t month()
const;
44 uint8_t minute()
const;
45 uint8_t second()
const;
46 uint8_t dayOfWeek()
const;
52 uint8_t yOff, m, d, hh, mm, ss;
58 virtual void begin()=0;
59 virtual void adjust(
const DateTime& dt)=0;
65 #define RTC_RELATIVE_MILLIS 0
66 #define RTC_RELATIVE_SECONDS 2
67 #define RTC_ABSOLUTE_SECONDS 1
107 uint8_t
readBinary(
unsigned long pos,uint8_t length, uint8_t *dest);
112 uint8_t
readBinary(
unsigned long pos,
unsigned long end,uint8_t length, uint8_t *dest);
122 void set(
unsigned long pos);
139 uint8_t
addPacket(
const uint8_t *payload,uint8_t length);
165 void setRTC(
RTC&
rtc,uint8_t timeType=RTC_ABSOLUTE_SECONDS);
174 unsigned long getTime(
void);
176 unsigned long writePos(
void);
177 unsigned long readPos(
void);
178 unsigned long endPos(
void);
179 unsigned long length(
void);
183 boolean _framesDiscarded;
186 unsigned long _max_length;
188 unsigned long _read_pos;
189 unsigned long _write_pos;
192 uint8_t b_write(
const uint8_t b);
193 uint8_t b_write(
const uint8_t *b, uint8_t length);
195 int b_read(uint8_t *dest,
int length);
196 uint8_t b_seek(
unsigned long pos);
203 virtual void resetStorage(
void)=0;
208 virtual uint8_t write(
const uint8_t b)=0;
213 virtual uint8_t write(
const uint8_t *b,uint8_t length)=0;
218 virtual uint8_t seek(
unsigned long pos)=0;
224 virtual int read(
void)=0;
231 virtual int read(uint8_t *dest,
int length)=0;
237 virtual void flush(
void)=0;
239 unsigned long _millis;
240 uint8_t _packet_length;
Definition: BayEOSBuffer.h:70
unsigned long packetMillis(void)
Definition: BayEOSBuffer.cpp:254
void seekReadPointer(unsigned long pos)
Definition: BayEOSBuffer.cpp:164
uint8_t rtc(void)
Definition: BayEOSBuffer.cpp:263
unsigned long available(void)
Definition: BayEOSBuffer.cpp:78
uint8_t initNextPacket(void)
Definition: BayEOSBuffer.cpp:177
void next(void)
Definition: BayEOSBuffer.cpp:200
void makeFreeSpace(uint16_t length)
Definition: BayEOSBuffer.cpp:90
void reset(void)
Definition: BayEOSBuffer.cpp:168
uint8_t addPacket(const uint8_t *payload, uint8_t length)
Definition: BayEOSBuffer.cpp:230
uint8_t readBinary(unsigned long pos, uint8_t length, uint8_t *dest)
Definition: BayEOSBuffer.cpp:129
uint8_t initPacket(unsigned long pos)
Definition: BayEOSBuffer.cpp:181
void setRTC(RTC &rtc, uint8_t timeType=RTC_ABSOLUTE_SECONDS)
Definition: BayEOSBuffer.cpp:258
void skip(void)
Definition: BayEOSBuffer.cpp:173
void set(unsigned long pos)
Definition: BayEOSBuffer.cpp:145
uint8_t packetLength(void)
Definition: BayEOSBuffer.cpp:250
int readPacket(uint8_t *dest)
Definition: BayEOSBuffer.cpp:125
unsigned long freeSpace(void)
Definition: BayEOSBuffer.cpp:83
Definition: BayEOSBuffer.h:33
Definition: BayEOSBuffer.h:56