pw::stream::NonSeekableReaderWriter
implementation for UARTs on Linux.
More...
#include <stream.h>
|
UartStreamLinux & | operator= (UartStreamLinux &&other) |
|
| UartStreamLinux (UartStreamLinux &&other) noexcept |
|
| UartStreamLinux (const UartStreamLinux &)=delete |
|
UartStreamLinux & | operator= (const UartStreamLinux &)=delete |
|
Status | Open (const char *path, uint32_t baud_rate) |
|
Status | Open (const char *path, Config config) |
|
void | Close () |
|
| operator NonSeekableReader & () |
|
| operator const NonSeekableReader & () const |
|
| operator NonSeekableWriter & () |
|
| operator const NonSeekableWriter & () const |
|
Reader & | as_reader () |
|
const Reader & | as_reader () const |
|
| operator Reader & () |
|
| operator const Reader & () const |
|
Writer & | as_writer () |
|
const Writer & | as_writer () const |
|
| operator Writer & () |
|
| operator const Writer & () const |
|
constexpr bool | readable () const |
|
constexpr bool | writable () const |
|
constexpr bool | seekable () const |
|
constexpr bool | seekable (Whence origin) const |
| True if the stream supports seeking from the specified origin.
|
|
Result< ByteSpan > | Read (ByteSpan dest) |
|
Result< ByteSpan > | Read (void *dest, size_t size_bytes) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
Result< ByteSpan > | ReadExact (ByteSpan const buffer) |
|
Status | Write (ConstByteSpan data) |
|
Status | Write (const void *data, size_t size_bytes) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
Status | Write (const std::byte b) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
Status | Seek (ptrdiff_t offset, Whence origin=kBeginning) |
|
size_t | Tell () |
|
size_t | ConservativeReadLimit () const |
|
size_t | ConservativeWriteLimit () const |
|
|
enum | Whence : uint8_t { kBeginning = 0b001
, kCurrent = 0b010
, kEnd = 0b100
} |
| Positions from which to seek. More...
|
|
static constexpr size_t | kUnlimited = std::numeric_limits<size_t>::max() |
| Value returned from read/write limit if unlimited.
|
|
static constexpr size_t | kUnknownPosition = std::numeric_limits<size_t>::max() |
| Returned by Tell() if getting the position is not supported.
|
|
enum class | LimitType : bool { kRead
, kWrite
} |
|
pw::stream::NonSeekableReaderWriter
implementation for UARTs on Linux.
◆ DoRead()
StatusWithSize pw::stream::UartStreamLinux::DoRead |
( |
ByteSpan |
destination | ) |
|
|
overrideprivatevirtual |
◆ DoWrite()
Status pw::stream::UartStreamLinux::DoWrite |
( |
ConstByteSpan |
data | ) |
|
|
overrideprivatevirtual |
◆ Open() [1/2]
Status pw::stream::UartStreamLinux::Open |
( |
const char * |
path, |
|
|
Config |
config |
|
) |
| |
Open a UART device using the specified Config struct.
- Parameters
-
[in] | path | Path to the TTY device. |
[in] | config | UartStreamLinux configuration structure. |
- Returns
embed:rst:leading-asterisk
*
* .. pw-status-codes::
*
* OK: The device was successfully opened and configured.
*
* INVALID_ARGUMENT: Invalid config, for e.g. unsupported baud rate.
*
* FAILED_PRECONDITION: A device was already open.
*
* UNKNOWN: An error was returned by the operating system.
*
*
◆ Open() [2/2]
Status pw::stream::UartStreamLinux::Open |
( |
const char * |
path, |
|
|
uint32_t |
baud_rate |
|
) |
| |
|
inline |
Open a UART device using the specified baud rate.
- Parameters
-
[in] | path | Path to the TTY device. |
[in] | baud_rate | Baud rate to use for the device. |
- Returns
embed:rst:leading-asterisk
*
* .. pw-status-codes::
*
* OK: The device was successfully opened and configured.
*
* INVALID_ARGUMENT: An unsupported baud rate was supplied.
*
* FAILED_PRECONDITION: A device was already open.
*
* UNKNOWN: An error was returned by the operating system.
*
*
The documentation for this class was generated from the following file:
- pw_stream_uart_linux/public/pw_stream_uart_linux/stream.h