1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
|
# term
import "github.com/pkg/term"
Package term manages POSIX terminals. As POSIX terminals are connected to,
or emulate, a UART, this package also provides control over the various
UART and serial line parameters.
## func CBreakMode
``` go
func CBreakMode(t *Term) error
```
CBreakMode places the terminal into cbreak mode.
## func RawMode
``` go
func RawMode(t *Term) error
```
RawMode places the terminal into raw mode.
## func Speed
``` go
func Speed(baud int) func(*Term) error
```
Speed sets the baud rate option for the terminal.
## type Term
``` go
type Term struct {
// contains filtered or unexported fields
}
```
Term represents an asynchronous communications port.
### func Open
``` go
func Open(name string, options ...func(*Term) error) (*Term, error)
```
Open opens an asynchronous communications port.
### func (\*Term) Available
``` go
func (t *Term) Available() (int, error)
```
Available returns how many bytes are unused in the buffer.
### func (\*Term) Buffered
``` go
func (t *Term) Buffered() (int, error)
```
Buffered returns the number of bytes that have been written into the current buffer.
### func (\*Term) Close
``` go
func (t *Term) Close() error
```
Close closes the device and releases any associated resources.
### func (\*Term) DTR
``` go
func (t *Term) DTR() (bool, error)
```
DTR returns the state of the DTR (data terminal ready) signal.
### func (\*Term) Flush
``` go
func (t *Term) Flush() error
```
Flush flushes both data received but not read, and data written but not transmitted.
### func (\*Term) RTS
``` go
func (t *Term) RTS() (bool, error)
```
RTS returns the state of the RTS (data terminal ready) signal.
### func (\*Term) Read
``` go
func (t *Term) Read(b []byte) (int, error)
```
Read reads up to len(b) bytes from the terminal. It returns the number of
bytes read and an error, if any. EOF is signaled by a zero count with
err set to io.EOF.
### func (\*Term) Restore
``` go
func (t *Term) Restore() error
```
Restore restores the state of the terminal captured at the point that
the terminal was originally opened.
### func (\*Term) SendBreak
``` go
func (t *Term) SendBreak() error
```
SendBreak sends a break signal.
### func (\*Term) SetCbreak
``` go
func (t *Term) SetCbreak() error
```
SetCbreak sets cbreak mode.
### func (\*Term) SetDTR
``` go
func (t *Term) SetDTR(v bool) error
```
SetDTR sets the DTR (data terminal ready) signal.
### func (\*Term) SetOption
``` go
func (t *Term) SetOption(options ...func(*Term) error) error
```
SetOption takes one or more option function and applies them in order to Term.
### func (\*Term) SetRTS
``` go
func (t *Term) SetRTS(v bool) error
```
SetRTS sets the RTS (data terminal ready) signal.
### func (\*Term) SetRaw
``` go
func (t *Term) SetRaw() error
```
SetRaw sets raw mode.
### func (\*Term) SetSpeed
``` go
func (t *Term) SetSpeed(baud int) error
```
SetSpeed sets the receive and transmit baud rates.
### func (\*Term) Write
``` go
func (t *Term) Write(b []byte) (int, error)
```
Write writes len(b) bytes to the terminal. It returns the number of bytes
written and an error, if any. Write returns a non-nil error when n !=
len(b).
- - -
Generated by [godoc2md](http://godoc.org/github.com/davecheney/godoc2md)
|