|
4 | 4 |
|
5 | 5 | namespace Flat3\RevPi\Interfaces\Hardware;
|
6 | 6 |
|
| 7 | +/** |
| 8 | + * Interface Terminal |
| 9 | + * |
| 10 | + * Represents terminal communication capabilities common to hardware serial interfaces. |
| 11 | + * Extends Device, Ioctl, and Stream interfaces. |
| 12 | + */ |
7 | 13 | interface Terminal extends Device, Ioctl, Stream
|
8 | 14 | {
|
| 15 | + /** |
| 16 | + * Get the input baud rate stored in the termios buffer. |
| 17 | + * |
| 18 | + * @param string &$buffer The termios structure buffer (passed by reference). |
| 19 | + * @return int The input baud rate, or -1 on failure. |
| 20 | + */ |
9 | 21 | public function cfgetispeed(string &$buffer): int;
|
10 | 22 |
|
| 23 | + /** |
| 24 | + * Get the output baud rate stored in the termios buffer. |
| 25 | + * |
| 26 | + * @param string &$buffer The termios structure buffer (passed by reference). |
| 27 | + * @return int The output baud rate, or -1 on failure. |
| 28 | + */ |
11 | 29 | public function cfgetospeed(string &$buffer): int;
|
12 | 30 |
|
| 31 | + /** |
| 32 | + * Set the input baud rate in the termios buffer. |
| 33 | + * |
| 34 | + * @param string &$buffer The termios structure buffer (passed by reference). |
| 35 | + * @param int $speed The new input baud rate to set. |
| 36 | + * @return int Returns 0 on success, -1 on failure. |
| 37 | + */ |
13 | 38 | public function cfsetispeed(string &$buffer, int $speed): int;
|
14 | 39 |
|
| 40 | + /** |
| 41 | + * Set the output baud rate in the termios buffer. |
| 42 | + * |
| 43 | + * @param string &$buffer The termios structure buffer (passed by reference). |
| 44 | + * @param int $speed The new output baud rate to set. |
| 45 | + * @return int Returns 0 on success, -1 on failure. |
| 46 | + */ |
15 | 47 | public function cfsetospeed(string &$buffer, int $speed): int;
|
16 | 48 |
|
| 49 | + /** |
| 50 | + * Discard data in the input/output queue. |
| 51 | + * |
| 52 | + * @param int $queue_selector Selector indicating which queue(s) to flush (e.g., TCIFLUSH, TCOFLUSH). |
| 53 | + * @return int Returns 0 on success, or -1 on failure. |
| 54 | + */ |
17 | 55 | public function tcflush(int $queue_selector): int;
|
18 | 56 |
|
| 57 | + /** |
| 58 | + * Wait until all output written to the terminal is transmitted. |
| 59 | + * |
| 60 | + * @return int Returns 0 on success, or -1 on failure. |
| 61 | + */ |
19 | 62 | public function tcdrain(): int;
|
20 | 63 |
|
| 64 | + /** |
| 65 | + * Transmit a continuous stream of zero bits for a specific duration. |
| 66 | + * |
| 67 | + * @param int $duration Duration to send the break (in 0.25s units), default is 0 for 0.25 seconds. |
| 68 | + * @return int Returns 0 on success, or -1 on failure. |
| 69 | + */ |
21 | 70 | public function tcsendbreak(int $duration = 0): int;
|
22 | 71 | }
|
0 commit comments