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, ...)
- func Search() []*deviceSearchResult
- type Button
- type ButtonActionHandler
- type ButtonDecorator
- type ButtonDisplay
- type Device
- func (d *Device) ButtonPress(f func(int, *Device, error, bool))
- func (d *Device) ClearButtons()
- func (d *Device) Close()
- func (d *Device) EncoderPress(f func(int, *Device, bool))
- func (d *Device) EncoderRotate(f func(int, *Device, int))
- func (d *Device) GetImageSize() image.Point
- func (d *Device) GetName() string
- func (d *Device) GetNumberOfButtons() uint
- func (d *Device) GetSerial() string
- func (d *Device) GetUSBProductId() int
- func (d *Device) HasImageCapability() bool
- func (d *Device) ResetComms()
- func (d *Device) SetBrightness(pct int)
- func (d *Device) TouchPush(f func(*Device, uint16, uint16, bool))
- func (d *Device) TouchSwipe(f func(*Device, uint16, uint16, uint16, uint16))
- func (d *Device) WriteColorToButton(btnIndex int, colour color.Color) error
- func (d *Device) WriteImageToButton(btnIndex int, filename string) error
- func (d *Device) WriteRawImageToAreaUnscaled(x, y int, rawImg image.Image) 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, buttonMap map[uint]int, imageHeaderFunc func(bytesRemaining uint, btnIndex uint, pageNumber uint) []byte, imageAreaHeaderFunc func(bytesRemaining uint, x, y, width, height 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 OpenBySerial ¶
Open a Streamdeck device, the most common entry point
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 (or connection is lost!)
func (*Device) ClearButtons ¶
func (d *Device) ClearButtons()
ClearButtons writes a black square to all buttons
func (*Device) EncoderPress ¶
EncoderPress registers a callback to be called whenever an encoder is pressed
func (*Device) EncoderRotate ¶
EncoderRotate registers a callback to be called whenever an encoder is rotated
func (*Device) GetImageSize ¶
GetImageSize returns the size of images on this Streamdeck
func (*Device) GetNumberOfButtons ¶
func (*Device) GetUSBProductId ¶
func (*Device) HasImageCapability ¶
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) TouchPush ¶
TouchPush registers a callback to be called whenever the touch area is pushed (tap or hold)
func (*Device) TouchSwipe ¶
TouchSwipe registers a callback to be called whenever the touch area is swiped
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) WriteRawImageToAreaUnscaled ¶
y doesn't work, keep it zero!
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