Native serial port descriptor with configuration support. More...
#include <SerialPort.h>
Public Member Functions | |
| Result | open (StringSpan path, const SerialOpenOptions &options=SerialOpenOptions()) |
| Opens a serial port and applies the requested settings. | |
| Result | setSettings (const SerialSettings &settings) |
| Applies settings to an already opened serial descriptor. | |
| Result | getSettings (SerialSettings &settings) const |
| Reads current settings from an opened serial descriptor. | |
Public Member Functions inherited from SC::FileDescriptor | |
| Result | openForWriteToDevNull () |
| ... [UniqueHandleDeclaration2Snippet] | |
| Result | openStdOutDuplicate () |
| Opens a duplicated file descriptor handle for reading from stdout. | |
| Result | openStdErrDuplicate () |
| Opens a duplicated file descriptor handle for reading from stderr. | |
| Result | openStdInDuplicate () |
| Opens a duplicated file descriptor handle for reading from stdin. | |
| Result | open (StringSpan path, FileOpen mode) |
| Opens a file descriptor handle from a file system path. | |
| Result | read (Span< char > data, Span< char > &actuallyRead, uint64_t offset) |
| Reads bytes at offset into user supplied span. | |
| Result | read (Span< uint8_t > data, Span< uint8_t > &actuallyRead, uint64_t offset) |
| Reads bytes at offset into user supplied span. | |
| Result | read (Span< char > data, Span< char > &actuallyRead) |
| Reads bytes from current position (FileDescriptor::seek) into user supplied Span. | |
| Result | readUntilFullOrEOF (Span< char > data, Span< char > &actuallyRead) |
| Reads bytes from current position (FileDescriptor::seek) into Span, until full or EOF is reached. | |
| Result | read (Span< uint8_t > data, Span< uint8_t > &actuallyRead) |
| Reads bytes from current position (FileDescriptor::seek) into user supplied Span. | |
| template<typename T > | |
| Result | readUntilEOF (T &destination) |
| Reads into a given dynamic buffer until End of File (EOF) is signaled. | |
| Result | readUntilEOF (IGrowableBuffer &&buffer) |
| Reads into a given dynamic buffer until End of File (EOF) is signaled. | |
| Result | writeString (StringSpan data) |
| Writes a string to the file descriptor. | |
| Result | write (Span< const char > data, uint64_t offset) |
| Writes bytes at offset from start of the file descriptor. | |
| Result | write (Span< const uint8_t > data, uint64_t offset) |
| Writes bytes at offset from start of the file descriptor. | |
| Result | write (Span< const char > data) |
| Writes bytes from current position (FileDescriptor::seek) of the file descriptor. | |
| Result | write (Span< const uint8_t > data) |
| Writes bytes from current position (FileDescriptor::seek) of the file descriptor. | |
| Result | seek (SeekMode seekMode, int64_t offset) |
| Changes the current position in the file descriptor, if seekable. | |
| Result | currentPosition (size_t &position) const |
| Gets current descriptor position (if seekable) | |
| Result | sizeInBytes (size_t &sizeInBytes) const |
| Gets total file size in bytes (if seekable) | |
| UniqueHandle ()=default | |
| UniqueHandle (const UniqueHandle &v)=delete | |
| UniqueHandle (UniqueHandle &&v) | |
| UniqueHandle (const Handle &externalHandle) | |
Additional Inherited Members | |
Public Types inherited from SC::FileDescriptor | |
| enum | SeekMode { SeekStart , SeekEnd , SeekCurrent } |
| How the offset to FileDescriptor::seek is defined. More... | |
Native serial port descriptor with configuration support.
| Result SC::SerialDescriptor::getSettings | ( | SerialSettings & | settings | ) | const |
Reads current settings from an opened serial descriptor.
| settings | Output settings. |
| Result SC::SerialDescriptor::open | ( | StringSpan | path, |
| const SerialOpenOptions & | options = SerialOpenOptions() ) |
Opens a serial port and applies the requested settings.
| path | Serial device path (/dev/tty* on Posix, COM* on Windows) |
| options | Open and configuration options. |
| Result SC::SerialDescriptor::setSettings | ( | const SerialSettings & | settings | ) |
Applies settings to an already opened serial descriptor.
| settings | Settings to apply. |