comments on Arduino flush() method (#8318) · esp8266/Arduino@9d024d1 (original) (raw)
File tree
4 files changed
lines changed
- libraries/ESP8266WiFi/src
4 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -183,7 +183,7 @@ class HardwareSerial: public Stream | ||
183 | 183 | { |
184 | 184 | return static_cast<int>(uart_tx_free(_uart)); |
185 | 185 | } |
186 | -void flush(void) override; | |
186 | +void flush(void) override; // wait for all outgoing characters to be sent, output buffer is empty after this call | |
187 | 187 | size_t write(uint8_t c) override |
188 | 188 | { |
189 | 189 | return uart_write_char(_uart, c); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -110,7 +110,10 @@ class Print { | ||
110 | 110 | size_t println(const Printable&); |
111 | 111 | size_t println(void); |
112 | 112 | |
113 | -virtual void flush() { /* Empty implementation for backward compatibility */ } | |
113 | +// flush(): | |
114 | +// Empty implementation by default in Print:: | |
115 | +// should wait for all outgoing characters to be sent, output buffer is empty after this call | |
116 | +virtual void flush() { } | |
114 | 117 | |
115 | 118 | // by default write timeout is possible (outgoing data from network,serial..) |
116 | 119 | // (children can override to false (like String)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -72,7 +72,7 @@ class WiFiClient : public Client, public SList { | ||
72 | 72 | size_t peekBytes(char *buffer, size_t length) { |
73 | 73 | return peekBytes((uint8_t *) buffer, length); |
74 | 74 | } |
75 | -virtual void flush() override { (void)flush(0); } | |
75 | +virtual void flush() override { (void)flush(0); } // wait for all outgoing characters to be sent, output buffer should be empty after this call | |
76 | 76 | virtual void stop() override { (void)stop(0); } |
77 | 77 | bool flush(unsigned int maxWaitMs); |
78 | 78 | bool stop(unsigned int maxWaitMs); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -92,7 +92,7 @@ class WiFiUDP : public UDP, public SList { | ||
92 | 92 | int read(char* buffer, size_t len) override { return read((unsigned char*)buffer, len); }; |
93 | 93 | // Return the next byte from the current packet without moving on to the next byte |
94 | 94 | int peek() override; |
95 | -void flush() override; // Finish reading the current packet | |
95 | +void flush() override; // wait for all outgoing characters to be sent, output buffer is empty after this call | |
96 | 96 | |
97 | 97 | // Return the IP address of the host who sent the current incoming packet |
98 | 98 | IPAddress remoteIP() override; |