govoom

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 6 Imported by: 0

README

govoom

Go Library to interact with devices from divoom (eg. Pixoo-64)

Installation

go get github.com/roemer/govoom

Usage

devices, err := govoom.FindDevices()
if err != nil {
    // Handle error
}
client := devices[0].GetClient()
// Interact with the client now, eg:
client.SetBrightness(100)

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidBrightness = fmt.Errorf("brightness should be in range of 0-100")
)

Functions

func ImageToRGB24Bytes

func ImageToRGB24Bytes(img image.Image) []byte

Types

type Client

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

func NewClient

func NewClient(deviceIp string) *Client

func NewClientFromDevice

func NewClientFromDevice(d *Device) *Client

func (*Client) ClearAllTextArea

func (c *Client) ClearAllTextArea() error

func (*Client) GetSendingAnimationPicID

func (c *Client) GetSendingAnimationPicID() (int, error)

func (*Client) ResetSendingAnimationPicId

func (c *Client) ResetSendingAnimationPicId() error

func (*Client) SendAnimation

func (c *Client) SendAnimation(animationId int, numPictures int, pictureIndex int, width int, speed int, picData []byte) error

func (*Client) SendDisplayList

func (c *Client) SendDisplayList(elements ...DisplayListElement) error

func (*Client) SendText

func (c *Client) SendText(id, x, y int, dir TextScrollDirection, font TextFont, width int, str string, speed int, color string, align TextAlignment) error

func (*Client) SetBrightness

func (c *Client) SetBrightness(brightness int) error

func (*Client) SetMirrorMode

func (c *Client) SetMirrorMode(mirrorMode MirrorMode) error

func (*Client) SetRotation

func (c *Client) SetRotation(deviceIp string, rotation RotationAngle) error

type Device

type Device struct {
	DeviceName      string `json:"DeviceName"`
	DeviceID        int    `json:"DeviceId"`
	DevicePrivateIP string `json:"DevicePrivateIP"`
	DeviceMAC       string `json:"DeviceMac"`
}

func FindDevices

func FindDevices() ([]*Device, error)

func (*Device) GetClient

func (d *Device) GetClient() *Client

type DisplayListElement

type DisplayListElement struct {
	Id              int                 `json:"TextId"`
	TextType        TextType            `json:"type"`
	X               int                 `json:"x"`
	Y               int                 `json:"y"`
	ScrollDirection TextScrollDirection `json:"dir"`
	Font            int                 `json:"font"`
	Width           int                 `json:"TextWidth"`
	Height          int                 `json:"Textheight"`
	Text            string              `json:"TextString"`
	Speed           int                 `json:"speed"`
	Color           string              `json:"color"`
	UpdateTime      int                 `json:"update_time"`
	TextAlignment   TextAlignment       `json:"align"`
}

type MirrorMode

type MirrorMode int
const (
	MirrorModeDisable MirrorMode = 0
	MirrorModeEnable  MirrorMode = 1
)

type RotationAngle

type RotationAngle int
const (
	RotationNormal RotationAngle = 0
	Rotation90     RotationAngle = 1
	Rotation180    RotationAngle = 2
	Rotation270    RotationAngle = 3
)

type TextAlignment

type TextAlignment int
const (
	TextAlignmentLeft   TextAlignment = 1
	TextAlignmentMiddle TextAlignment = 2
	TextAlignmentRight  TextAlignment = 3
)

type TextFont

type TextFont int
const (
	TextFont0 TextFont = iota
	TextFont1
	TextFont2
	TextFont3
	TextFont4
	TextFont5
	TextFont6
	TextFont7
)

type TextScrollDirection

type TextScrollDirection int
const (
	TextScrollDirectionLeft  TextScrollDirection = 0
	TextScrollDirectionRight TextScrollDirection = 1
)

type TextType

type TextType int
const (
	TextTypeTimeSecond           TextType = 1
	TextTypeTimeMinute           TextType = 2
	TextTypeTimeHour             TextType = 3
	TextTypeTimeAmPm             TextType = 4
	TextTypeTimeHourMinute       TextType = 5 // hour:min
	TextTypeTimeHourMinuteSecond TextType = 6 // hour:min:sec
	TextTypeDateYear             TextType = 7
	TextTypeDateDay              TextType = 8
	TextTypeDateMonth            TextType = 9
	TextTypeDateMonthYear        TextType = 10 // month-year
	TextTypeDateMonthNameDotDay  TextType = 11 // month-name.day
	TextTypeDateWeekYear         TextType = 12 // day:month:year ???
	TextTypeDateDayName2Char     TextType = 13 // weekday-"SU","MO","TU","WE","TH","FR","SA"
	TextTypeDateDayName3Char     TextType = 14 // weekday-"SUN","MON","TUE","WED","THU","FRI","SAT"
	TextTypeDateDayNameFull      TextType = 15 // weekday-"SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"
	TextTypeDateMonthName3Char   TextType = 16 // month-"JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"
	TextTypeWeatherTemp          TextType = 17 // temperature + c/f
	TextTypeWeatherTodayMaxTemp  TextType = 18
	TextTypeWeatherTodayMinTemp  TextType = 19
	TextTypeWeatherName          TextType = 20 // the weather
	TextTypeNoise                TextType = 21 // the noise value
	TextTypeText                 TextType = 22 // a defined text
	TextTypeNetText              TextType = 23 // an url that responds with a json including the "DispData" string element, eg:http://appin.divoom-gz.com/Device/ReturnCurrentDate?test=0 reponse {"DispData": "2022-01-22 13:51:56"}
)

Jump to

Keyboard shortcuts

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