pfodParser 3.61.0 The pfodParser library is handles commands sent from the Android pfodApp, pfodApp supports WiFi, BLE, Bluetooth and SMS connections

pfodBufferedStream.h
Go to the documentation of this file.
1 #ifndef pfodBufferedSerial_h
2 #define pfodBufferedSerial_h
9 #include "pfodStream.h"
10 #include "pfodRingBuffer.h"
11
12 class pfodBufferedStream : public Stream {
13
14 public:
21 pfodBufferedStream(const uint32_t baudRate, uint8_t *_buf, size_t _bufferSize, bool blocking = true);
22 pfodBufferedStream* connect(Stream* _stream); // where to read and write to
23 virtual size_t write(uint8_t);
24 virtual size_t write(const uint8_t *buf, size_t size);
25 virtual int available();
26 virtual int read();
27 virtual int peek();
28 virtual void flush(); // this blocks until write buffer empty
29 virtual int availableForWrite();
30 void setDebugStream(Print* out);
31 size_t bytesToBeSent(); // bytes in buffer to be sent
32 size_t getSize(); // check on allocation
33 void clearTxBuffer(); // clears outgoing (write) buffer
34 uint32_t getBaudRate();
35 private:
36 unsigned long uS_perByte; // == 1000000 / (baudRate/10) == 10000000 / baudRate
37 Stream* stream;
38 pfodRingBuffer ringBuffer;
39 uint32_t baudRate;
40 void sendNextByte();
41 unsigned long sendTimerStart;
42 bool blocking; // defaults to true;
43 Print* debugOut;
44 };
45
46 #endif // pfodBufferedSerial_h
pfodBufferedStream
(c)2018 Forward Computing and Control Pty.
Definition: pfodBufferedStream.h:12
pfodBufferedStream::getBaudRate
uint32_t getBaudRate()
pfodBufferedStream::peek
virtual int peek()
pfodBufferedStream::available
virtual int available()
pfodBufferedStream::setDebugStream
void setDebugStream(Print *out)
pfodBufferedStream::bytesToBeSent
size_t bytesToBeSent()
pfodBufferedStream::flush
virtual void flush()
pfodBufferedStream::clearTxBuffer
void clearTxBuffer()
pfodBufferedStream::availableForWrite
virtual int availableForWrite()
pfodBufferedStream::getSize
size_t getSize()
pfodBufferedStream::read
virtual int read()
pfodBufferedStream::write
virtual size_t write(const uint8_t *buf, size_t size)
pfodBufferedStream::pfodBufferedStream
pfodBufferedStream(const uint32_t baudRate, uint8_t *_buf, size_t _bufferSize, bool blocking=true)
baudRate – the maximum rate at which the bytes are to be released.
pfodBufferedStream::connect
pfodBufferedStream * connect(Stream *_stream)
pfodBufferedStream::write
virtual size_t write(uint8_t)
pfodRingBuffer
pfodRingBuffer for Arduino Implements a ring buffer implementation of an Arduino Stream upto 32K buff...
Definition: pfodRingBuffer.h:25
pfodRingBuffer.h
pfodStream.h