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

pfodESPBufferedClient.h
Go to the documentation of this file.
1 #ifndef pfodESPBufferedClient_h
2 #define pfodESPBufferedClient_h
13 #if defined (ESP32) || defined (ESP8266) || defined (ARDUINO_SAMD_NANO_33_IOT) || (defined(ARDUINO_ARCH_RP2040) && !defined(__MBED__))
14
15 #include "pfodStream.h"
16 #ifdef ESP8266
17 #include <ESP8266WiFi.h>
18 #else
19 #include "WiFi.h"
20 #endif
21 #include "WiFiClient.h"
22 class pfodESPBufferedClient : public Stream {
23
24 public:
25 pfodESPBufferedClient(); // default 1460 byte buffer and default send delay 10mS
26 pfodESPBufferedClient* connect(WiFiClient* _client);
27 virtual size_t write(uint8_t);
28 virtual size_t write(const uint8_t *buf, size_t size);
29 virtual int available();
30 virtual int availableForWrite();
31 virtual int read();
32 virtual int peek();
33 virtual void flush();
34 virtual void stop();
35 virtual uint8_t connected();
36 void setDebugStream(Print* out);
37 private:
38 WiFiClient* client;
39 void sendAfterDelay();
40 void forceSend();
41 size_t _write(uint8_t c);
42 static const unsigned long DEFAULT_SEND_DELAY_TIME = 10; // 10mS delay before sending buffer
43 //#define WIFICLIENT_MAX_PACKET_SIZE 1460
44 static const size_t DEFAULT_SEND_BUFFER_SIZE = 1460; //WIFICLIENT_MAX_PACKET_SIZE; // Max data size for standard TCP/IP packet
45 // at 57600 baud can read about 1152 bytes in 0.2sec so limit serial to <=57600 to prevent losing data
46 uint8_t sendBuffer[DEFAULT_SEND_BUFFER_SIZE]; //
47 size_t sendBufferIdx = 0;
48 unsigned long sendTimerStart = 0;
49 unsigned long sendDelayTime;
50 Print* debugOut;
51 };
52
53 #endif
54
55 #endif // pfodESPBufferedClient_h
pfodStream.h