led_strip

package
v0.0.0-...-25e8c23 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnnouncementMqttPath = "leds/announcement"

	QosAtMostOnce  = 0
	QosAtLeastOnce = 1
	QosExactlyOnce = 2
)
View Source
const (
	SolidColorMode     = "SINGLE_COLOR_RGB"
	GradientColorMode  = "GRADIENT_RGB"
	AnimationColorMode = "ANIMATION_RGB"
)

Variables

View Source
var (
	ErrIdUnknown = errors.New("id is not known")
	ErrTimeout   = errors.New("timeout on request occurred")
)

Functions

This section is empty.

Types

type AnimationMessage

type AnimationMessage struct {
	Mode           string  `json:"mode"`
	AnimationSpeed int     `json:"animation_speed"`
	Config         []Color `json:"config"`
}

type AnnouncementMessage

type AnnouncementMessage struct {
	DeviceName   string `json:"device_name"`
	DeviceId     string `json:"device_id"`
	IsHealthy    bool   `json:"is_healthy"`
	ErrorMessage string `json:"error_message"`
}

type Client

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

func NewClient

func NewClient(host string, retry int, storedDevices map[string]string) (*Client, error)

func (*Client) ConnectLedStrips

func (c *Client) ConnectLedStrips() map[string]string

ConnectLedStrips returns the currently known connected led strips

func (*Client) InformationById

func (c *Client) InformationById(id string) (Information, error)

InformationById returns the information of a led strip with the given id returns an error in case of failure

func (*Client) SetAnimationBreathing

func (c *Client) SetAnimationBreathing(col Color) error

SetAnimationBreathing sets the mode of all known led strips to the animation breathing cycle, increasing and decreasing the brightness of the provided color returns an error in case of failure

func (*Client) SetAnimationBreathingById

func (c *Client) SetAnimationBreathingById(col Color, id string) error

SetAnimationBreathingById sets the mode of the led strip for the provided id to the animation breathing cycle, increasing and decreasing the brightness of the provided color returns an error in case of failure

func (*Client) SetAnimationChristmasById

func (c *Client) SetAnimationChristmasById(id string) error

func (*Client) SetAnimationColorCycle

func (c *Client) SetAnimationColorCycle() error

SetAnimationColorCycle sets the mode of all known led strips to the animation color cycle returns an error in case of failure

func (*Client) SetAnimationColorCycleById

func (c *Client) SetAnimationColorCycleById(id string) error

SetAnimationColorCycleById sets the mode of the led strip for the given id to the animation color cycle returns an error in case of failure

func (*Client) SetCustomData

func (c *Client) SetCustomData(data []byte) error

SetCustomData pushes the given data directly to all known led strips. !Important: can mess up the led strips returns an error in case of failure

func (*Client) SetCustomDataById

func (c *Client) SetCustomDataById(data []byte, id string) error

SetCustomDataById pushes the given data directly to the led strip for the given id !Important: can mess up the led strips returns an error in case of failure

func (*Client) SetOnLedStripOnlineCallback

func (c *Client) SetOnLedStripOnlineCallback(f func(string, string))

func (*Client) SetSolidColor

func (c *Client) SetSolidColor(col Color) error

SetSolidColor sets the color for all known led strips returns an error in case of failure

func (*Client) SetSolidColorById

func (c *Client) SetSolidColorById(col Color, id string) error

SetSolidColorById sets the color of a single led strip with the given id returns an error in case of failure

type Color

type Color struct {
	R int `json:"r"`
	G int `json:"g"`
	B int `json:"b"`
}

type Information

type Information struct {
	DeviceName   string `json:"device_name"`
	DeviceId     string `json:"device_id"`
	IsHealthy    bool   `json:"is_healthy"`
	ErrorMessage string `json:"error_message"`
}

TODO: Change this information. Also do this in the C++ code

type SolidColorMessage

type SolidColorMessage struct {
	Mode string `json:"mode"`

	R int `json:"r"`
	G int `json:"g"`
	B int `json:"b"`
}

Jump to

Keyboard shortcuts

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