import { InitDevInfoInterceptor, InitDpStateInterceptor, InitDpStateInterceptorParams, PublishDpsInterceptor } from '../../types'; export type { ResolveColorDataParams } from './resolveColorData'; /** * matter-kit 工厂可选配置类型,用于 `createMatterKit` 入参。 * @public * @since 1.15.0 * @example * ```ts * import { createMatterKit } from '@ray-js/panel-sdk'; * * createMatterKit({ * debug: false, * shouldConvert: p => p.action === 'init', * }); * ``` * @returns {void} 类型定义,无运行时返回值 */ export interface CreateMatterKitOptions { /** * 是否在拦截链路中转换 DP 状态;默认在 `init` 与 `onDpDataChange` 时转换。 * @public * @since 1.15.0 * @param params - 拦截器收到的 `InitDpStateInterceptorParams` * @example * ```ts * (params) => params.action === 'init' || params.action === 'onDpDataChange'; * ``` * @returns {boolean} 是否执行 Matter → 标准的数值与键映射 */ shouldConvert?: (params: InitDpStateInterceptorParams) => boolean; /** * 是否开启调试模式(控制台输出转换过程)。 * @public * @since 1.15.0 * @example * ```ts * createMatterKit({ debug: true }); * ``` * @default false */ debug?: boolean; /** * 可选:标准侧 `bright_value` / `temp_value` 的 min、max 范围。 * @public * @since 1.15.0 * @example * ```ts * createMatterKit({ * config: { * brightnessRange: { min: 10, max: 1000 }, * colorTemperatureRange: { min: 0, max: 1000 }, * }, * }); * ``` */ config?: { /** * 标准侧亮度数值范围 */ brightnessRange?: { /** * 最小值 */ min: number; /** * 最大值 */ max: number; }; /** * 标准侧色温数值范围 */ colorTemperatureRange?: { /** * 最小值 */ min: number; /** * 最大值 */ max: number; }; }; } /** * matter-kit 拦截器类型,用于 `createMatterKit` 返回值的 `interceptors` 字段。 * @public * @since 1.15.0 * @example * ```ts * const matterKit = createMatterKit(); * const interceptors = matterKit.interceptors; * ``` * @returns {object} 包含 `init`、`request` 字段的拦截器对象 */ export interface MatterKitInterceptors { /** * `init` 拦截器配置 */ init: { /** * matter-kit initDevInfo 拦截器 */ initDevInfo: [InitDevInfoInterceptor]; /** * matter-kit initDpState 拦截器 */ initDpState: [InitDpStateInterceptor]; }; /** * `request` 拦截器配置 */ request: { /** * matter-kit publishDps 拦截器 */ publishDps: [PublishDpsInterceptor]; }; } /** * 创建 matter-kit 实例:提供 SDM 拦截器、Matter ↔ 标准 DP 转换工具与 Hook。 * @public * @since 1.15.0 * @param options - 工厂入参,字段含义见 {@link CreateMatterKitOptions} * @example * ```ts * import { SmartDeviceModel, createMatterKit } from '@ray-js/panel-sdk'; * import { defaultSchema } from '@/devices/schema'; * * type SmartDeviceSchema = typeof defaultSchema; * * export const matterKit = createMatterKit({ debug: false }); * export const devices = { * common: new SmartDeviceModel({ * interceptors: matterKit.interceptors, * }), * }; * ``` * @returns {MatterKit} matter-kit 实例 * @typeOverride returns MatterKit */ export declare const createMatterKit: (options?: CreateMatterKitOptions) => { /** * matter-kit 拦截器配置 */ interceptors: MatterKitInterceptors; /** * matter-kit initDevInfo 拦截器 */ matterDevInfoInterceptor: InitDevInfoInterceptor; action: import("../../types").InitDevInfoInterceptorAction; }>; /** * matter-kit initDpState 拦截器 */ matterDpStateInterceptor: InitDpStateInterceptor; /** * matter-kit publishDps 拦截器 */ publishMatterDpsInterceptor: PublishDpsInterceptor; /** * 解析 Matter 设备信息 */ resolveMatterDevInfo: (devInfo: import("../../..").DevInfo, ops?: import("./initMatterDevInfo").InitMatterDevInfoInterceptorOps) => { name: string; meta: any; icon: string; longitude: string; latitude: string; mac?: string | undefined; devId: string; roomName?: string | undefined; dps: any; attribute: number; baseAttribute: number; dpName: any; ability: number; verSw: string; isShare: boolean; bv: string; uuid: string; activeTime: number; pcc: string; nodeId: string; parentId?: string | undefined; category: string; standSchemaModel?: {} | undefined; productId: string; productVer: string; bizAttribute: number; meshId: string; sigmeshId: string; isLocalOnline: boolean; isCloudOnline: boolean; isOnline: boolean; groupId: string; dpCodes: any; devTimezoneId: string; dpsTime: any; ip?: string | undefined; isVirtualDevice: boolean; isZigbeeInstallCode: boolean; protocolAttribute: number; connectionStatus: number; bluetoothCapability?: string | undefined; isTripartiteMatter: boolean; isGW: boolean; isSupportGroup: boolean; isZigBeeSubDev: boolean; cadv?: string | undefined; isSupportOTA: boolean; iconUrl: string; hasWifi: boolean; switchDp: number; switchDps: number[]; wifiEnableState: number; configMetas: any; isMatter: boolean; isSupportLink: boolean; isSupportAppleHomeKit?: boolean | undefined; attributeString: string; extModuleType: number; isRelayOpen: boolean; isProxyOpen: boolean; isSupportProxyAndRelay: boolean; yuNetState: number; idCodes: Record; codeIds: Record; capability: number; devAttribute: number; schema: import("../../..").DpSchema[]; panelConfig: import("../../..").PanelConfig; }; /** * 映射 Matter 功能点状态 */ mapMatterDpState: (dpState: Record, updateDpState: Record, dpSchema: Record, shouldConvert?: boolean) => { [x: string]: any; }; /** * 映射 Matter 下发 DP */ mapPublishMatterDps: (dpState: Record, dpSchema: Record) => any; /** * matter-kit 工具对象 */ utils: import("./matterUtils").MatterUtils; /** * Matter 与标准 DP 功能点代码映射常量 */ dpCodes: { readonly powerCode: "switch_led"; readonly brightCode: "bright_value"; readonly temperatureCode: "temp_value"; readonly colourCode: "colour_data"; readonly switch: "switch"; readonly brightness_control: "brightness_control"; readonly color_temp_control: "color_temp_control"; readonly hsColorCode: "hs_color_set"; }; /** * 解析颜色数据 */ resolveColorData: ({ colourData, brightValue, devInfo }: import("./resolveColorData").ResolveColorDataParams) => { hue: number; saturation: number; value: number; }; /** * matter-kit 钩子 */ hooks: { useOriginMatterTemp: () => number; }; };