Documentation ¶
Overview ¶
Package serial provides support for serial connections.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNetClosing = errors.New("use of closed network connection")
ErrNetClosing comes from the stdlib, but is not exported by the stdlib, see https://golang.org/issues/4373. There is a test to assert this is still a sound match for the behavior we're matching against.
Functions ¶
func IsErrNetClosing ¶
func Open ¶
func Open(name string) (io.ReadWriteCloser, error)
Open opens a new serial port using defaults.
func OpenWithOptions ¶
func OpenWithOptions(name string, baudRate int) (io.ReadWriteCloser, error)
OpenWithOptions opens a new serial port with the given name and baud rate.
Types ¶
type Server ¶
type Server struct { ServerOptions // contains filtered or unexported fields }
Server proxies all i/o to/from a serial port via another io.ReadWriter. Start and Stop may be pairwise called any number of times.
func NewServer ¶
func NewServer(serial io.ReadWriteCloser, opts ServerOptions) *Server
NewServer returns a new server that lives atop the given 'serial' port.
type ServerOptions ¶
type ServerOptions struct { // Logger if set to a non-nil value will receive log output for internal // errors that are incidental to program logic, but may be relevant for // diagnosis of general behaviors, such as errors in IO with the unix socket // clients. Logger *logger.Logger // AuxiliaryOutput is an optional serial output sink. It will be closed before // server.Run returns. It is dup'd for each incoming socket. AuxiliaryOutput *os.File // StartAtEnd instructs each connection to begin streaming at the end // of the aux file. StartAtEnd bool }
ServerOptions provide options that parametrize the server's behavior.
Click to show internal directories.
Click to hide internal directories.