Coder Social home page Coder Social logo

term's Introduction

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

func CBreakMode(t *Term) error

CBreakMode places the terminal into cbreak mode.

func RawMode

func RawMode(t *Term) error

RawMode places the terminal into raw mode.

func Speed

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

Speed sets the baud rate option for the terminal.

type Term

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

Term represents an asynchronous communications port.

func Open

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

Open opens an asynchronous communications port.

func (*Term) Available

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

Available returns how many bytes are unused in the buffer.

func (*Term) Buffered

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

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

func (*Term) Close

func (t *Term) Close() error

Close closes the device and releases any associated resources.

func (*Term) DTR

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

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

func (*Term) Flush

func (t *Term) Flush() error

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

func (*Term) RTS

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

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

func (*Term) Read

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

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

func (t *Term) SendBreak() error

SendBreak sends a break signal.

func (*Term) SetCbreak

func (t *Term) SetCbreak() error

SetCbreak sets cbreak mode.

func (*Term) SetDTR

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

SetDTR sets the DTR (data terminal ready) signal.

func (*Term) SetOption

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

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

SetRTS sets the RTS (data terminal ready) signal.

func (*Term) SetRaw

func (t *Term) SetRaw() error

SetRaw sets raw mode.

func (*Term) SetSpeed

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

SetSpeed sets the receive and transmit baud rates.

func (*Term) Write

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

term's People

Contributors

davecheney avatar jdeppe-pivotal avatar liamstask avatar twpayne avatar dumbbell avatar mndrix avatar msiegen avatar andy-js avatar kivikakk avatar attilafueloep avatar dugoisd avatar domluna avatar gdamore avatar haraldnordgren avatar lelandbatey avatar leonklingele avatar zserge avatar ssgelm avatar stuartpearlmancomcast avatar timotto avatar tklauser avatar aitjcize avatar mewmew avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.