import { SmartDevicesMap, GetSmartDevicesActions } from '../types/SdmModel';
/**
* 获取关联设备的功能点操作方法集合
* @public
* @since @ray-js/panel-sdk 1.16.0
* @returns 设备操作方法集合,key 为设备标识,value 为该设备的 actions 对象。
* 每个设备的 actions 使用方式与单设备 useActions 一致
* @typeOverride returns { [key: string]: DpActions }
* @remarks
* 注意事项:
* 使用前需挂载 SdmDevicesProvider 并配置关联设备映射。
* 常与 useDevicesProps 搭配使用,useDevicesProps 读取状态、useDevicesActions 下发指令。
* 该 Hooks 返回的 actions 方法是对底层 `publishDps` 的封装,调用 actions 并不会导致组件立即重渲染。
* 只有当指令下发成功且设备上报新的 DP 状态时,使用了对应 `useDevicesProps` 且 `selector` 命中的组件才会被触发重渲染。
* @example 控制指定设备的各类型 DP 功能点
* ```tsx
* // devices/schema.ts — as const 是类型推导的基石,set 为通用方法,其余为类型专属快捷方法
* import { useDevicesActions, useDevicesProps } from '@ray-js/panel-sdk';
*
* export const schema = [
* { code: 'switch_led', property: { type: 'bool' }, type: 'obj', mode: 'rw', id: 1, name: '开关' },
* { code: 'brightness', property: { type: 'value', min: 10, max: 1000, step: 1 }, type: 'obj', mode: 'rw', id: 2, name: '亮度' },
* { code: 'work_mode', property: { type: 'enum', range: ['white', 'colour'] }, type: 'obj', mode: 'rw', id: 3, name: '模式' },
* { code: 'fault', property: { type: 'bitmap', maxlen: 8 }, type: 'obj', mode: 'ro', id: 4, name: '故障' },
* { code: 'colour_data', property: { type: 'string', maxlen: 255 }, type: 'obj', mode: 'rw', id: 5, name: '颜色' },
* ] as const;
*
* export default function MultiDeviceControl() {
* const actions = useDevicesActions();
* // 推荐:精确选用需要的状态,避免无关变化引起无意义渲染
* const mainSwitch = useDevicesProps(props => props.main?.switch_led);
*
* const handleToggle = () => {
* // ✅ set — 所有类型通用
* actions.main?.switch_led.set(true); // bool
* actions.main?.brightness.set(500); // value
* actions.main?.work_mode.set('colour'); // enum(IDE 提示 'white' | 'colour')
* actions.main?.fault.set(3); // number(bitmap)
* actions.main?.colour_data.set('000003e803e8'); // string
*
* // bool 专属:on / off / toggle
* actions.main?.switch_led.toggle();
* actions.main?.switch_led.on();
* actions.main?.switch_led.off();
*
* // value 专属:inc / dec(按 step 步进,自动 clamp 到 min~max)
* actions.main?.brightness.inc(); // +1(默认 step)
* actions.main?.brightness.dec(100); // -100
*
* // enum 专属:prev / next / random
* actions.main?.work_mode.next(); // 切换到下一个枚举值
* actions.main?.work_mode.prev();
*
* // bitmap 专属:on(idx) / off(idx) / toggle(idx)
* actions.main?.fault.on(0); // 置位 bit 0
* actions.main?.fault.off(1); // 清除 bit 1
* actions.main?.fault.toggle(2); // 翻转 bit 2
* };
*
* return (
*
* 主设备: {mainSwitch ? '开' : '关'}
*
* );
* }
* ```
*/
export declare function useDevicesActions(): GetSmartDevicesActions;