Documentation ¶
Index ¶
- func Max(x, y int) int
- func Min(x, y int) int
- func RegisterDevicetype(name string, imageSize image.Point, usbProductID uint16, resetPacket []byte, ...)
- type Button
- type ButtonActionHandler
- type ButtonDecorator
- type ButtonDisplay
- type Device
- func (d *Device) ButtonPress(f func(int, *Device, error))
- func (d *Device) ClearButtons()
- func (d *Device) Close()
- func (d *Device) GetName() string
- func (d *Device) ResetComms()
- func (d *Device) SetBrightness(pct int)
- func (d *Device) WriteColorToButton(btnIndex int, colour color.Color) error
- func (d *Device) WriteImageToButton(btnIndex int, filename string) error
- func (d *Device) WriteRawImageToButton(btnIndex int, rawImg image.Image) error
- func (d *Device) WriteTextToButton(btnIndex int, text string, textColour color.Color, ...)
- type StreamDeck
- func (sd *StreamDeck) AddButton(btnIndex int, b Button)
- func (sd *StreamDeck) ButtonUpdateHandler(b Button)
- func (sd *StreamDeck) GetButtonIndex(btnIndex int) Button
- func (sd *StreamDeck) GetName() string
- func (sd *StreamDeck) SetBrightness(brightness int)
- func (sd *StreamDeck) SetDecorator(btnIndex int, d ButtonDecorator)
- func (sd *StreamDeck) UnsetDecorator(btnIndex int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterDevicetype ¶
func RegisterDevicetype( name string, imageSize image.Point, usbProductID uint16, resetPacket []byte, numberOfButtons uint, buttonRows uint, buttonCols uint, brightnessPacket []byte, buttonReadOffset uint, imageFormat string, imagePayloadPerPage uint, imageHeaderFunc func(bytesRemaining uint, btnIndex uint, pageNumber uint) []byte, )
RegisterDevicetype allows the declaration of a new type of device, intended for use by subpackage "devices"
Types ¶
type Button ¶
type Button interface { ButtonDisplay }
Button is the interface to satisfy for being a button; currently this is a direct proxy for the `ButtonDisplay` interface as there isn't a requirement to handle being pressed
type ButtonActionHandler ¶
type ButtonActionHandler interface {
Pressed(Button)
}
ButtonActionHandler is the interface to satisfy for handling a button being pressed, generally via an `actionhandler`
type ButtonDecorator ¶
ButtonDecorator represents a way to modify the button image, for example to add a highlight or an "on/off" hint
type ButtonDisplay ¶
type ButtonDisplay interface { GetImageForButton(int) image.Image GetButtonIndex() int SetButtonIndex(int) RegisterUpdateHandler(func(Button)) Pressed() }
ButtonDisplay is the interface to satisfy for displaying on a button
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
Device is a struct which represents an actual Streamdeck device, and holds its reference to the USB HID device
func OpenWithoutReset ¶
OpenWithoutReset will open a Streamdeck device, without resetting it
func (*Device) ButtonPress ¶
ButtonPress registers a callback to be called whenever a button is pressed
func (*Device) ClearButtons ¶
func (d *Device) ClearButtons()
ClearButtons writes a black square to all buttons
func (*Device) ResetComms ¶
func (d *Device) ResetComms()
ResetComms will reset the comms protocol to the StreamDeck; useful if things have gotten de-synced, but it will also reboot the StreamDeck
func (*Device) SetBrightness ¶
SetBrightness sets the button brightness pct is an integer between 0-100
func (*Device) WriteColorToButton ¶
WriteColorToButton writes a specified color to the given button
func (*Device) WriteImageToButton ¶
WriteImageToButton writes a specified image file to the given button
func (*Device) WriteRawImageToButton ¶
WriteRawImageToButton takes an `image.Image` and writes it to the given button, after resizing and rotating the image to fit the button (for some reason the StreamDeck screens are all upside down)
type StreamDeck ¶
type StreamDeck struct {
// contains filtered or unexported fields
}
StreamDeck is the main struct to represent a StreamDeck device, and internally contains the reference to a `Device`
func New ¶
func New() (*StreamDeck, error)
New will return a new instance of a `StreamDeck`, and is the main entry point for the higher-level interface. It will return an error if there is no StreamDeck plugged in.
func (*StreamDeck) AddButton ¶
func (sd *StreamDeck) AddButton(btnIndex int, b Button)
AddButton adds a `Button` object to the StreamDeck at the specified index
func (*StreamDeck) ButtonUpdateHandler ¶
func (sd *StreamDeck) ButtonUpdateHandler(b Button)
ButtonUpdateHandler allows a user of this library to signal when something external has changed, such that this button should be update
func (*StreamDeck) GetButtonIndex ¶
func (sd *StreamDeck) GetButtonIndex(btnIndex int) Button
GetButtonByIndex returns a button for the given index
func (*StreamDeck) GetName ¶
func (sd *StreamDeck) GetName() string
GetName returns the name of the type of Streamdeck
func (*StreamDeck) SetBrightness ¶
func (sd *StreamDeck) SetBrightness(brightness int)
func (*StreamDeck) SetDecorator ¶
func (sd *StreamDeck) SetDecorator(btnIndex int, d ButtonDecorator)
SetDecorator imposes a ButtonDecorator onto a given button
func (*StreamDeck) UnsetDecorator ¶
func (sd *StreamDeck) UnsetDecorator(btnIndex int)
UnsetDecorator removes a ButtonDecorator from a given button