pfodParser  3.61.0
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  private:
27  Stream* stream;
28  void sendAfterDelay();
29  unsigned long sendDelayTime;
30  void forceSend();
31  size_t _write(uint8_t c);
32  static const unsigned long DEFAULT_SEND_DELAY_TIME = 10000; //in uS, 10mS delay before sending buffer
33  static const size_t PFOD_DEFAULT_BTC_SEND_BUFFER_SIZE = 128;
34  uint8_t sendBuffer[PFOD_DEFAULT_BTC_SEND_BUFFER_SIZE]; //
35  size_t sendBufferIdx = 0;
36  size_t bufferSize;
37  Print* debugOut;
38  bool connectCalled;
39  unsigned long sendTimerStart;
40  bool timerRunning = false;
41  // void setBuffer(size_t _bufferSize);
42 };
43 
44 #endif // pfodBTCBufferedStream_h
(c)2015 Forward Computing and Control Pty.
pfodBTCBufferedStream * connect(Stream *_stream)
virtual int peek()
virtual int read()
virtual size_t write(const uint8_t *buf, size_t size)
void setDebugStream(Print *out)
virtual size_t write(uint8_t)
virtual void flush()
virtual int available()