DreamlightSceneModeTransformer(uuid?: string, defaultValue?: { version: number, id: number, mode: number, speed: number, segmented: number, loop: number, excessive: number, direction: number, expand: number, reserved1: number, reserved2: number, brightness: number, colors: SceneColorType[] })

Requires:
@ray-js/panel-sdk≥1.0.0

Description

Addressable light strip scene-mode protocol converter for bidirectional conversion between dynamic scene configuration data and the DP hexadecimal protocol

Parameters

ParameterTypeRequiredDescription
uuidstringNoDP identifier, defaults to 'dreamlight_scene_mode'
defaultValue{ version: number, id: number, mode: number, speed: number, segmented: number, loop: number, excessive: number, direction: number, expand: number, reserved1: number, reserved2: number, brightness: number, colors: SceneColorType[] }NoDefault scene data to return when parsing fails

Return Value

Type: DreamlightSceneModeTransformer
DreamlightSceneModeTransformer instance

Referenced Types

interfaceSceneColorType
PropertyTypeRequiredDescription
huenumberYesHue
saturationnumberYesSaturation

Methods

MethodDescription
parserParse the DP hexadecimal string into a dreamlight scene-mode data object
formatterFormat a dreamlight scene-mode data object into a DP hexadecimal string

Examples

Example

import { DreamlightSceneModeTransformer } from '@ray-js/panel-sdk';

const transformer = new DreamlightSceneModeTransformer();
// Parse scene DP string
const scene = transformer.parser('01c8010d0d00000064007003e8');

// Format to DP string
const dpStr = transformer.formatter({
  id: 200, mode: 1, speed: 13,
  brightness: 1000,
  colors: [{ hue: 0, saturation: 1000 }, { hue: 120, saturation: 800 }],
});