import { SmartDeviceAbility } from '../../types'; interface SmartLampAdvancedAbilityOptions { /** * @description 设备 id,不填默认使用 getLaunchOptions 获取当前环境下的设备 ID */ deviceId?: string; /** * @description 群组 id,不填默认使用 getLaunchOptions 获取当前环境下的群组 ID */ groupId?: string; /** * @description 是否开启调试模式 */ debug?: boolean; /** * @description 是否预加载数据 * @default false */ waitForInit?: boolean; } export interface VasKeypoints { /** * 业务 ID */ bizId: string; /** * 业务类型 */ bizType: number; /** * VAS 信息 */ vasInfo: Array<{ /** * VAS 代码 */ vasCode: string; /** * 能力是否启用 */ abilityEnabled: boolean; /** * 关键点 */ keyPoints: Array<{ /** * 显示值 */ displayValue: number; /** * 原始值 */ originalValue: number; /** * 单位 */ unit: string; }>; }>; } export type AdvanceHighDpCode = 'color_temp_control' | 'temp_value' | 'bright_value'; export declare const LAMP_HIGH_ABILITY_CODE: { readonly thousandthBright: "tyabif5ucu"; readonly colorTemperature: "tyabirvnwv"; readonly matterColorTemperature: "tyabisph7s"; }; /** * 照明高级能力,提供色温/亮度的高级转换与 VAS 信息查询 * @public * @since 1.15.0 * @remarks * 通过 SmartDeviceModel 的 abilities 配置挂载后使用。 * 同时支持单设备和群组设备。 * @example * ```typescript * import { SmartDeviceModel, SmartLampAdvancedAbility } from '@ray-js/panel-sdk'; * * const sdm = new SmartDeviceModel({ abilities: [new SmartLampAdvancedAbility({})] }); * ``` */ export declare class SmartLampAdvancedAbility implements SmartDeviceAbility { private deviceId; private groupId; private homeId; private debug; private devInfo; private groupInfo; private _brightCode; private _temperatureCode; private advanceBrightnessHighEnabled; private advanceTemperatureHighEnabled; private advanceMatterTemperatureHighEnabled; private codeIds; private idCodes; private isMatterDevice; private advanceHighList; private readonly LAMP_HIGH_ABILITY_CODE; private readonly VAS_CODES; private readonly VAS_CODE_MAP; /** @internal */ abilityOptions: { name: string; /** * 配置了此项说明该能力支持群组环境 */ isSupportGroup: boolean; /** * 配置了此项说明该能力在 SDM 或 SGM 初始化时会同时等待该能力 init 异步方法完成后才会认为 SDM 或 SGM 整体初始化完毕了, * 一般用于一些能力需要 init 完毕以后才能正常使用的场景,比如当前这个设备支持情况的能力,在设备数据没初始化好之前,是没办法使用的。 */ waitForInit: boolean; }; /** * @param props - 照明高级能力初始化配置 */ constructor(props: SmartLampAdvancedAbilityOptions); /** * 初始化照明高级能力,由 SmartDeviceModel 内部调用 * @internal */ init: () => Promise; /** @internal */ prepareData(): Promise; /** * 转换色温值:若设备启用高级色温能力则返回带单位的显示值(如 2700K),否则返回原始值与空单位。 * @public * @since 1.15.0 * @param temperature - 色温原始值(面板侧数值,如 `2700`) * @example * ```typescript * const result = await sdm.lampAdv.convertTemperature(2700); * console.log('色温:', result.value, result.unit); * ``` * @returns {Promise<{ value: number; unit: string }>} 转换后的数值与单位;未启用高级能力时 `unit` 为空字符串。依赖云端 `dpTranslateAdvancedCapability`,需网络。 * @typeOverride returns { value: number; unit: string } */ convertTemperature(temperature: number): Promise<{ value: number; unit: string; }>; /** * 转换亮度值:若设备启用千分之一亮度能力则返回带单位的显示值,否则返回原始值与空单位。 * @public * @since 1.15.0 * @param brightness - 亮度原始值(常见范围如 10~1000) * @example * ```typescript * const result = await sdm.lampAdv.convertBrightness(100); * console.log('亮度:', result.value, result.unit); * ``` * @returns {Promise<{ value: number; unit: string }>} 转换后的数值与单位;未启用高级能力时 `unit` 为空字符串。依赖云端接口,需网络。 * @typeOverride returns { value: number; unit: string } */ convertBrightness(brightness: number): Promise<{ value: number; unit: string; }>; /** * 获取高级色温 VAS(增值服务)信息,包含关键点(显示值、原始值、单位),用于色温条范围与展示。 * @public * @since 1.15.0 * @example * ```typescript * const vasInfo = await sdm.lampAdv.getAdvancedTemperatureVas(); * vasInfo?.forEach(item => { * console.log('VAS:', item.vasCode, item.abilityEnabled); * item.keyPoints.forEach(kp => console.log(kp.originalValue, kp.displayValue, kp.unit)); * }); * ``` * @returns {Promise} Matter 与标准协议下分别查询对应能力码;不支持时可能为 `undefined`。需网络。 * @typeOverride returns VasKeypoints['vasInfo'] */ getAdvancedTemperatureVas(): Promise<{ /** * VAS 代码 */ vasCode: string; /** * 能力是否启用 */ abilityEnabled: boolean; /** * 关键点 */ keyPoints: { /** * 显示值 */ displayValue: number; /** * 原始值 */ originalValue: number; /** * 单位 */ unit: string; }[]; }[]>; /** * 获取高级亮度(千分之一亮度)VAS 信息,包含关键点,用于亮度条显示范围与单位。 * @public * @since 1.15.0 * @example * ```typescript * const vasInfo = await sdm.lampAdv.getAdvancedBrightnessVas(); * vasInfo?.forEach(item => console.log(item.vasCode, item.abilityEnabled, item.keyPoints)); * ``` * @returns {Promise} 千分之一亮度相关 VAS 数组;不支持时可能为 `undefined`。需网络。 * @typeOverride returns VasKeypoints['vasInfo'] */ getAdvancedBrightnessVas(): Promise<{ /** * VAS 代码 */ vasCode: string; /** * 能力是否启用 */ abilityEnabled: boolean; /** * 关键点 */ keyPoints: { /** * 显示值 */ displayValue: number; /** * 原始值 */ originalValue: number; /** * 单位 */ unit: string; }[]; }[]>; /** * 查询指定 DP 的高级能力是否启用:支持 `bright_value`(千分之一亮度)、`temp_value`(标准色温)、`color_temp_control`(Matter 色温)。 * @public * @since 1.15.0 * @param dpCode - 功能点编码,须为 `bright_value` | `temp_value` | `color_temp_control` 之一 * @example * ```typescript * const brightOn = await sdm.lampAdv.getAdvanceHighEnabled('bright_value'); * const tempOn = await sdm.lampAdv.getAdvanceHighEnabled('temp_value'); * const matterTempOn = await sdm.lampAdv.getAdvanceHighEnabled('color_temp_control'); * ``` * @returns {Promise} `true` 表示已启用;不支持的功能点返回 `false`。相同 `dpCode` 会复用缓存。 */ getAdvanceHighEnabled(dpCode: AdvanceHighDpCode): Promise; /** * 按功能点将原始 DP 值转为带单位的显示值;支持 `bright_value`、`temp_value`、`color_temp_control`。 * @public * @since 1.15.0 * @param dpCode - 功能点编码 * @param dpValue - 功能点原始数值 * @remarks 单设备与群组均支持;内部先 `getAdvanceHighEnabled`,再调 `ty.device.dpTranslateAdvancedCapability`。 * @example * ```typescript * const b = await sdm.lampAdv.convertDp('bright_value', 100); * const t = await sdm.lampAdv.convertDp('temp_value', 2700); * const m = await sdm.lampAdv.convertDp('color_temp_control', 2700); * ``` * @returns {Promise<{ value: number; unit: string } | null>} 成功为显示值与单位;未启用高级能力时返回 `{ value, unit: '' }`;云端无有效翻译时可能为 `null`。需网络。 * @typeOverride returns { value: number; unit: string } | null */ convertDp(dpCode: AdvanceHighDpCode, dpValue: number): Promise<{ value: number; unit: string; }>; /** * 获取当前设备或群组信息 */ private getCurrentInfo; /** * 获取当前 schema */ private getCurrentSchema; /** * 初始化代码 ID 映射 */ private initCodeIdMap; /** * 检查是否支持色温 */ private isSupportTemp; /** * 获取 DP 代码 */ private getDpCodes; /** * 请求高级能力 */ private requestAdvancedCapability; /** * 检查高级能力是否启用 */ private checkAdvanceHighEnabled; /** * 获取高级能力列表 */ private fetchAdvanceHighList; /** * 根据代码获取 DP ID */ private getDpIdByCode; /** * 解析数字字符串 */ private resolveNumStr; /** * 获取 VAS 关键点 */ private getVasKeypoints; } export {};