-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtarstream.cpp
More file actions
48 lines (39 loc) · 789 Bytes
/
tarstream.cpp
File metadata and controls
48 lines (39 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <Arduino.h>
#include "tarstream.h"
TarStream::TarStream(uint8_t *buffer, unsigned int size){
this->databuffer = buffer;
this->databuffer_len = size;
}
size_t TarStream::write(const uint8_t *buffer, size_t size)
{
return 0;
}
size_t TarStream::write(uint8_t data){
return 0;
}
int TarStream::available() {
return length();
}
int TarStream::read() {
if(available()) {
uint8_t c = this->databuffer[cur];
this->cur++;
return c;
}
return -1;
}
int TarStream::peek() {
if(available()) {
char c = this->databuffer[this->cur];
return c;
}
return -1;
}
int TarStream::length() {
if (cur >= this->databuffer_len){
return 0;
}
return this->databuffer_len-this->cur;
}
void TarStream::flush() {
}