PIDUINO
Loading...
Searching...
No Matches
terminal.h
1/* Copyright © 2018-2025 Pascal JEAN, All rights reserved.
2 * This file is part of the Piduino Library.
3 *
4 * The Piduino Library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 3 of the License, or (at your option) any later version.
8 *
9 * The Piduino Library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with the Piduino Library; if not, see <http://www.gnu.org/licenses/>.
16 */
17#pragma once
18
19#include <piduino/filestream.h>
20#include <piduino/terminalnotifier.h>
21
27namespace Piduino {
28
33 class Terminal : public FileStream {
34
35 public:
36
41
45 Terminal (const std::string & path);
46
50 ssize_t available() const;
51
63 virtual ssize_t read (char * data, size_t maxSize);
64
76 ssize_t read (char * buf, size_t maxSize, long msTimeout);
77
78 ssize_t read (std::string & str, long msTimeout = 0);
79 ssize_t read (char & c, long msTimeout = 0);
80
81 ssize_t peek (char * buf, size_t len, long msTimeout = 0);
82 ssize_t peek (std::string & str, long msTimeout = 0);
83 ssize_t peek (char & c, long msTimeout = 0);
84
87
88 protected:
89 class Private;
91
92 private:
94 };
95}
100/* ========================================================================== */
virtual std::string path() const
Provides an interface for reading from and writing to files with stream.
Definition filestream.h:34
Provides an interface for reading from and writing to terminals (tty)
Definition terminal.h:33
ssize_t read(std::string &str, long msTimeout=0)
ssize_t peek(std::string &str, long msTimeout=0)
Terminal(Private &dd)
virtual ssize_t read(char *data, size_t maxSize)
const Piduino::TerminalNotifier & notifier() const
ssize_t read(char *buf, size_t maxSize, long msTimeout)
ssize_t peek(char &c, long msTimeout=0)
ssize_t read(char &c, long msTimeout=0)
Terminal(const std::string &path)
ssize_t peek(char *buf, size_t len, long msTimeout=0)
ssize_t available() const
Piduino::TerminalNotifier & notifier()
Internal implementation class for GpioDevice.
#define PIMP_DECLARE_PRIVATE(Class)
PIMP_DECLARE_PRIVATE.
Definition global.h:82
Global namespace for Piduino.
Definition board.h:28