Versions in this module Expand all Collapse all v1 v1.0.0 Oct 12, 2024 Changes in this version + var ColorBlack = Color + var ColorBlue = Color + var ColorCyan = Color + var ColorGreen = Color + var ColorMagenta = Color + var ColorRed = Color + var ColorWhite = Color + var ColorYellow = Color + func Loop(c *Client, delay time.Duration, loop func(Controllers) error) error + type Client struct + func NewClient(conn net.Conn) *Client + func NewClientHostPort(host string, port int) (*Client, error) + func NewDefaultClient() (*Client, error) + func NewLocalClient(port int) (*Client, error) + func (c *Client) AssertServerVersion(v Version) error + func (c *Client) Close() error + func (c *Client) CommonVersion() Version + func (c *Client) DeviceListUpdatedHandler(h DeviceListUpdatedHandler) + func (c *Client) Initialize(name string) error + func (c *Client) RGBControllerResizeZone(deviceId uint32, req *RGBControllerResizeZoneRequest) error + func (c *Client) RGBControllerSaveMode(deviceId uint32, req *RGBControllerSaveModeRequest) error + func (c *Client) RGBControllerSetCustomMode(deviceId uint32) error + func (c *Client) RGBControllerUpdateLeds(deviceId uint32, req *RGBControllerUpdateLedsRequest) error + func (c *Client) RGBControllerUpdateMode(deviceId uint32, req *RGBControllerUpdateModeRequest) error + func (c *Client) RGBControllerUpdateSingleLed(deviceId uint32, req *RGBControllerUpdateSingleLedRequest) error + func (c *Client) RGBControllerUpdateZoneLeds(deviceId uint32, req *RGBControllerUpdateZoneLedsRequest) error + func (c *Client) RequestControllerCount() (*RequestControllerCountResponse, error) + func (c *Client) RequestControllerCountCtx(ctx context.Context) (*RequestControllerCountResponse, error) + func (c *Client) RequestControllerData(deviceId uint32) (*RequestControllerDataResponse, error) + func (c *Client) RequestControllerDataCtx(ctx context.Context, deviceId uint32) (*RequestControllerDataResponse, error) + func (c *Client) RequestDeleteProfile(req *RequestDeleteProfileRequest) error + func (c *Client) RequestLoadProfile(req *RequestLoadProfileRequest) error + func (c *Client) RequestProfileList() (*RequestProfileListResponse, error) + func (c *Client) RequestProfileListCtx(ctx context.Context) (*RequestProfileListResponse, error) + func (c *Client) RequestProtocolVersion() error + func (c *Client) RequestProtocolVersionCtx(ctx context.Context) error + func (c *Client) RequestSaveProfile(req *RequestSaveProfileRequest) error + func (c *Client) SendPacket(req *NetPacket) error + func (c *Client) SendPacketAndExpectPacket(req *NetPacket) (*NetPacket, error) + func (c *Client) SendPacketAndExpectPacketCtx(ctx context.Context, req *NetPacket) (*NetPacket, error) + func (c *Client) SendRequest(req NetPacketRequest) error + func (c *Client) SendRequestAndExpectResponse(req NetPacketRequest, res NetPacketResponse) (*NetPacket, error) + func (c *Client) SendRequestAndExpectResponseCtx(ctx context.Context, req NetPacketRequest, res NetPacketResponse) (*NetPacket, error) + func (c *Client) SendRequestForDevice(deviceId uint32, req NetPacketRequest) error + func (c *Client) SendRequestForDeviceAndExpectResponse(deviceId uint32, req NetPacketRequest, res NetPacketResponse) (*NetPacket, error) + func (c *Client) SendRequestForDeviceAndExpectResponseCtx(ctx context.Context, deviceId uint32, req NetPacketRequest, ...) (*NetPacket, error) + func (c *Client) SetClientName(req *SetClientNameRequest) error + type Color struct + B uint8 + G uint8 + R uint8 + func NewRGBColor(colors color.Color) Color + func (c *Color) Decode(v Version, p *NetPacketDataParser) error + func (c Color) Encode(v Version, b *NetPacketDataBuilder) []byte + type Colors []Color + func NewBlackColors(numLeds int) Colors + func NewColors(numLeds int, c Color) Colors + func (c Colors) ShiftLeft(i int) Colors + func (c Colors) ShiftRight(i int) Colors + type ControllerCache struct + func NewControllerCache(c *Client) *ControllerCache + func (c *ControllerCache) Controllers() (Controllers, error) + func (c *ControllerCache) Invalidate() + type ControllerData struct + ActiveMode int32 + Colors []Color + Description string + Leds []*Led + Location string + Modes Modes + Name string + Serial string + Type int32 + Vendor string + Version string + Zones Zones + func (c *ControllerData) Decode(v Version, p *NetPacketDataParser) error + type Controllers []*ControllerData + func (c Controllers) Find(f func(*ControllerData) bool) (uint32, *ControllerData) + func (c Controllers) FindByName(n string) (uint32, *ControllerData) + type DataDecoder interface + Decode func(v Version, p *NetPacketDataParser) error + type DataEncoder interface + Encode func(v Version, b *NetPacketDataBuilder) + type DeviceListUpdatedHandler func(*DeviceListUpdatedResponse) + type DeviceListUpdatedResponse struct + func (req *DeviceListUpdatedResponse) NetPacketId() NetPacketId + func (res *DeviceListUpdatedResponse) Decode(v Version, p *NetPacketDataParser) error + type ExchangeHandler struct + func NewExchangeHandler() *ExchangeHandler + func (eh *ExchangeHandler) Close() error + func (eh *ExchangeHandler) Create(commandId NetPacketId) chan *NetPacket + func (eh *ExchangeHandler) Delete(commandId NetPacketId, responseCh chan *NetPacket) + func (eh *ExchangeHandler) Pop(commandId NetPacketId) chan<- *NetPacket + type InvalidPacketHeaderMagicValueError struct + func (e *InvalidPacketHeaderMagicValueError) Error() string + type InvalidResponseNetPacketIdError struct + func (e *InvalidResponseNetPacketIdError) Error() string + type InvalidServerVersionError struct + func (e *InvalidServerVersionError) Error() string + type Led struct + LedName string + LedValue uint32 + func (l *Led) Decode(v Version, p *NetPacketDataParser) error + type Mode struct + ModeBrightness uint32 + ModeBrightnessMax uint32 + ModeBrightnessMin uint32 + ModeColorMode uint32 + ModeColors []Color + ModeColorsMax uint32 + ModeColorsMin uint32 + ModeDirection uint32 + ModeFlags uint32 + ModeName string + ModeSpeed uint32 + ModeSpeedMax uint32 + ModeSpeedMin uint32 + ModeValue int32 + func (m *Mode) Decode(v Version, p *NetPacketDataParser) error + func (m *Mode) Encode(v Version, b *NetPacketDataBuilder) + func (m *Mode) Size(v Version) int + type Modes []*Mode + func (m Modes) FindByName(n string) (uint32, *Mode) + type NetPacket struct + Data NetPacketData + Header *NetPacketHeader + func NewNetPacket(commandId NetPacketId, deviceId uint32, data []byte) *NetPacket + func (p *NetPacket) DataParser() *NetPacketDataParser + type NetPacketCommand interface + NetPacketId func() NetPacketId + type NetPacketData []byte + type NetPacketDataBuilder struct + func (r *NetPacketDataBuilder) Bytes() []byte + func (r *NetPacketDataBuilder) EnsureSize(size int) + func (r *NetPacketDataBuilder) WriteBytes(b []byte) + func (r *NetPacketDataBuilder) WriteInt32(i int32) + func (r *NetPacketDataBuilder) WriteLen(v any) + func (r *NetPacketDataBuilder) WriteUint16(i uint16) + func (r *NetPacketDataBuilder) WriteUint32(i uint32) + func (r *NetPacketDataBuilder) WrtieString(b string) + type NetPacketDataParser struct + func (p *NetPacketDataParser) AssertAllRead() error + func (p *NetPacketDataParser) ReadBytes(l int) ([]byte, error) + func (p *NetPacketDataParser) ReadInt32() (int32, error) + func (p *NetPacketDataParser) ReadString() (string, error) + func (p *NetPacketDataParser) ReadUint16() (uint16, error) + func (p *NetPacketDataParser) ReadUint32() (uint32, error) + type NetPacketDecoder struct + func NewNetPacketDecoder(r io.Reader) *NetPacketDecoder + func (d *NetPacketDecoder) Decode() (*NetPacket, error) + type NetPacketEncoder struct + func NewNetPacketEncoder(w io.Writer) *NetPacketEncoder + func (e *NetPacketEncoder) Encode(p *NetPacket) error + type NetPacketHeader struct + PktDevIdx uint32 + PktId NetPacketId + PktMagic string + PktSize uint32 + type NetPacketId uint32 + const NetPacketIdDeviceListUpdated + const NetPacketIdRequestControllerCount + const NetPacketIdRequestControllerData + const NetPacketIdRequestDeleteProfile + const NetPacketIdRequestLoadProfile + const NetPacketIdRequestProfileList + const NetPacketIdRequestProtocolVersion + const NetPacketIdRequestSaveProfile + const NetPacketIdRgbcontrollerResizezone + const NetPacketIdRgbcontrollerSavemode + const NetPacketIdRgbcontrollerSetcustommode + const NetPacketIdRgbcontrollerUpdateleds + const NetPacketIdRgbcontrollerUpdatemode + const NetPacketIdRgbcontrollerUpdatesingleled + const NetPacketIdRgbcontrollerUpdatezoneleds + const NetPacketIdSetClientName + type NetPacketRequest interface + type NetPacketResponse interface + type RGBControllerResizeZoneRequest struct + NewSize int32 + ZoneIdx int32 + func (req *RGBControllerResizeZoneRequest) Encode(v Version, b *NetPacketDataBuilder) + func (req *RGBControllerResizeZoneRequest) NetPacketId() NetPacketId + type RGBControllerSaveModeRequest struct + Mode *Mode + ModeIdx int32 + func (req *RGBControllerSaveModeRequest) Encode(v Version, b *NetPacketDataBuilder) + func (req *RGBControllerSaveModeRequest) NetPacketId() NetPacketId + func (req *RGBControllerSaveModeRequest) Size(v Version) int + type RGBControllerSetCustomModeRequest struct + func (req *RGBControllerSetCustomModeRequest) Encode(v Version, b *NetPacketDataBuilder) + func (req *RGBControllerSetCustomModeRequest) NetPacketId() NetPacketId + type RGBControllerUpdateLedsRequest struct + LedColor []Color + func (req *RGBControllerUpdateLedsRequest) Encode(v Version, b *NetPacketDataBuilder) + func (req *RGBControllerUpdateLedsRequest) NetPacketId() NetPacketId + func (req *RGBControllerUpdateLedsRequest) Size(v Version) int + type RGBControllerUpdateModeRequest struct + Mode *Mode + ModeIdx int32 + func (req *RGBControllerUpdateModeRequest) Encode(v Version, b *NetPacketDataBuilder) + func (req *RGBControllerUpdateModeRequest) NetPacketId() NetPacketId + func (req *RGBControllerUpdateModeRequest) Size(v Version) int + type RGBControllerUpdateSingleLedRequest struct + Color Color + LedIdx int32 + func (req *RGBControllerUpdateSingleLedRequest) Encode(v Version, b *NetPacketDataBuilder) + func (req *RGBControllerUpdateSingleLedRequest) NetPacketId() NetPacketId + type RGBControllerUpdateZoneLedsRequest struct + LedColor []Color + ZoneIdx uint32 + func (req *RGBControllerUpdateZoneLedsRequest) Encode(v Version, b *NetPacketDataBuilder) + func (req *RGBControllerUpdateZoneLedsRequest) NetPacketId() NetPacketId + func (req *RGBControllerUpdateZoneLedsRequest) Size(v Version) int + type RequestControllerCountRequest struct + func (req *RequestControllerCountRequest) Encode(v Version, b *NetPacketDataBuilder) + func (req *RequestControllerCountRequest) NetPacketId() NetPacketId + type RequestControllerCountResponse struct + Count uint32 + func (req *RequestControllerCountResponse) NetPacketId() NetPacketId + func (res *RequestControllerCountResponse) Decode(v Version, p *NetPacketDataParser) error + type RequestControllerDataRequest struct + func (req *RequestControllerDataRequest) Encode(v Version, b *NetPacketDataBuilder) + func (req *RequestControllerDataRequest) NetPacketId() NetPacketId + type RequestControllerDataResponse struct + Controller *ControllerData + func (req *RequestControllerDataResponse) NetPacketId() NetPacketId + func (res *RequestControllerDataResponse) Decode(v Version, p *NetPacketDataParser) error + type RequestDeleteProfileRequest struct + ProfileName string + func (req *RequestDeleteProfileRequest) Encode(v Version, b *NetPacketDataBuilder) + func (req *RequestDeleteProfileRequest) NetPacketId() NetPacketId + type RequestLoadProfileRequest struct + ProfileName string + func (req *RequestLoadProfileRequest) Encode(v Version, b *NetPacketDataBuilder) + func (req *RequestLoadProfileRequest) NetPacketId() NetPacketId + type RequestProfileListRequest struct + func (req *RequestProfileListRequest) Encode(v Version, b *NetPacketDataBuilder) + func (req *RequestProfileListRequest) NetPacketId() NetPacketId + type RequestProfileListResponse struct + Names []string + func (req *RequestProfileListResponse) NetPacketId() NetPacketId + func (res *RequestProfileListResponse) Decode(v Version, p *NetPacketDataParser) error + type RequestProtocolVersionRequest struct + ClientVersion Version + func (req *RequestProtocolVersionRequest) Encode(v Version, b *NetPacketDataBuilder) + func (req *RequestProtocolVersionRequest) NetPacketId() NetPacketId + type RequestProtocolVersionResponse struct + ServerVersion Version + func (req *RequestProtocolVersionResponse) NetPacketId() NetPacketId + func (res *RequestProtocolVersionResponse) Decode(v Version, p *NetPacketDataParser) error + type RequestSaveProfileRequest struct + ProfileName string + func (req *RequestSaveProfileRequest) Encode(v Version, b *NetPacketDataBuilder) + func (req *RequestSaveProfileRequest) NetPacketId() NetPacketId + type ResponseTimeoutError struct + func (e *ResponseTimeoutError) Error() string + func (e *ResponseTimeoutError) Unwrap() error + type SetClientNameRequest struct + ClientName string + func (req *SetClientNameRequest) Encode(v Version, b *NetPacketDataBuilder) + func (req *SetClientNameRequest) NetPacketId() NetPacketId + type UnprocessedResponseError struct + func (e *UnprocessedResponseError) Error() string + type Version uint32 + const ClientVersion + type Zone struct + ZoneLedsCount uint32 + ZoneLedsMax uint32 + ZoneLedsMin uint32 + ZoneMatrixData [][]uint32 + ZoneName string + ZoneType int32 + func (z *Zone) Decode(v Version, p *NetPacketDataParser) error + type Zones []*Zone + func (z Zones) FindByName(n string) (uint32, *Zone)