pkg/term

Name: term

Owner: pkg

Description: Package term manages POSIX terminals.

Created: 2014-05-06 08:29:34.0

Updated: 2018-01-10 17:48:18.0

Pushed: 2016-09-28 21:53:38.0

Homepage: null

Size: 65

Language: Go

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

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
 CBreakMode(t *Term) error

CBreakMode places the terminal into cbreak mode.

func RawMode
 RawMode(t *Term) error

RawMode places the terminal into raw mode.

func Speed
 Speed(baud int) func(*Term) error

Speed sets the baud rate option for the terminal.

type Term
 Term struct {
// contains filtered or unexported fields

Term represents an asynchronous communications port.

func Open
 Open(name string, options ...func(*Term) error) (*Term, error)

Open opens an asynchronous communications port.

func (*Term) Available
 (t *Term) Available() (int, error)

Available returns how many bytes are unused in the buffer.

func (*Term) Buffered
 (t *Term) Buffered() (int, error)

Buffered returns the number of bytes that have been written into the current buffer.

func (*Term) Close
 (t *Term) Close() error

Close closes the device and releases any associated resources.

func (*Term) DTR
 (t *Term) DTR() (bool, error)

DTR returns the state of the DTR (data terminal ready) signal.

func (*Term) Flush
 (t *Term) Flush() error

Flush flushes both data received but not read, and data written but not transmitted.

func (*Term) RTS
 (t *Term) RTS() (bool, error)

RTS returns the state of the RTS (data terminal ready) signal.

func (*Term) Read
 (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
 (t *Term) Restore() error

Restore restores the state of the terminal captured at the point that the terminal was originally opened.

func (*Term) SendBreak
 (t *Term) SendBreak() error

SendBreak sends a break signal.

func (*Term) SetCbreak
 (t *Term) SetCbreak() error

SetCbreak sets cbreak mode.

func (*Term) SetDTR
 (t *Term) SetDTR(v bool) error

SetDTR sets the DTR (data terminal ready) signal.

func (*Term) SetOption
 (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
 (t *Term) SetRTS(v bool) error

SetRTS sets the RTS (data terminal ready) signal.

func (*Term) SetRaw
 (t *Term) SetRaw() error

SetRaw sets raw mode.

func (*Term) SetSpeed
 (t *Term) SetSpeed(baud int) error

SetSpeed sets the receive and transmit baud rates.

func (*Term) Write
 (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


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.