sio

package module
v0.0.0-...-2cc3e40 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2013 License: MIT Imports: 4 Imported by: 21

README

Package sio lets you access old serial junk. It's a go-gettable fork and modification of dustin's rs232 package.

Install: $ go get github.com/schleibinger/sio

Online godocs are hosted at go.pkgdoc.org.

Documentation

Overview

Package sio supports communication using a serial port. Currently works only on Linux. Cgo is not used.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Addr

type Addr interface {
	Network() string // name of the network
	String() string  // string form of address
}

Addr represents a network end point address.

type Port

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

func Open

func Open(dev string, rate uint32) (p *Port, err error)

Open returns a Port implementing net.Conn or an error if any. The Port behavior is like of the merged returns of net.DialTCP and net.ListenTCP.Accept, i.e. the net.Conn represents a bidirectional byte stream. The only supported mode ATM is 8N1. The serial line is put into raw mode (e.g. no HW nor XON/XOFF flow control).

Ex.: sio.Open("/dev/ttyS0", syscall.B115200)

func (*Port) Close

func (p *Port) Close() error

Implementation of net.Conn

func (*Port) GetCTS

func (p *Port) GetCTS() (on bool, err error)

GetCTS return the state of p's CTS or an error if any. Depending on the setup this signal may have the opposite direction than expected. In such case this function should not be used.

func (*Port) GetDSR

func (p *Port) GetDSR() (on bool, err error)

GetDSR return the state of p's DSR or an error if any. Depending on the setup this signal may have the opposite direction than expected. In such case this function should not be used.

func (*Port) GetDTR

func (p *Port) GetDTR() (on bool, err error)

GetDTR return the state of p's DTR or an error if any. Depending on the setup this signal may have the opposite direction than expected. In such case this function should not be used.

func (*Port) GetRTS

func (p *Port) GetRTS() (on bool, err error)

GetRTS return the state of p's RTS or an error if any. Depending on the setup this signal may have the opposite direction than expected. In such case this function should not be used.

func (*Port) LocalAddr

func (p *Port) LocalAddr() Addr

Implementation of net.Conn

func (*Port) Read

func (p *Port) Read(b []byte) (n int, err error)

Implementation of net.Conn

func (*Port) RemoteAddr

func (p *Port) RemoteAddr() Addr

Implementation of net.Conn

func (*Port) SetCTS

func (p *Port) SetCTS(on bool) error

SetCTS sets the state of p's CTS to `on`. A non nil error is returned on failure. Depending on the setup this signal may have the opposite direction than expected. In such case this function should not be used.

func (*Port) SetDSR

func (p *Port) SetDSR(on bool) error

SetDSR sets the state of p's DSR to `on`. A non nil error is returned on failure. Depending on the setup this signal may have the opposite direction than expected. In such case this function should not be used.

func (*Port) SetDTR

func (p *Port) SetDTR(on bool) error

SetDTR sets the state of p's DTR to `on`. A non nil error is returned on failure. Depending on the setup this signal may have the opposite direction than expected. In such case this function should not be used.

func (*Port) SetDeadline

func (p *Port) SetDeadline(t time.Time) error

Implementation of net.Conn

func (*Port) SetRTS

func (p *Port) SetRTS(on bool) error

SetRTS sets the state of p's RTS to `on`. A non nil error is returned on failure. Depending on the setup this signal may have the opposite direction than expected. In such case this function should not be used.

func (*Port) SetReadDeadline

func (p *Port) SetReadDeadline(t time.Time) error

Implementation of net.Conn

func (*Port) SetWriteDeadline

func (p *Port) SetWriteDeadline(t time.Time) error

Implementation of net.Conn

func (*Port) Write

func (p *Port) Write(b []byte) (n int, err error)

Implementation of net.Conn

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL