Class SerialStream
Defined in File serial_stream.h
Inheritance Relationships
Derived Type
public andino::SerialStreamArduino(Class SerialStreamArduino)
Class Documentation
-
class SerialStream
This class defines an interface for serial streams.
Subclassed by andino::SerialStreamArduino
Public Types
Public Functions
-
explicit SerialStream() = default
Constructs a SerialStream.
-
virtual ~SerialStream() = default
Destructs the serial stream.
-
virtual void begin(unsigned long baud) const = 0
Initializes the serial stream.
- Parameters:
baud – Data rate in bits per second (baud).
-
virtual int available() const = 0
Gets the number of bytes available for reading.
- Returns:
Number of bytes available for reading.
-
virtual int read() const = 0
Gets the incoming data.
- Returns:
First byte of incoming data, or -1 if no data is available.
-
virtual size_t print(const char *c) const = 0
Sends data as human-readable ASCII text.
- Parameters:
c – String to send.
- Returns:
Number of bytes sent.
-
virtual size_t print(char c) const = 0
Sends data as human-readable ASCII text.
- Parameters:
c – Character to send.
- Returns:
Number of bytes sent.
-
virtual size_t print(unsigned char b, int base = kDec) const = 0
Sends data as human-readable ASCII text.
- Parameters:
b – Byte to send.
base – Numeral system to use for the representation.
- Returns:
Number of bytes sent.
-
virtual size_t print(int num, int base = kDec) const = 0
Sends data as human-readable ASCII text.
- Parameters:
num – Number to send.
base – Numeral system to use for the representation.
- Returns:
Number of bytes sent.
-
virtual size_t print(unsigned int num, int base = kDec) const = 0
Sends data as human-readable ASCII text.
- Parameters:
num – Number to send.
base – Numeral system to use for the representation.
- Returns:
Number of bytes sent.
-
virtual size_t print(long num, int base = kDec) const = 0
Sends data as human-readable ASCII text.
- Parameters:
num – Number to send.
base – Numeral system to use for the representation.
- Returns:
Number of bytes sent.
-
virtual size_t print(unsigned long num, int base = kDec) const = 0
Sends data as human-readable ASCII text.
- Parameters:
num – Number to send.
base – Numeral system to use for the representation.
- Returns:
Number of bytes sent.
-
virtual size_t print(double num, int digits = 2) const = 0
Sends data as human-readable ASCII text.
- Parameters:
num – Number to send.
digits – Number of decimal places to use.
- Returns:
Number of bytes sent.
-
virtual size_t println(const char *c) const = 0
Sends data as human-readable ASCII text.
- Parameters:
c – String to send.
- Returns:
Number of bytes sent.
-
virtual size_t println(char c) const = 0
Sends data as human-readable ASCII text.
- Parameters:
c – Character to send.
- Returns:
Number of bytes sent.
-
virtual size_t println(unsigned char b, int base = kDec) const = 0
Sends data as human-readable ASCII text.
- Parameters:
b – Byte to send.
base – Numeral system to use for the representation.
- Returns:
Number of bytes sent.
-
virtual size_t println(int num, int base = kDec) const = 0
Sends data as human-readable ASCII text.
- Parameters:
num – Number to send.
base – Numeral system to use for the representation.
- Returns:
Number of bytes sent.
-
virtual size_t println(unsigned int num, int base = kDec) const = 0
Sends data as human-readable ASCII text.
- Parameters:
num – Number to send.
base – Numeral system to use for the representation.
- Returns:
Number of bytes sent.
-
virtual size_t println(long num, int base = kDec) const = 0
Sends data as human-readable ASCII text.
- Parameters:
num – Number to send.
base – Numeral system to use for the representation.
- Returns:
Number of bytes sent.
-
virtual size_t println(unsigned long num, int base = kDec) const = 0
Sends data as human-readable ASCII text.
- Parameters:
num – Number to send.
base – Numeral system to use for the representation.
- Returns:
Number of bytes sent.
-
virtual size_t println(double num, int digits = 2) const = 0
Sends data as human-readable ASCII text.
- Parameters:
num – Number to send.
digits – Number of decimal places to use.
- Returns:
Number of bytes sent.
-
explicit SerialStream() = default