Documentation ¶
Overview ¶
Package sio supports communication using a serial port. Currently works only on Linux. Cgo is not used.
Index ¶
- type Addr
- type Port
- func (p *Port) Close() error
- func (p *Port) GetCTS() (on bool, err error)
- func (p *Port) GetDSR() (on bool, err error)
- func (p *Port) GetDTR() (on bool, err error)
- func (p *Port) GetRTS() (on bool, err error)
- func (p *Port) LocalAddr() Addr
- func (p *Port) Read(b []byte) (n int, err error)
- func (p *Port) RemoteAddr() Addr
- func (p *Port) SetCTS(on bool) error
- func (p *Port) SetDSR(on bool) error
- func (p *Port) SetDTR(on bool) error
- func (p *Port) SetDeadline(t time.Time) error
- func (p *Port) SetRTS(on bool) error
- func (p *Port) SetReadDeadline(t time.Time) error
- func (p *Port) SetWriteDeadline(t time.Time) error
- func (p *Port) Write(b []byte) (n int, err error)
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 ¶
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) GetCTS ¶
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 ¶
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 ¶
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 ¶
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) SetCTS ¶
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 ¶
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 ¶
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) SetRTS ¶
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 ¶
Implementation of net.Conn
func (*Port) SetWriteDeadline ¶
Implementation of net.Conn