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

pfodBTCBufferedStream.h
Go to the documentation of this file.
1 #ifndef pfodBTCBufferedStream_h
2 #define pfodBTCBufferedStream_h
9 #include "pfodStream.h"
10
11 class pfodBTCBufferedStream : public Stream {
12
13 public:
14 pfodBTCBufferedStream(); // default 128 byte buffer and default send delay 10mS
15 // pfodBTCBufferedStream(size_t _bufferSize); // set buffer size (min size is 32) and use default send delay 200mS
16 pfodBTCBufferedStream* connect(Stream* _stream);
17 virtual size_t write(uint8_t);
18 virtual size_t write(const uint8_t *buf, size_t size);
19 virtual int available();
20 virtual int read();
21 virtual int peek();
22 virtual void flush();
23 void setDebugStream(Print* out);
24 size_t bytesToBeSent(); // bytes in buffer to be sent
25 void clearTxBuffer();
26 protected:
27 void init();
28 private:
29 Stream* stream;
30 void sendAfterDelay();
31 unsigned long sendDelayTime;
32 void forceSend();
33 size_t _write(uint8_t c);
34 static const unsigned long DEFAULT_SEND_DELAY_TIME = 10000; //in uS, 10mS delay before sending buffer
35 static const size_t PFOD_DEFAULT_BTC_SEND_BUFFER_SIZE = 128;
36 uint8_t sendBuffer[PFOD_DEFAULT_BTC_SEND_BUFFER_SIZE]; //
37 size_t sendBufferIdx = 0;
38 size_t bufferSize;
39 Print* debugOut;
40 bool connectCalled;
41 unsigned long sendTimerStart;
42 bool timerRunning = false;
43 // void setBuffer(size_t _bufferSize);
44 };
45
46 #endif // pfodBTCBufferedStream_h
pfodBTCBufferedStream
(c)2015 Forward Computing and Control Pty.
Definition: pfodBTCBufferedStream.h:11
pfodBTCBufferedStream::clearTxBuffer
void clearTxBuffer()
pfodBTCBufferedStream::pfodBTCBufferedStream
pfodBTCBufferedStream()
pfodBTCBufferedStream::connect
pfodBTCBufferedStream * connect(Stream *_stream)
pfodBTCBufferedStream::bytesToBeSent
size_t bytesToBeSent()
pfodBTCBufferedStream::peek
virtual int peek()
pfodBTCBufferedStream::init
void init()
pfodBTCBufferedStream::read
virtual int read()
pfodBTCBufferedStream::write
virtual size_t write(const uint8_t *buf, size_t size)
pfodBTCBufferedStream::setDebugStream
void setDebugStream(Print *out)
pfodBTCBufferedStream::write
virtual size_t write(uint8_t)
pfodBTCBufferedStream::flush
virtual void flush()
pfodBTCBufferedStream::available
virtual int available()
pfodStream.h