ardilla

package module
v0.0.0-...-8297d20 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: BSD-3-Clause Imports: 15 Imported by: 2

README

La Ardilla de Tierra for El Gato Stream Deck

The ardilla package provides a Go interface to El Gato Stream Deck devices.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotConnected = errors.New("device not connected")

ErrNotConnected indicates that the Deck is no longer connected.

Functions

func Serials

func Serials(pid PID) ([]string, error)

Serials returns the list of El Gato device serial numbers matching the provided product ID.

Types

type Deck

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

Deck is a Stream Deck device.

func NewDeck

func NewDeck(pid PID, serial string) (*Deck, error)

NewDeck returns the first a Deck using the HID corresponding the the given Stream Deck pid and serial. If serial is empty the first matching pid is used.

func (*Deck) Bounds

func (d *Deck) Bounds() (image.Rectangle, error)

Bounds returns the image bounds for buttons on the device. If the device is not visual an error is returned.

func (*Deck) Close

func (d *Deck) Close() error

Close closes the device.

func (*Deck) Firmware

func (d *Deck) Firmware() (string, error)

Firmware returns the firmware version number of the device.

func (*Deck) Key

func (d *Deck) Key(row, col int) int

Key returns the key number corresponding to the given row and column. It panics if row or col are out of bounds.

func (*Deck) KeyStates

func (d *Deck) KeyStates() ([]bool, error)

KeyStates returns a slice of booleans indicating which buttons are pressed. The length of the returned slice is given by the Len method.

func (*Deck) Layout

func (d *Deck) Layout() (rows, cols int)

Layout returns the number of rows and columns of buttons on the device.

func (*Deck) Len

func (d *Deck) Len() int

Len returns the number of buttons on the device.

func (*Deck) PID

func (d *Deck) PID() PID

PID returns the effective PID of the receiver..

func (*Deck) RawImage

func (d *Deck) RawImage(img image.Image) (*RawImage, error)

RawImage returns an image.Image has had the internal image representation pre-computed after resizing to fit the Deck's button size. The original image is retained in the returned image.

func (*Deck) Reconnect

func (d *Deck) Reconnect(ctx context.Context, delay time.Duration) error

Reconnect attempts to reconnect to the receiver's device each delay until successful or the context is cancelled. Reconnect returns the last error if ctx is cancelled.

func (*Deck) Reset

func (d *Deck) Reset() error

Resets the Stream Deck, clearing all button images and showing the standby image.

func (*Deck) ResetKeyStream

func (d *Deck) ResetKeyStream() error

ResetKeyStream sends a blank key report to the Stream Deck, resetting the key image streamer in the device. This prevents previously started partial writes from corrupting images sent later.

func (*Deck) Serial

func (d *Deck) Serial() (string, error)

Serial returns the serial number of the device.

func (*Deck) SetBrightness

func (d *Deck) SetBrightness(percent int) error

SetBrightness sets the global screen brightness of the Stream Deck, across all the device's buttons.

func (*Deck) SetImage

func (d *Deck) SetImage(row, col int, img image.Image) error

SetImage renders the provided image on the button at the given row and column. If img is a *RawImage the internal representation will be used directly.

type PID

type PID uint16

PID is an El Gato HID product ID.

const (
	StreamDeckMini       PID = 0x0063
	StreamDeckMiniV2     PID = 0x0090
	StreamDeckOriginal   PID = 0x0060
	StreamDeckOriginalV2 PID = 0x006d
	StreamDeckMK2        PID = 0x0080
	StreamDeckXL         PID = 0x006c
	StreamDeckPedal      PID = 0x0086
)

func (PID) String

func (i PID) String() string

type RawImage

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

RawImage is an image.Image that holds pre-computed data in the raw format used by a specific El Gato Stream Deck device.

Directories

Path Synopsis
tests

Jump to

Keyboard shortcuts

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