broadlink_client

package
v0.0.0-...-ebfecad Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient() (c *Client, err error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Discover

func (c *Client) Discover(timeout time.Duration) ([]*Device, error)

type Device

type Device struct {
	Name     string
	Type     uint16
	MAC      net.HardwareAddr
	Addr     net.UDPAddr
	LastSeen time.Time
	ID       int32
	Key      []byte
	// contains filtered or unexported fields
}

func (*Device) Auth

func (d *Device) Auth(timeout time.Duration) error

func (*Device) Discover

func (d *Device) Discover(timeout time.Duration) error

func (*Device) GetSensorData

func (d *Device) GetSensorData(timeout time.Duration) (*SensorData, error)

func (*Device) Learn

func (d *Device) Learn(timeout time.Duration) ([]byte, error)

func (*Device) SendIR

func (d *Device) SendIR(data []byte, timeout time.Duration) error

type PersistentClient

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

func NewPersistentClient

func NewPersistentClient() (*PersistentClient, error)

func (*PersistentClient) Close

func (c *PersistentClient) Close()

func (*PersistentClient) GetDeviceForIP

func (c *PersistentClient) GetDeviceForIP(ip string) (*PersistentDevice, error)

func (*PersistentClient) GetDeviceForMac

func (c *PersistentClient) GetDeviceForMac(mac string) (*PersistentDevice, error)

func (*PersistentClient) GetDevices

func (c *PersistentClient) GetDevices() []*PersistentDevice

type PersistentDevice

type PersistentDevice struct {
	Name     string
	Type     uint16
	MAC      net.HardwareAddr
	Addr     net.UDPAddr
	LastSeen time.Time
	ID       int32
	Key      []byte
	// contains filtered or unexported fields
}

func FromDeviceAndPersistentClient

func FromDeviceAndPersistentClient(device *Device, persistentClient *PersistentClient) *PersistentDevice

func (*PersistentDevice) Auth

func (d *PersistentDevice) Auth(timeout time.Duration) error

func (*PersistentDevice) Discover

func (d *PersistentDevice) Discover(timeout time.Duration) error

func (*PersistentDevice) GetSensorData

func (d *PersistentDevice) GetSensorData(timeout time.Duration) (*SensorData, error)

func (*PersistentDevice) Learn

func (d *PersistentDevice) Learn(timeout time.Duration) ([]byte, error)

func (*PersistentDevice) SendIR

func (d *PersistentDevice) SendIR(data []byte, timeout time.Duration) error

type Request

type Request struct {
	ID        RequestID
	Payload   []byte
	DstAddr   *net.UDPAddr
	Responses chan *Response
	SentAt    time.Time
}

type RequestID

type RequestID struct {
	DstAddr        string
	SequenceNumber int16
}

type Response

type Response struct {
	RequestID  RequestID
	SrcAddr    *net.UDPAddr
	Payload    []byte
	Err        error
	ReceivedAt time.Time
}

type SensorData

type SensorData struct {
	Temperature float64
	Humidity    float64
}

type StatelessDevice

type StatelessDevice struct {
	Name     string
	Type     uint16
	MAC      net.HardwareAddr
	Addr     net.UDPAddr
	LastSeen time.Time
	ID       int32
	Key      []byte
	// contains filtered or unexported fields
}

func Discover

func Discover(timeout time.Duration) ([]*StatelessDevice, error)

func FromDevice

func FromDevice(device *Device) (*StatelessDevice, error)

func FromHost

func FromHost(host string) (*StatelessDevice, error)

func (*StatelessDevice) Auth

func (d *StatelessDevice) Auth(timeout time.Duration) error

func (*StatelessDevice) Discover

func (d *StatelessDevice) Discover(timeout time.Duration) error

func (*StatelessDevice) GetSensorData

func (d *StatelessDevice) GetSensorData(timeout time.Duration) (*SensorData, error)

func (*StatelessDevice) Learn

func (d *StatelessDevice) Learn(timeout time.Duration) ([]byte, error)

func (*StatelessDevice) SendIR

func (d *StatelessDevice) SendIR(data []byte, timeout time.Duration) error

Jump to

Keyboard shortcuts

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