1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-12-01 17:57:53 +03:00

Moving write errors out of return value into separate API methods.

write(), print(), println() now return size_t (and don't use negative values to signal errors).
Print adds writeError() for checking for write errors, clearWriteError() to reset the flag to false, and a protected setWriteError() for signalling errors.

http://code.google.com/p/arduino/issues/detail?id=598
This commit is contained in:
David A. Mellis
2011-08-26 16:08:14 -04:00
parent 929597375b
commit b73cf39d94
23 changed files with 184 additions and 173 deletions

View File

@@ -67,11 +67,11 @@ public:
// Returns 1 if the packet was sent successfully, 0 if there was an error
int endPacket();
// Write a single byte into the packet
virtual ssize_t write(uint8_t);
virtual size_t write(uint8_t);
// Write a string of characters into the packet
virtual ssize_t write(const char *str);
virtual size_t write(const char *str);
// Write size bytes from buffer into the packet
virtual ssize_t write(const uint8_t *buffer, size_t size);
virtual size_t write(const uint8_t *buffer, size_t size);
// Start processing the next available incoming packet
// Returns the size of the packet in bytes, or 0 if no packets are available