pixoo64

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: MIT Imports: 12 Imported by: 0

README

GoDoc

pixoo64

This is a simple to use lib to send data to pixoo64. It requires the device's IP address on the local network, which can be obtained from the devices list on the official app.

Documentation: http://docin.divoom-gz.com/web/#/5/23

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Anim

type Anim struct {
	Frames []*Image
}

func NewAnim

func NewAnim() *Anim

func (*Anim) AppendFrame

func (a *Anim) AppendFrame(img image.Image, time int) error

AppendFrame will add the given image to the list. If it is a pixoo64.Image then the time parameter will be ignored, and the image's original time will be used.

func (*Anim) SendTo

func (a *Anim) SendTo(dev *Pixoo64) error

type Config

type Config struct {
	Brightness          int
	RotationFlag        int // 1
	ClockTime           int // 60
	GalleryTime         int // 60
	SingleGalleyTime    int // -1
	PowerOnChannelId    int // 1
	GalleryShowTimeFlag int // 0|1
	CurClockId          int // 64
	Time24Flag          int
	TemperatureMode     int
	GyrateAngle         int
	MirrorFlag          int
	LightSwitch         int
}

Config is the object returned by GetAllConf

type GetHttpGifId

type GetHttpGifId struct {
	PicId int
}

type Image

type Image struct {
	// Pix holds the image's pixels, in R, G, B order.
	Pix    []uint8
	Stride int
	Rect   image.Rectangle
	Time   int // image's display time in ms
}

func ConvertImage

func ConvertImage(img image.Image, time int) (*Image, error)

ConvertImage will take any image.Image and return a suitable image object unless the image size is not one of 16, 32 or 64 This is useful when loading for example a png image without having to care for its pixel format.

func NewImage

func NewImage(size, time int) (*Image, error)

NewImage creates a new pixoo64 format image. Size can only be 16, 32 or 64 pixels. Time is expressed in milliseconds.

func (*Image) At

func (i *Image) At(x, y int) color.Color

func (*Image) Bounds

func (i *Image) Bounds() image.Rectangle

func (*Image) ColorModel

func (i *Image) ColorModel() color.Model

func (*Image) PixOffset

func (i *Image) PixOffset(x, y int) int

func (*Image) RGBAAt

func (i *Image) RGBAAt(x, y int) color.RGBA

func (*Image) SendTo

func (i *Image) SendTo(dev *Pixoo64) error

func (*Image) Set

func (i *Image) Set(x, y int, c color.Color)

func (*Image) SetRGBA

func (i *Image) SetRGBA(x, y int, c color.RGBA)

func (*Image) SubImage

func (i *Image) SubImage(r image.Rectangle) image.Image

type Pixoo64

type Pixoo64 struct {
	DeviceName      string // "Pixoo64"
	DeviceId        int    // 300054377
	DeviceMac       string // "c8f09e3b0964"
	DevicePrivateIP string
}

func FindFirst

func FindFirst() (*Pixoo64, error)

func FindId

func FindId(id int) (*Pixoo64, error)

func FindMac

func FindMac(mac string) (*Pixoo64, error)

func FindName

func FindName(name string) (*Pixoo64, error)

func New

func New(addr string) *Pixoo64

func SameLANDevices

func SameLANDevices() ([]*Pixoo64, error)

func (*Pixoo64) Buzzer

func (p *Pixoo64) Buzzer(activeTime, offTime, totalTime int) error

Buzzer will cause the device to emit a sound. For example: Buzzer(100, 100, 500)

func (*Pixoo64) GetAllConf

func (p *Pixoo64) GetAllConf() (*Config, error)

GetAllConf retrieves all configuration parameters from the device

func (*Pixoo64) GetDeviceTime

func (p *Pixoo64) GetDeviceTime() (*Time, error)

func (*Pixoo64) GetUser

func (dev *Pixoo64) GetUser() (*User, error)

GetUser fetches and returns information about the owner's of this device

func (*Pixoo64) GetWeatherInfo

func (p *Pixoo64) GetWeatherInfo() (*WeatherInfo, error)

func (*Pixoo64) Reboot

func (p *Pixoo64) Reboot() error

Reboot will reboot the device.

func (*Pixoo64) ResetHttpGifId

func (p *Pixoo64) ResetHttpGifId() error

func (*Pixoo64) ScreenSwitch

func (p *Pixoo64) ScreenSwitch(state bool) error

ScreenSwitch switches the screen on or off

func (*Pixoo64) SelectChannel

func (dev *Pixoo64) SelectChannel(ch int) error

func (*Pixoo64) SetBrightness

func (p *Pixoo64) SetBrightness(v int) error

SetBrightness sets the device's brightness between 0 and 100

func (*Pixoo64) SetLocation

func (p *Pixoo64) SetLocation(long, lat float64) error

SetLocation sets the location for which weather data is pulled from https://openweathermap.org/

func (*Pixoo64) SetTime

func (p *Pixoo64) SetTime(t time.Time) error

func (*Pixoo64) SetTimezone

func (p *Pixoo64) SetTimezone(tz string) error

func (*Pixoo64) ShortBeeps

func (p *Pixoo64) ShortBeeps(count int) error

ShortBeeps will call Buzzer in order to perform a number of beeps, this can be useful to have some values mean specific things, just like old time BIOS beeps.

type Time

type Time struct {
	UTCTime   int64
	LocalTime string
}

func (*Time) Time

func (t *Time) Time() time.Time

type User

type User struct {
	Nickname string
	HeadId   string // group1/M00/02/4B/L1ghblsVCSaEKftOAAAAABIDWZY45.head
	Level    int
	Score    int
	LikeCnt  int
	FansCnt  int
}

type WeatherInfo

type WeatherInfo struct {
	Weather    string // "cloudy"
	CurTemp    float64
	MinTemp    float64
	MaxTemp    float64
	Pressure   int
	Humidity   int
	Visibility int
	WindSpeed  float64
}

Jump to

Keyboard shortcuts

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