source: rtos_arduino/trunk/arduino_lib/libraries/pubsubclient-2.6/tests/src/lib/Buffer.cpp@ 209

Last change on this file since 209 was 209, checked in by ertl-honda, 8 years ago

BlueMix用のフィアルを追加

File size: 511 bytes
Line 
1#include "Buffer.h"
2#include "Arduino.h"
3
4Buffer::Buffer() {
5}
6
7Buffer::Buffer(uint8_t* buf, size_t size) {
8 this->add(buf,size);
9}
10bool Buffer::available() {
11 return this->pos < this->length;
12}
13
14uint8_t Buffer::next() {
15 if (this->available()) {
16 return this->buffer[this->pos++];
17 }
18 return 0;
19}
20
21void Buffer::reset() {
22 this->pos = 0;
23}
24
25void Buffer::add(uint8_t* buf, size_t size) {
26 uint16_t i = 0;
27 for (;i<size;i++) {
28 this->buffer[this->length++] = buf[i];
29 }
30}
Note: See TracBrowser for help on using the repository browser.