openrgb

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2024 License: MIT Imports: 10 Imported by: 0

README

go-openrgb-sdk

This library implements the OpenRGB SDK. It is recommended to use server protocol version 1 at least (OpenRGB version 0.5 or newer).

Install

Go 1.18 is the minimum supported version.

go get github.com/csutorasa/go-openrgb-sdk

Example

Examples can be found in the example directory.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ColorBlack = Color{R: 0, G: 0, B: 0}
View Source
var ColorBlue = Color{R: 0, G: 0, B: 255}
View Source
var ColorCyan = Color{R: 0, G: 255, B: 255}
View Source
var ColorGreen = Color{R: 0, G: 255, B: 0}
View Source
var ColorMagenta = Color{R: 255, G: 0, B: 255}
View Source
var ColorRed = Color{R: 255, G: 0, B: 0}
View Source
var ColorWhite = Color{R: 255, G: 255, B: 255}
View Source
var ColorYellow = Color{R: 255, G: 255, B: 0}

Functions

func Loop

func Loop(c *Client, delay time.Duration, loop func(Controllers) error) error

Types

type Client

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

Client for communicating with an OpenRGB server. Create a new client with NewClient(). Calling RequestProtocolVersion() is recommended to sync versions of server and client.

func NewClient

func NewClient(conn net.Conn) *Client

Creates a new client from a connection.

func NewClientHostPort

func NewClientHostPort(host string, port int) (*Client, error)

Creates a new client from a hostname and a port number.

func NewDefaultClient

func NewDefaultClient() (*Client, error)

Creates a new default client.

func NewLocalClient

func NewLocalClient(port int) (*Client, error)

Creates a new client to locahost from a port number.

func (*Client) AssertServerVersion

func (c *Client) AssertServerVersion(v Version) error

Returns an error if server version is lower that the given version. RequestProtocolVersion() needs to be called before this function.

func (*Client) Close

func (c *Client) Close() error

Closes all resources used by the client.

func (*Client) CommonVersion

func (c *Client) CommonVersion() Version

Finds the lowest common version between the client and the server. RequestProtocolVersion() needs to be called before this function.

func (*Client) DeviceListUpdatedHandler

func (c *Client) DeviceListUpdatedHandler(h DeviceListUpdatedHandler)

Registers or overrides a handler to handle requests from the server.

func (*Client) Initialize

func (c *Client) Initialize(name string) error

Initializes the client.

func (*Client) RGBControllerResizeZone

func (c *Client) RGBControllerResizeZone(deviceId uint32, req *RGBControllerResizeZoneRequest) error

Resizes a zone.

func (*Client) RGBControllerSaveMode

func (c *Client) RGBControllerSaveMode(deviceId uint32, req *RGBControllerSaveModeRequest) error

Saves the mode.

func (*Client) RGBControllerSetCustomMode

func (c *Client) RGBControllerSetCustomMode(deviceId uint32) error

Set custom mode.

func (*Client) RGBControllerUpdateLeds

func (c *Client) RGBControllerUpdateLeds(deviceId uint32, req *RGBControllerUpdateLedsRequest) error

Updates LEDs.

func (*Client) RGBControllerUpdateMode

func (c *Client) RGBControllerUpdateMode(deviceId uint32, req *RGBControllerUpdateModeRequest) error

Updates the mode.

func (*Client) RGBControllerUpdateSingleLed

func (c *Client) RGBControllerUpdateSingleLed(deviceId uint32, req *RGBControllerUpdateSingleLedRequest) error

Updates a single LED.

func (*Client) RGBControllerUpdateZoneLeds

func (c *Client) RGBControllerUpdateZoneLeds(deviceId uint32, req *RGBControllerUpdateZoneLedsRequest) error

Updates zone LEDs.

func (*Client) RequestControllerCount

func (c *Client) RequestControllerCount() (*RequestControllerCountResponse, error)

Gets the number of available devices.

func (*Client) RequestControllerCountCtx

func (c *Client) RequestControllerCountCtx(ctx context.Context) (*RequestControllerCountResponse, error)

Gets the number of available devices.

func (*Client) RequestControllerData

func (c *Client) RequestControllerData(deviceId uint32) (*RequestControllerDataResponse, error)

Gets the details of a device.

func (*Client) RequestControllerDataCtx

func (c *Client) RequestControllerDataCtx(ctx context.Context, deviceId uint32) (*RequestControllerDataResponse, error)

Gets the details of a device.

func (*Client) RequestDeleteProfile

func (c *Client) RequestDeleteProfile(req *RequestDeleteProfileRequest) error

Deletes the profile.

func (*Client) RequestLoadProfile

func (c *Client) RequestLoadProfile(req *RequestLoadProfileRequest) error

Loads the profile.

func (*Client) RequestProfileList

func (c *Client) RequestProfileList() (*RequestProfileListResponse, error)

Gets the available profiles.

func (*Client) RequestProfileListCtx

func (c *Client) RequestProfileListCtx(ctx context.Context) (*RequestProfileListResponse, error)

Gets the available profiles.

func (*Client) RequestProtocolVersion

func (c *Client) RequestProtocolVersion() error

Gets the server protocol version.

func (*Client) RequestProtocolVersionCtx

func (c *Client) RequestProtocolVersionCtx(ctx context.Context) error

Gets the server protocol version.

func (*Client) RequestSaveProfile

func (c *Client) RequestSaveProfile(req *RequestSaveProfileRequest) error

Saves the profile.

func (*Client) SendPacket

func (c *Client) SendPacket(req *NetPacket) error

Sends a net packet to the server and expects no answer.

func (*Client) SendPacketAndExpectPacket

func (c *Client) SendPacketAndExpectPacket(req *NetPacket) (*NetPacket, error)

Sends a packet to the server and expects an answer packet.

func (*Client) SendPacketAndExpectPacketCtx

func (c *Client) SendPacketAndExpectPacketCtx(ctx context.Context, req *NetPacket) (*NetPacket, error)

Sends a packet to the server and expects an answer packet.

func (*Client) SendRequest

func (c *Client) SendRequest(req NetPacketRequest) error

Sends a request to the server and expects no answer.

func (*Client) SendRequestAndExpectResponse

func (c *Client) SendRequestAndExpectResponse(req NetPacketRequest, res NetPacketResponse) (*NetPacket, error)

Sends a request to the server and expects an answer response.

func (*Client) SendRequestAndExpectResponseCtx

func (c *Client) SendRequestAndExpectResponseCtx(ctx context.Context, req NetPacketRequest, res NetPacketResponse) (*NetPacket, error)

Sends a request to the server and expects an answer response.

func (*Client) SendRequestForDevice

func (c *Client) SendRequestForDevice(deviceId uint32, req NetPacketRequest) error

Sends a request to the server and expects no answer.

func (*Client) SendRequestForDeviceAndExpectResponse

func (c *Client) SendRequestForDeviceAndExpectResponse(deviceId uint32, req NetPacketRequest, res NetPacketResponse) (*NetPacket, error)

Sends a request for a device to the server and expects an answer response.

func (*Client) SendRequestForDeviceAndExpectResponseCtx

func (c *Client) SendRequestForDeviceAndExpectResponseCtx(ctx context.Context, deviceId uint32, req NetPacketRequest, res NetPacketResponse) (*NetPacket, error)

Sends a request for a device to the server and expects an answer response.

func (*Client) SetClientName

func (c *Client) SetClientName(req *SetClientNameRequest) error

Sets the client name.

type Color

type Color struct {
	R uint8
	G uint8
	B uint8
}

func NewRGBColor

func NewRGBColor(colors color.Color) Color

func (*Color) Decode

func (c *Color) Decode(v Version, p *NetPacketDataParser) error

Decode implements DataDecoder.

func (Color) Encode

func (c Color) Encode(v Version, b *NetPacketDataBuilder) []byte

Encode implements DataEncoder.

type Colors

type Colors []Color

Helper for multiple led states.

func NewBlackColors

func NewBlackColors(numLeds int) Colors

Create LED states off state.

func NewColors

func NewColors(numLeds int, c Color) Colors

Create LED states with a predefined color.

func (Colors) ShiftLeft

func (c Colors) ShiftLeft(i int) Colors

Moves the light to the left.

func (Colors) ShiftRight

func (c Colors) ShiftRight(i int) Colors

Moves the light to the right.

type ControllerCache

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

Cache to use for controller data. Create a new cache with NewControllerCache().

func NewControllerCache

func NewControllerCache(c *Client) *ControllerCache

Creates a new ControllerCache.

func (*ControllerCache) Controllers

func (c *ControllerCache) Controllers() (Controllers, error)

Gets the controllers.

func (*ControllerCache) Invalidate

func (c *ControllerCache) Invalidate()

Invalidates the current state. This should be called when a DeviceListUpdated packet is received.

type ControllerData

type ControllerData struct {
	// RGBController type field value
	Type int32
	// RGBController name field string value
	Name string
	// RGBController vendor field string value
	Vendor string
	// RGBController description field string value
	Description string
	// RGBController version field string value
	Version string
	// RGBController serial field string value
	Serial string
	// RGBController location field string value
	Location string
	// RGBController active_mode field value
	ActiveMode int32
	Modes      Modes
	Zones      Zones
	Leds       []*Led
	Colors     []Color
}

func (*ControllerData) Decode

Decode implements DataDecoder.

type Controllers

type Controllers []*ControllerData

func (Controllers) Find

func (c Controllers) Find(f func(*ControllerData) bool) (uint32, *ControllerData)

Finds a controller by a condition.

func (Controllers) FindByName

func (c Controllers) FindByName(n string) (uint32, *ControllerData)

Finds a controller by name.

type DataDecoder

type DataDecoder interface {
	// Reads the data from the NetPacketDataParser and fills the fields of this object.
	// Field values are changed only when the all reads were successful.
	// Errors can still happen after a successful decode.
	Decode(v Version, p *NetPacketDataParser) error
}

Decodable net packet data.

type DataEncoder

type DataEncoder interface {
	// Gets the body for the request with the given version.
	Encode(v Version, b *NetPacketDataBuilder)
}

Encodable net packet data.

type DeviceListUpdatedHandler

type DeviceListUpdatedHandler func(*DeviceListUpdatedResponse)

Type for handling requests coming from the server.

type DeviceListUpdatedResponse

type DeviceListUpdatedResponse struct {
}

func (*DeviceListUpdatedResponse) Decode

Decode implements DataDecoder.

func (*DeviceListUpdatedResponse) NetPacketId

func (req *DeviceListUpdatedResponse) NetPacketId() NetPacketId

NetPacketId implements NetPacketCommand.

type ExchangeHandler

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

Manages the request-responses for a connection. Create a new handler with NewExchangeHandler().

func NewExchangeHandler

func NewExchangeHandler() *ExchangeHandler

Creates a new ExchangeHandler.

func (*ExchangeHandler) Close

func (eh *ExchangeHandler) Close() error

Sends a nil to all active handles.

func (*ExchangeHandler) Create

func (eh *ExchangeHandler) Create(commandId NetPacketId) chan *NetPacket

Adds a new handle for the command.

func (*ExchangeHandler) Delete

func (eh *ExchangeHandler) Delete(commandId NetPacketId, responseCh chan *NetPacket)

Deletes a handler.

func (*ExchangeHandler) Pop

func (eh *ExchangeHandler) Pop(commandId NetPacketId) chan<- *NetPacket

Gets a handle for the command. Returns nil if no handler was found.

type InvalidPacketHeaderMagicValueError

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

Occurs, when an invalid magic header was found.

func (*InvalidPacketHeaderMagicValueError) Error

Error implements error

type InvalidResponseNetPacketIdError

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

Occurs, when an invalid net packet ID is returned.

func (*InvalidResponseNetPacketIdError) Error

Error implements error

type InvalidServerVersionError

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

Occurs, when the server version is lower than expected.

func (*InvalidServerVersionError) Error

func (e *InvalidServerVersionError) Error() string

Error implements error

type Led

type Led struct {
	// LED name string value
	LedName string
	// LED value field value
	LedValue uint32
}

func (*Led) Decode

func (l *Led) Decode(v Version, p *NetPacketDataParser) error

Decode implements DataDecoder.

type Mode

type Mode struct {
	// Mode name string value
	ModeName string
	// Mode value field value
	ModeValue int32
	// Mode flags field value
	ModeFlags uint32
	// Mode speed_min field value
	ModeSpeedMin uint32
	// Mode speed_max field value
	ModeSpeedMax uint32
	// Mode brightness_min field value
	ModeBrightnessMin uint32
	//Mode brightness_max field value
	ModeBrightnessMax uint32
	// Mode colors_min field value
	ModeColorsMin uint32
	// Mode colors_max field value
	ModeColorsMax uint32
	// Mode speed value
	ModeSpeed uint32
	// Mode brightness value
	ModeBrightness uint32
	// Mode direction value
	ModeDirection uint32
	// Mode color_mode value
	ModeColorMode uint32
	// Mode color values
	ModeColors []Color
}

func (*Mode) Decode

func (m *Mode) Decode(v Version, p *NetPacketDataParser) error

Decode implements DataDecoder.

func (*Mode) Encode

func (m *Mode) Encode(v Version, b *NetPacketDataBuilder)

Encode implements DataEncoder.

func (*Mode) Size

func (m *Mode) Size(v Version) int

type Modes

type Modes []*Mode

func (Modes) FindByName

func (m Modes) FindByName(n string) (uint32, *Mode)

type NetPacket

type NetPacket struct {
	Header *NetPacketHeader
	Data   NetPacketData
}

Packet for requests and responses.

func NewNetPacket

func NewNetPacket(commandId NetPacketId, deviceId uint32, data []byte) *NetPacket

func (*NetPacket) DataParser

func (p *NetPacket) DataParser() *NetPacketDataParser

Creates a parser for the data.

type NetPacketCommand

type NetPacketCommand interface {
	// Gets the packet ID for the command.
	NetPacketId() NetPacketId
}

Net packet command.

type NetPacketData

type NetPacketData []byte

type NetPacketDataBuilder

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

Net packet data builder. The zero value for the builder is an empty data ready to use. All methods increase the size, if needed.

func (*NetPacketDataBuilder) Bytes

func (r *NetPacketDataBuilder) Bytes() []byte

Gets the data of the request.

func (*NetPacketDataBuilder) EnsureSize

func (r *NetPacketDataBuilder) EnsureSize(size int)

Makes sure that there are at least size bytes available.

func (*NetPacketDataBuilder) WriteBytes

func (r *NetPacketDataBuilder) WriteBytes(b []byte)

Writes the data with a slice of bytes.

func (*NetPacketDataBuilder) WriteInt32

func (r *NetPacketDataBuilder) WriteInt32(i int32)

Writes the data with a int32.

func (*NetPacketDataBuilder) WriteLen

func (r *NetPacketDataBuilder) WriteLen(v any)

Writes the data with a uint16 length. It panics if v's Kind is not [Array], [Chan], [Map], [Slice], [String], or pointer to [Array].

func (*NetPacketDataBuilder) WriteUint16

func (r *NetPacketDataBuilder) WriteUint16(i uint16)

Writes the data with a uint16.

func (*NetPacketDataBuilder) WriteUint32

func (r *NetPacketDataBuilder) WriteUint32(i uint32)

Writes the data with a uint32.

func (*NetPacketDataBuilder) WrtieString

func (r *NetPacketDataBuilder) WrtieString(b string)

Writes the data with the length of a string followed by the string data.

type NetPacketDataParser

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

Net packet data parser. Create a new response with NetPacket.DataParser()

func (*NetPacketDataParser) AssertAllRead

func (p *NetPacketDataParser) AssertAllRead() error

Returns an error if there is unread data.

func (*NetPacketDataParser) ReadBytes

func (p *NetPacketDataParser) ReadBytes(l int) ([]byte, error)

Reads the given number of bytes from the content. Returns io.EOF error if the content runs out of data.

func (*NetPacketDataParser) ReadInt32

func (p *NetPacketDataParser) ReadInt32() (int32, error)

Reads an int32 from the content. Returns io.EOF error if the content runs out of data.

func (*NetPacketDataParser) ReadString

func (p *NetPacketDataParser) ReadString() (string, error)

Reads the length of the string, then reads the string itself from the content. Returns io.EOF error if the content runs out of data.

func (*NetPacketDataParser) ReadUint16

func (p *NetPacketDataParser) ReadUint16() (uint16, error)

Reads a uint16 from the content. Returns io.EOF error if the content runs out of data.

func (*NetPacketDataParser) ReadUint32

func (p *NetPacketDataParser) ReadUint32() (uint32, error)

Reads a uint32 from the content. Returns io.EOF error if the content runs out of data.

type NetPacketDecoder

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

Decoder for OpenTGB net packets. Create a new decoder with NewNetPacketDecoder().

func NewNetPacketDecoder

func NewNetPacketDecoder(r io.Reader) *NetPacketDecoder

Creates a new NetPacketDecoder.

func (*NetPacketDecoder) Decode

func (d *NetPacketDecoder) Decode() (*NetPacket, error)

Reads the header and the data from the reader.

type NetPacketEncoder

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

Encoder for OpenRGB net packets. Create a new encoder with NewNetPacketEncoder().

func NewNetPacketEncoder

func NewNetPacketEncoder(w io.Writer) *NetPacketEncoder

Creates a new NetPacketEncoder.

func (*NetPacketEncoder) Encode

func (e *NetPacketEncoder) Encode(p *NetPacket) error

Writes the header and the data to the writer.

type NetPacketHeader

type NetPacketHeader struct {
	// Magic value, "ORGB"
	PktMagic string
	// Device Index
	PktDevIdx uint32
	// Packet ID
	PktId NetPacketId
	// Packet Size
	PktSize uint32
}

Packet header for requests and responses.

type NetPacketId

type NetPacketId uint32

Packet command ID

const (
	// Request RGBController device count from server
	NetPacketIdRequestControllerCount NetPacketId = 0
	// Request RGBController data block
	NetPacketIdRequestControllerData NetPacketId = 1
	// Request OpenRGB SDK protocol version from server
	NetPacketIdRequestProtocolVersion NetPacketId = 40
	// Send client name string to server
	NetPacketIdSetClientName NetPacketId = 50
	// Indicate to clients that device list has updated
	NetPacketIdDeviceListUpdated NetPacketId = 100
	// Request profile list
	NetPacketIdRequestProfileList NetPacketId = 150
	// Save current configuration in a new profile
	NetPacketIdRequestSaveProfile NetPacketId = 151
	// Load a given profile
	NetPacketIdRequestLoadProfile NetPacketId = 152
	// Delete a given profile
	NetPacketIdRequestDeleteProfile NetPacketId = 153
	//RGBController::ResizeZone()
	NetPacketIdRgbcontrollerResizezone NetPacketId = 1000
	// RGBController::UpdateLEDs()
	NetPacketIdRgbcontrollerUpdateleds NetPacketId = 1050
	// RGBController::UpdateZoneLEDs()
	NetPacketIdRgbcontrollerUpdatezoneleds NetPacketId = 1051
	// RGBController::UpdateSingleLED()
	NetPacketIdRgbcontrollerUpdatesingleled NetPacketId = 1052
	// RGBController::SetCustomMode()
	NetPacketIdRgbcontrollerSetcustommode NetPacketId = 1100
	// RGBController::UpdateMode()
	NetPacketIdRgbcontrollerUpdatemode NetPacketId = 1101
	// RGBController::SaveMode()
	NetPacketIdRgbcontrollerSavemode NetPacketId = 1102
)

type NetPacketRequest

type NetPacketRequest interface {
	NetPacketCommand
	DataEncoder
}

Net packet request.

type NetPacketResponse

type NetPacketResponse interface {
	NetPacketCommand
	DataDecoder
}

Net packet response.

type RGBControllerResizeZoneRequest

type RGBControllerResizeZoneRequest struct {
	ZoneIdx int32
	NewSize int32
}

func (*RGBControllerResizeZoneRequest) Encode

NetPacketId implements DataEncoder.

func (*RGBControllerResizeZoneRequest) NetPacketId

func (req *RGBControllerResizeZoneRequest) NetPacketId() NetPacketId

NetPacketId implements NetPacketCommand.

type RGBControllerSaveModeRequest

type RGBControllerSaveModeRequest struct {
	ModeIdx int32
	Mode    *Mode
}

func (*RGBControllerSaveModeRequest) Encode

NetPacketId implements DataEncoder.

func (*RGBControllerSaveModeRequest) NetPacketId

func (req *RGBControllerSaveModeRequest) NetPacketId() NetPacketId

NetPacketId implements NetPacketCommand.

func (*RGBControllerSaveModeRequest) Size

type RGBControllerSetCustomModeRequest

type RGBControllerSetCustomModeRequest struct {
}

func (*RGBControllerSetCustomModeRequest) Encode

NetPacketId implements DataEncoder.

func (*RGBControllerSetCustomModeRequest) NetPacketId

NetPacketId implements NetPacketCommand.

type RGBControllerUpdateLedsRequest

type RGBControllerUpdateLedsRequest struct {
	LedColor []Color
}

func (*RGBControllerUpdateLedsRequest) Encode

NetPacketId implements DataEncoder.

func (*RGBControllerUpdateLedsRequest) NetPacketId

func (req *RGBControllerUpdateLedsRequest) NetPacketId() NetPacketId

NetPacketId implements NetPacketCommand.

func (*RGBControllerUpdateLedsRequest) Size

type RGBControllerUpdateModeRequest

type RGBControllerUpdateModeRequest struct {
	ModeIdx int32
	Mode    *Mode
}

func (*RGBControllerUpdateModeRequest) Encode

NetPacketId implements DataEncoder.

func (*RGBControllerUpdateModeRequest) NetPacketId

func (req *RGBControllerUpdateModeRequest) NetPacketId() NetPacketId

NetPacketId implements NetPacketCommand.

func (*RGBControllerUpdateModeRequest) Size

type RGBControllerUpdateSingleLedRequest

type RGBControllerUpdateSingleLedRequest struct {
	LedIdx int32
	Color  Color
}

func (*RGBControllerUpdateSingleLedRequest) Encode

NetPacketId implements DataEncoder.

func (*RGBControllerUpdateSingleLedRequest) NetPacketId

NetPacketId implements NetPacketCommand.

type RGBControllerUpdateZoneLedsRequest

type RGBControllerUpdateZoneLedsRequest struct {
	ZoneIdx  uint32
	LedColor []Color
}

func (*RGBControllerUpdateZoneLedsRequest) Encode

NetPacketId implements DataEncoder.

func (*RGBControllerUpdateZoneLedsRequest) NetPacketId

NetPacketId implements NetPacketCommand.

func (*RGBControllerUpdateZoneLedsRequest) Size

type RequestControllerCountRequest

type RequestControllerCountRequest struct {
}

func (*RequestControllerCountRequest) Encode

NetPacketId implements DataEncoder.

func (*RequestControllerCountRequest) NetPacketId

func (req *RequestControllerCountRequest) NetPacketId() NetPacketId

NetPacketId implements NetPacketCommand.

type RequestControllerCountResponse

type RequestControllerCountResponse struct {
	Count uint32
}

func (*RequestControllerCountResponse) Decode

Decode implements DataDecoder.

func (*RequestControllerCountResponse) NetPacketId

func (req *RequestControllerCountResponse) NetPacketId() NetPacketId

NetPacketId implements NetPacketCommand.

type RequestControllerDataRequest

type RequestControllerDataRequest struct {
}

func (*RequestControllerDataRequest) Encode

NetPacketId implements DataEncoder.

func (*RequestControllerDataRequest) NetPacketId

func (req *RequestControllerDataRequest) NetPacketId() NetPacketId

NetPacketId implements NetPacketCommand.

type RequestControllerDataResponse

type RequestControllerDataResponse struct {
	Controller *ControllerData
}

func (*RequestControllerDataResponse) Decode

Decode implements DataDecoder.

func (*RequestControllerDataResponse) NetPacketId

func (req *RequestControllerDataResponse) NetPacketId() NetPacketId

NetPacketId implements NetPacketCommand.

type RequestDeleteProfileRequest

type RequestDeleteProfileRequest struct {
	// Profile name
	ProfileName string
}

func (*RequestDeleteProfileRequest) Encode

NetPacketId implements DataEncoder.

func (*RequestDeleteProfileRequest) NetPacketId

func (req *RequestDeleteProfileRequest) NetPacketId() NetPacketId

NetPacketId implements NetPacketCommand.

type RequestLoadProfileRequest

type RequestLoadProfileRequest struct {
	// Profile name
	ProfileName string
}

func (*RequestLoadProfileRequest) Encode

NetPacketId implements DataEncoder.

func (*RequestLoadProfileRequest) NetPacketId

func (req *RequestLoadProfileRequest) NetPacketId() NetPacketId

NetPacketId implements NetPacketCommand.

type RequestProfileListRequest

type RequestProfileListRequest struct {
}

func (*RequestProfileListRequest) Encode

NetPacketId implements DataEncoder.

func (*RequestProfileListRequest) NetPacketId

func (req *RequestProfileListRequest) NetPacketId() NetPacketId

NetPacketId implements NetPacketCommand.

type RequestProfileListResponse

type RequestProfileListResponse struct {
	// Profile name strings
	Names []string
}

func (*RequestProfileListResponse) Decode

Decode implements DataDecoder.

func (*RequestProfileListResponse) NetPacketId

func (req *RequestProfileListResponse) NetPacketId() NetPacketId

NetPacketId implements NetPacketCommand.

type RequestProtocolVersionRequest

type RequestProtocolVersionRequest struct {
	ClientVersion Version
}

func (*RequestProtocolVersionRequest) Encode

NetPacketId implements DataEncoder.

func (*RequestProtocolVersionRequest) NetPacketId

func (req *RequestProtocolVersionRequest) NetPacketId() NetPacketId

NetPacketId implements NetPacketCommand.

type RequestProtocolVersionResponse

type RequestProtocolVersionResponse struct {
	ServerVersion Version
}

func (*RequestProtocolVersionResponse) Decode

Decode implements DataDecoder.

func (*RequestProtocolVersionResponse) NetPacketId

func (req *RequestProtocolVersionResponse) NetPacketId() NetPacketId

NetPacketId implements NetPacketCommand.

type RequestSaveProfileRequest

type RequestSaveProfileRequest struct {
	// Profile name
	ProfileName string
}

func (*RequestSaveProfileRequest) Encode

NetPacketId implements DataEncoder.

func (*RequestSaveProfileRequest) NetPacketId

func (req *RequestSaveProfileRequest) NetPacketId() NetPacketId

NetPacketId implements NetPacketCommand.

type ResponseTimeoutError

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

Occurs, when a timeout happens while waiting for a response.

func (*ResponseTimeoutError) Error

func (e *ResponseTimeoutError) Error() string

Error implements error.

func (*ResponseTimeoutError) Unwrap

func (e *ResponseTimeoutError) Unwrap() error

type SetClientNameRequest

type SetClientNameRequest struct {
	// Client name
	ClientName string
}

func (*SetClientNameRequest) Encode

NetPacketId implements DataEncoder.

func (*SetClientNameRequest) NetPacketId

func (req *SetClientNameRequest) NetPacketId() NetPacketId

NetPacketId implements NetPacketCommand.

type UnprocessedResponseError

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

Occurs, when an invalid size response is returned.

func (*UnprocessedResponseError) Error

func (e *UnprocessedResponseError) Error() string

Error implements error

type Version

type Version uint32
const ClientVersion Version = 3

Highest version supported by the SDK

type Zone

type Zone struct {
	// Zone name string value
	ZoneName string
	// Zone type value
	ZoneType int32
	// Zone leds_min value
	ZoneLedsMin uint32
	// Zone leds_max value
	ZoneLedsMax uint32
	// Zone leds_count value
	ZoneLedsCount uint32
	// Zone matrix_map data (*only if matrix_map exists)
	ZoneMatrixData [][]uint32
}

func (*Zone) Decode

func (z *Zone) Decode(v Version, p *NetPacketDataParser) error

Decode implements DataDecoder.

type Zones

type Zones []*Zone

func (Zones) FindByName

func (z Zones) FindByName(n string) (uint32, *Zone)

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳