device

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IP

type IP struct {
	net.Conn
	Timeout time.Duration
}

IP represents a Weatherlink IP device.

func (*IP) Dial

func (i *IP) Dial(addr string) (err error)

Dial establishes a TCP/IP connection with a Weatherlink IP.

func (IP) Flush

func (i IP) Flush() error

Flush flushes the input buffers of the Weatherlink IP.

func (IP) Read

func (i IP) Read(b []byte) (int, error)

Read reads up to the size of the provided byte buffer from the Weatherlink IP. It blocks until at least one byte is read or the timeout triggers. In practice, exactly how much it reads beyond one byte seems unpredictable.

func (IP) ReadFull

func (i IP) ReadFull(b []byte) (int, error)

ReadFull reads the full size of the provided byte buffer from the Weatherlink IP. It blocks until the entire buffer is filled or the timeout triggers.

func (IP) Write

func (i IP) Write(b []byte) (int, error)

Write writes the byte buffer to the Weatherlink IP.

type Serial

type Serial struct {
	*term.Term
	Timeout time.Duration
}

Serial represents a Weatherlink serial or USB device.

func (*Serial) Dial

func (s *Serial) Dial(addr string) (err error)

Dial opens a serial port connection with a weatherlink device.

func (Serial) ReadFull

func (s Serial) ReadFull(b []byte) (int, error)

ReadFull reads the full size of the provided byte buffer from the Weatherlink device. It blocks until the entire buffer is filled or the timeout triggers.

type Sim

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

Sim represents a simulted Weatherlink device.

func (*Sim) Close

func (s *Sim) Close() error

Close closes the simulated Weatherlink device.

func (*Sim) Dial

func (s *Sim) Dial(addr string) error

Dial initializes the state of a simulated Weatherlink device.

func (Sim) Flush

func (Sim) Flush() error

Flush flushes the input buffers of the simulated Weatherlink device.

func (Sim) Read

func (Sim) Read([]byte) (int, error)

Read reads up to the size of the provided byte buffer from the simulated Weatherlink device.

func (*Sim) ReadFull

func (s *Sim) ReadFull(b []byte) (n int, err error)

ReadFull reads the full size of the provided byte buffer from the simulted Weatherlink device.

func (*Sim) Write

func (s *Sim) Write(b []byte) (int, error)

Write simulates a write of the byte buffer.

Jump to

Keyboard shortcuts

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