pactor

package
v1.0.1-0...-bb52ee2 Latest Latest
Warning

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

Go to latest
Published: May 30, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SerialTimeout = 1
	PactorChannel = 31
	MaxSendData   = 256
	MaxFrameNotTX = 2
)

SerialTimeout: Timeout for read operations on serial bus PactorChannel: Pactor channel, 31 should work for both, PTC-IIex and P4 Dragon MaxSendData: Pactor internal command buffer is 256 byte MaxFrameNotTX: Max. number of frames not transmitted at time.

Variables

This section is empty.

Functions

This section is empty.

Types

type Addr

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

func (Addr) Network

func (a Addr) Network() string

func (Addr) String

func (a Addr) String() string

type Modem

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

func OpenModem

func OpenModem(path string, baudRate int, myCall string, initScript string, cmdlineinit string) (p *Modem, err error)

Initialise the pactor modem and all variables. Switch the modem into hostmode. Start the link setup.

Will abort if modem reports failed link setup, Close() is called or timeout has occured (90 seconds)

func (*Modem) Close

func (p *Modem) Close() error

Close closes the current connection.

Will abort ("dirty disconnect") after 60 seconds if normal "disconnect" have not succeeded yet.

func (*Modem) DialURL

func (p *Modem) DialURL(url *transport.URL) (net.Conn, error)

DialURL dials pactor:// URLs

BLOCK until connection is established or timeoud occured

func (*Modem) Flush

func (p *Modem) Flush() (err error)

Flush waits for the last frames to be transmitted.

Will throw error if remaining frames could not bet sent within 120s

func (*Modem) Listen

func (p *Modem) Listen() (ln net.Listener, err error)

func (*Modem) LocalAddr

func (p *Modem) LocalAddr() net.Addr

func (*Modem) Read

func (p *Modem) Read(d []byte) (int, error)

Read bytes from the Software receive buffer. The receive thread takes care of reading them from the pactor modem

BLOCK until receive buffer has any data!

func (*Modem) RemoteAddr

func (p *Modem) RemoteAddr() net.Addr

func (*Modem) SetDeadline

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

func (*Modem) SetReadDeadline

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

func (*Modem) SetWriteDeadline

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

func (*Modem) TxBufferLen

func (p *Modem) TxBufferLen() int

TxBufferLen returns the number of bytes in the out buffer queue.

func (*Modem) Write

func (p *Modem) Write(d []byte) (int, error)

Write bytes to the software send buffer. The send thread will take care of fowarding them to the pactor modem

BLOCK if send buffer is full! Remains as soon as there is space left in the send buffer

type State

type State uint8
const (
	Unknown State = iota
	LinkSetup
	Connected
	DisconnectReq
	Disconnected
)

Pactor states

Directories

Path Synopsis
module

Jump to

Keyboard shortcuts

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