1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

comments on Arduino flush() method (#8318)

This commit is contained in:
david gauchard 2021-09-29 15:22:30 +02:00 committed by GitHub
parent 93b7325cb8
commit 9d024d17fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 4 deletions

View File

@ -183,7 +183,7 @@ public:
{
return static_cast<int>(uart_tx_free(_uart));
}
void flush(void) override;
void flush(void) override; // wait for all outgoing characters to be sent, output buffer is empty after this call
size_t write(uint8_t c) override
{
return uart_write_char(_uart, c);

View File

@ -110,7 +110,10 @@ class Print {
size_t println(const Printable&);
size_t println(void);
virtual void flush() { /* Empty implementation for backward compatibility */ }
// flush():
// Empty implementation by default in Print::
// should wait for all outgoing characters to be sent, output buffer is empty after this call
virtual void flush() { }
// by default write timeout is possible (outgoing data from network,serial..)
// (children can override to false (like String))

View File

@ -72,7 +72,7 @@ public:
size_t peekBytes(char *buffer, size_t length) {
return peekBytes((uint8_t *) buffer, length);
}
virtual void flush() override { (void)flush(0); }
virtual void flush() override { (void)flush(0); } // wait for all outgoing characters to be sent, output buffer should be empty after this call
virtual void stop() override { (void)stop(0); }
bool flush(unsigned int maxWaitMs);
bool stop(unsigned int maxWaitMs);

View File

@ -92,7 +92,7 @@ public:
int read(char* buffer, size_t len) override { return read((unsigned char*)buffer, len); };
// Return the next byte from the current packet without moving on to the next byte
int peek() override;
void flush() override; // Finish reading the current packet
void flush() override; // wait for all outgoing characters to be sent, output buffer is empty after this call
// Return the IP address of the host who sent the current incoming packet
IPAddress remoteIP() override;