|
|
|
@ -17,8 +17,8 @@
@@ -17,8 +17,8 @@
|
|
|
|
|
#ifndef Print_h |
|
|
|
|
#define Print_h |
|
|
|
|
|
|
|
|
|
#include <stdint.h> |
|
|
|
|
#include <stddef.h> |
|
|
|
|
#include <stdint.h> |
|
|
|
|
#include <string> |
|
|
|
|
|
|
|
|
|
// #include "Printable.h"
|
|
|
|
@ -28,47 +28,34 @@
@@ -28,47 +28,34 @@
|
|
|
|
|
#define OCT 8 |
|
|
|
|
#define BIN 2 |
|
|
|
|
|
|
|
|
|
class Print |
|
|
|
|
{ |
|
|
|
|
private: |
|
|
|
|
class Print { |
|
|
|
|
private: |
|
|
|
|
int write_error; |
|
|
|
|
size_t printNumber(unsigned long, uint8_t); |
|
|
|
|
size_t printFloat(double, uint8_t); |
|
|
|
|
protected: |
|
|
|
|
void setWriteError(int err = 1) |
|
|
|
|
{ |
|
|
|
|
write_error = err; |
|
|
|
|
} |
|
|
|
|
public: |
|
|
|
|
Print() : |
|
|
|
|
write_error(0) |
|
|
|
|
{ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected: |
|
|
|
|
void setWriteError(int err = 1) { write_error = err; } |
|
|
|
|
|
|
|
|
|
public: |
|
|
|
|
Print() : write_error(0) {} |
|
|
|
|
virtual ~Print() {} |
|
|
|
|
int getWriteError() |
|
|
|
|
{ |
|
|
|
|
return write_error; |
|
|
|
|
} |
|
|
|
|
void clearWriteError() |
|
|
|
|
{ |
|
|
|
|
setWriteError(0); |
|
|
|
|
} |
|
|
|
|
int getWriteError() { return write_error; } |
|
|
|
|
void clearWriteError() { setWriteError(0); } |
|
|
|
|
|
|
|
|
|
virtual size_t write(uint8_t) = 0; |
|
|
|
|
size_t write(const char *str) |
|
|
|
|
{ |
|
|
|
|
if(str == NULL) { |
|
|
|
|
size_t write(const char *str) { |
|
|
|
|
if (str == NULL) { |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
return write((const uint8_t *) str, strlen(str)); |
|
|
|
|
return write((const uint8_t *)str, strlen(str)); |
|
|
|
|
} |
|
|
|
|
virtual size_t write(const uint8_t *buffer, size_t size); |
|
|
|
|
size_t write(const char *buffer, size_t size) |
|
|
|
|
{ |
|
|
|
|
return write((const uint8_t *) buffer, size); |
|
|
|
|
size_t write(const char *buffer, size_t size) { |
|
|
|
|
return write((const uint8_t *)buffer, size); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
size_t printf(const char * format, ...) __attribute__ ((format (printf, 2, 3))); |
|
|
|
|
size_t printf(const char *format, ...) __attribute__((format(printf, 2, 3))); |
|
|
|
|
// size_t print(const String &);
|
|
|
|
|
size_t print(const std::string &); |
|
|
|
|
size_t print(const char[]); |
|
|
|
@ -80,7 +67,7 @@ public:
@@ -80,7 +67,7 @@ public:
|
|
|
|
|
size_t print(unsigned long, int = DEC); |
|
|
|
|
size_t print(double, int = 2); |
|
|
|
|
// size_t print(const Printable&);
|
|
|
|
|
size_t print(struct tm * timeinfo, const char * format = NULL); |
|
|
|
|
size_t print(struct tm *timeinfo, const char *format = NULL); |
|
|
|
|
|
|
|
|
|
// size_t println(const String &s);
|
|
|
|
|
size_t println(const std::string &s); |
|
|
|
@ -93,7 +80,7 @@ public:
@@ -93,7 +80,7 @@ public:
|
|
|
|
|
size_t println(unsigned long, int = DEC); |
|
|
|
|
size_t println(double, int = 2); |
|
|
|
|
// size_t println(const Printable&);
|
|
|
|
|
size_t println(struct tm * timeinfo, const char * format = NULL); |
|
|
|
|
size_t println(struct tm *timeinfo, const char *format = NULL); |
|
|
|
|
size_t println(void); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|