Provides debug output to stream (e.g. Serial) or delegate function handler. More...
#include <Debug.h>
Public Member Functions | |||||||
DebugClass () | |||||||
Instantiate a debug object. More... | |||||||
void | initCommand () | ||||||
Enable control of debug output from CLI command handler output. More... | |||||||
void | start () | ||||||
Start debug output. More... | |||||||
void | stop () | ||||||
Stop debug output. More... | |||||||
bool | status () | ||||||
Get debug status. More... | |||||||
void | setDebug (DebugPrintCharDelegate reqDelegate) | ||||||
Configure debug to use delegate handler for its output. More... | |||||||
void | setDebug (Stream &reqStream) | ||||||
Configures debug to use stream for its output. More... | |||||||
size_t | write (uint8_t) override | ||||||
Writes a single character to output stream. More... | |||||||
int | getWriteError () | ||||||
Gets last error. More... | |||||||
void | clearWriteError () | ||||||
Clears the last write error. More... | |||||||
size_t | write (const char *str) | ||||||
Writes a c-string to output stream. More... | |||||||
virtual size_t | write (const uint8_t *buffer, size_t size) | ||||||
Writes characters from a buffer to output stream. More... | |||||||
size_t | write (const char *buffer, size_t size) | ||||||
Writes characters from a buffer to output stream. More... | |||||||
size_t | print (char c) | ||||||
Prints a single character to output stream. More... | |||||||
size_t | print (const char str[]) | ||||||
Prints a c-string to output stream. More... | |||||||
size_t | print (double num, int digits=2) | ||||||
Print a floating-point number to output stream. More... | |||||||
size_t | print (const Printable &p) | ||||||
Prints a Printable object to output stream. More... | |||||||
size_t | print (const String &s) | ||||||
Prints a String to output stream. More... | |||||||
size_t | println () | ||||||
Prints a newline to output stream. More... | |||||||
size_t | println (const char str[]) | ||||||
Prints a c-string to output stream, appending newline. More... | |||||||
size_t | println (char c) | ||||||
Prints a single character to output stream, appending newline. More... | |||||||
size_t | println (double num, int digits=2) | ||||||
Print a floating-point number to output stream, appending newline. More... | |||||||
size_t | println (const Printable &p) | ||||||
Prints a Printable object to output stream, appending newline. More... | |||||||
size_t | println (const String &s) | ||||||
Prints a String to output stream, appending newline. More... | |||||||
size_t | printf (const char *fmt,...) __attribute__((format(printf | ||||||
Prints a formatted c-string to output stream. More... | |||||||
Print an integral number to output stream | |||||||
| |||||||
size_t | print (unsigned long num, int base=DEC) | ||||||
size_t | print (const unsigned long long &num, int base=DEC) | ||||||
size_t | print (long, int base=DEC) | ||||||
size_t | print (const long long &, int base=DEC) | ||||||
size_t | print (unsigned int num, int base=DEC) | ||||||
size_t | print (unsigned char num, int base=DEC) | ||||||
size_t | print (int num, int base=DEC) | ||||||
Print an integral number to output stream, appending newline | |||||||
| |||||||
size_t | println (unsigned char num, int base=DEC) | ||||||
size_t | println (unsigned int num, int base=DEC) | ||||||
size_t | println (unsigned long num, int base=DEC) | ||||||
size_t | println (const unsigned long long &num, int base=DEC) | ||||||
size_t | println (int num, int base=DEC) | ||||||
size_t | println (long num, int base=DEC) | ||||||
size_t | println (const long long &num, int base=DEC) | ||||||
Protected Member Functions | |
void | setWriteError (int err=1) |
Detailed Description
Provides debug output to stream (e.g. Serial) or delegate function handler.
Debug output may be prefixed with an elapsed timestamp. Use standard print methods to produce debug output. Sming CLI (command handler) may be enabled to provide control of debug output to end user.
Constructor & Destructor Documentation
◆ DebugClass()
DebugClass::DebugClass | ( | ) |
Instantiate a debug object.
- Note
- Default output is Serial stream
Member Function Documentation
◆ clearWriteError()
|
inlineinherited |
Clears the last write error.
◆ getWriteError()
|
inlineinherited |
Gets last error.
- Return values
-
int Error number of last write error
◆ initCommand()
void DebugClass::initCommand | ( | ) |
Enable control of debug output from CLI command handler output.
◆ print() [1/12]
|
inlineinherited |
Prints a single character to output stream.
- Parameters
-
c Character to print
- Return values
-
size_t Quantity of characters written to stream
◆ print() [2/12]
|
inlineinherited |
Prints a c-string to output stream.
- Parameters
-
str c-string to print
- Return values
-
size_t Quantity of characters written to output stream
◆ print() [3/12]
◆ print() [4/12]
◆ print() [5/12]
◆ print() [6/12]
◆ print() [7/12]
◆ print() [8/12]
◆ print() [9/12]
◆ print() [10/12]
|
inlineinherited |
Print a floating-point number to output stream.
- Parameters
-
num Number to print digits The decimal places to print (Default: 2, e.g. 21.35)
- Return values
-
size_t Quantity of characters written to stream
◆ print() [11/12]
|
inlineinherited |
Prints a Printable object to output stream.
- Parameters
-
p Object to print
- Return values
-
size_t Quantity of characters written to stream
◆ print() [12/12]
|
inlineinherited |
◆ printf()
|
inherited |
Prints a formatted c-string to output stream.
- Parameters
-
fmt Pointer to formated c-string to print ... Parameters for placeholders within formated string
- Return values
-
size_t Quantity of characters written to stream
- Note
- Use standard printf placeholders, e.g. d for integer, s for c-string, etc.
◆ println() [1/13]
|
inlineinherited |
Prints a newline to output stream.
- Return values
-
size_t Quantity of characters written to stream
◆ println() [2/13]
|
inlineinherited |
Prints a c-string to output stream, appending newline.
- Parameters
-
str c-string to print
- Return values
-
size_t Quantity of characters written to stream
◆ println() [3/13]
|
inlineinherited |
Prints a single character to output stream, appending newline.
- Parameters
-
c Character to print
- Return values
-
size_t Quantity of characters written to stream
◆ println() [4/13]
◆ println() [5/13]
◆ println() [6/13]
◆ println() [7/13]
◆ println() [8/13]
◆ println() [9/13]
◆ println() [10/13]
◆ println() [11/13]
|
inlineinherited |
Print a floating-point number to output stream, appending newline.
- Parameters
-
num Number to print digits The decimal places to print (Default: 2, e.g. 21.35)
- Return values
-
size_t Quantity of characters written to stream
◆ println() [12/13]
|
inlineinherited |
Prints a Printable object to output stream, appending newline.
- Parameters
-
p Object to print
- Return values
-
size_t Quantity of characters written to stream
◆ println() [13/13]
|
inlineinherited |
◆ setDebug() [1/2]
void DebugClass::setDebug | ( | DebugPrintCharDelegate | reqDelegate | ) |
Configure debug to use delegate handler for its output.
- Parameters
-
reqDelegate Function to handle debug output
- Note
- Disables stream output
◆ setDebug() [2/2]
void DebugClass::setDebug | ( | Stream & | reqStream | ) |
Configures debug to use stream for its output.
- Parameters
-
reqStream Stream for debug output
- Note
- Disables delegate handler
◆ setWriteError()
|
inlineprotectedinherited |
◆ start()
void DebugClass::start | ( | ) |
Start debug output.
◆ status()
|
inline |
Get debug status.
- Return values
-
bool True if debug enabled
◆ stop()
void DebugClass::stop | ( | ) |
Stop debug output.
◆ write() [1/4]
|
inlineinherited |
Writes a c-string to output stream.
- Parameters
-
str Pointer to c-string
- Return values
-
size_t Quantity of characters written to stream
◆ write() [2/4]
|
virtualinherited |
Writes characters from a buffer to output stream.
- Parameters
-
buffer Pointer to character buffer size Quantity of characters to write
- Return values
-
size_t Quantity of characters written to stream
Reimplemented in HardwareSerial, CircularBuffer, OtaUpgrade::BasicStream, FileStream, MemoryDataStream, HostFileStream, LimitedMemoryStream, TwoWire, GdbFileStream, EndlessMemoryStream, ReadWriteStream, and OtaUpgrade::EncryptedStream.
◆ write() [3/4]
|
inlineinherited |
Writes characters from a buffer to output stream.
- Parameters
-
buffer Pointer to character buffer size Quantity of characters to write
- Return values
-
size_t Quantity of characters written to stream
◆ write() [4/4]
|
overridevirtual |
Writes a single character to output stream.
- Parameters
-
uint8_t Character to write to output stream
- Return values
-
size_t Quantity of characters written to output stream
Implements Print.
The documentation for this class was generated from the following file: