BleSerialPeripheralRK
Public Member Functions
Print Class Referenceabstract

Class for printing to a stream or file. More...

#include <spark_wiring_print.h>

Inheritance diagram for Print:
Stream BleSerialPeripheralBase BleSerialPeripheralStatic< TX_BUF_SIZE, RX_BUF_SIZE >

Public Member Functions

int getWriteError ()
 Return the last error code. 0 means no error.
 
void clearWriteError ()
 Clear the last error code to 0.
 
virtual size_t write (uint8_t c)=0
 Write a single byte to the stream or file. More...
 
size_t write (const char *str)
 Write a null-terminated c-string the stream or file. More...
 
virtual size_t write (const uint8_t *buffer, size_t size)
 Write a bytes specified by a buffer and length to the stream or file. More...
 
size_t print (const char[])
 Print a null-terminated array of char variables (a c-string) to the stream or file.
 
size_t print (char)
 Print a single character to the stream or file.
 
size_t print (unsigned char value, int base=DEC)
 Print an unsigned char (byte value, 8 bits) in the specified base to the stream or file. More...
 
size_t print (int value, int base=DEC)
 Print an int (32 bit integer) the specified base to the stream or file. More...
 
size_t print (unsigned int value, int base=DEC)
 Print an unsigned int (32 bit unsigned integer) the specified base to the stream or file. More...
 
size_t print (long value, int base=DEC)
 Print a long (32 bit integer) the specified base to the stream or file. More...
 
size_t print (unsigned long value, int base=DEC)
 Print a unsigned long (32 bit unsigned integer) the specified base to the stream or file. More...
 
size_t print (double value, int dec=2)
 Print a double floating point value to the stream or file. More...
 
size_t print (const Printable &)
 Print an object derived from Printable to the stream or file.
 
size_t println (const char[])
 Print a null-terminated array of char variables (a c-string) plus a CRLF end-of-line terminator to the stream or file.
 
size_t println (char value)
 Print a single character plus a CRLF end-of-line terminator to the stream or file.
 
size_t println (unsigned char value, int base=DEC)
 Print an unsigned char (byte value. 8 bits) in the specified base plus a CRLF end-of-line terminator to the stream or file. More...
 
size_t println (int value, int base=DEC)
 Print an int (32 bit integer) the specified base to plus a CRLF end-of-line terminator the stream or file. More...
 
size_t println (unsigned int value, int base=DEC)
 Print an unsigned int (32 bit unsigned integer) the specified base plus a CRLF end-of-line terminator to the stream or file. More...
 
size_t println (long value, int base=DEC)
 Print a long (32 bit signed integer) the specified base plus a CRLF end-of-line terminator to the stream or file. More...
 
size_t println (unsigned long value, int base=DEC)
 Print a unsigned long (32 bit unsigned integer) the specified base plus a CRLF end-of-line terminator to the stream or file. More...
 
size_t println (double value, int dec=2)
 Print a double floating point value plus a CRLF end-of-line terminator to the stream or file. More...
 
size_t println (const Printable &)
 Print an object derived from Printable plus a CRLF end-of-line terminator to the stream or file.
 
size_t println (void)
 Print a CRLF end-of-line terminator to the stream or file.
 
template<typename... Args>
size_t printf (const char *format, Args... args)
 Print using printf-style formatting to the stream or file. More...
 
template<typename... Args>
size_t printlnf (const char *format, Args... args)
 Print using printf-style formatting plus a CRLF end-of-line terminator to the stream or file. More...
 

Detailed Description

Class for printing to a stream or file.

Various classes include serial, TCP network streams, and files inherit from this and can use these methods.

Member Function Documentation

◆ print() [1/6]

size_t Print::print ( unsigned char  value,
int  base = DEC 
)

Print an unsigned char (byte value, 8 bits) in the specified base to the stream or file.

Parameters
valueThe value to print.
baseThe base to print. Default is DEC (decimal). Other values are HEX (hexadecimal), OCT (octal), and BIN (binary).

◆ print() [2/6]

size_t Print::print ( int  value,
int  base = DEC 
)

Print an int (32 bit integer) the specified base to the stream or file.

Parameters
valueThe value to print.
baseThe base to print. Default is DEC (decimal). Other values are HEX (hexadecimal), OCT (octal), and BIN (binary).

◆ print() [3/6]

size_t Print::print ( unsigned int  value,
int  base = DEC 
)

Print an unsigned int (32 bit unsigned integer) the specified base to the stream or file.

Parameters
valueThe value to print.
baseThe base to print. Default is DEC (decimal). Other values are HEX (hexadecimal), OCT (octal), and BIN (binary).

◆ print() [4/6]

size_t Print::print ( long  value,
int  base = DEC 
)

Print a long (32 bit integer) the specified base to the stream or file.

Parameters
valueThe value to print.
baseThe base to print. Default is DEC (decimal). Other values are HEX (hexadecimal), OCT (octal), and BIN (binary).

◆ print() [5/6]

size_t Print::print ( unsigned long  value,
int  base = DEC 
)

Print a unsigned long (32 bit unsigned integer) the specified base to the stream or file.

Parameters
valueThe value to print.
baseThe base to print. Default is DEC (decimal). Other values are HEX (hexadecimal), OCT (octal), and BIN (binary).

◆ print() [6/6]

size_t Print::print ( double  value,
int  dec = 2 
)

Print a double floating point value to the stream or file.

Parameters
valueThe value to print.
decThe number of decimal places to include for the fractional part. Default: 2

◆ printf()

template<typename... Args>
size_t Print::printf ( const char *  format,
Args...  args 
)
inline

Print using printf-style formatting to the stream or file.

Parameters
formatprintf-style formatting string
argsvariable arguments

◆ println() [1/6]

size_t Print::println ( unsigned char  value,
int  base = DEC 
)

Print an unsigned char (byte value. 8 bits) in the specified base plus a CRLF end-of-line terminator to the stream or file.

Parameters
valueThe value to print.
baseThe base to print. Default is DEC (decimal). Other values are HEX (hexadecimal), OCT (octal), and BIN (binary).

◆ println() [2/6]

size_t Print::println ( int  value,
int  base = DEC 
)

Print an int (32 bit integer) the specified base to plus a CRLF end-of-line terminator the stream or file.

Parameters
valueThe value to print
baseThe base to print. Default is DEC (decimal). Other values are HEX (hexadecimal), OCT (octal), and BIN (binary).

◆ println() [3/6]

size_t Print::println ( unsigned int  value,
int  base = DEC 
)

Print an unsigned int (32 bit unsigned integer) the specified base plus a CRLF end-of-line terminator to the stream or file.

Parameters
valueThe value to print
baseThe base to print. Default is DEC (decimal). Other values are HEX (hexadecimal), OCT (octal), and BIN (binary).

◆ println() [4/6]

size_t Print::println ( long  value,
int  base = DEC 
)

Print a long (32 bit signed integer) the specified base plus a CRLF end-of-line terminator to the stream or file.

Parameters
valueThe value to print
baseThe base to print. Default is DEC (decimal). Other values are HEX (hexadecimal), OCT (octal), and BIN (binary).

◆ println() [5/6]

size_t Print::println ( unsigned long  value,
int  base = DEC 
)

Print a unsigned long (32 bit unsigned integer) the specified base plus a CRLF end-of-line terminator to the stream or file.

Parameters
valueThe value to print.
baseThe base to print. Default is DEC (decimal). Other values are HEX (hexadecimal), OCT (octal), and BIN (binary).

◆ println() [6/6]

size_t Print::println ( double  value,
int  dec = 2 
)

Print a double floating point value plus a CRLF end-of-line terminator to the stream or file.

Parameters
valueThe value to print.
decThe number of decimal places to include for the fractional part. Default: 2

◆ printlnf()

template<typename... Args>
size_t Print::printlnf ( const char *  format,
Args...  args 
)
inline

Print using printf-style formatting plus a CRLF end-of-line terminator to the stream or file.

Parameters
formatprintf-style formatting string
argsvariable arguments

◆ write() [1/3]

virtual size_t Print::write ( uint8_t  c)
pure virtual

Write a single byte to the stream or file.

Parameters
cThe byte to write. All values 0 - 255 are allowed.

Implemented in BleSerialPeripheralBase.

◆ write() [2/3]

size_t Print::write ( const char *  str)
inline

Write a null-terminated c-string the stream or file.

Parameters
strpoint to a null-terminated c-string.

◆ write() [3/3]

virtual size_t Print::write ( const uint8_t *  buffer,
size_t  size 
)
virtual

Write a bytes specified by a buffer and length to the stream or file.

Parameters
bufferpointer to the buffer. The data does not need to be null-terminated.
sizesize in bytes

The documentation for this class was generated from the following file: