使用

单设备支持群组支持
Info

当前 Support 能力 SDK 针对以下能力做了抽象:

  • 设备类型判断
  • dp支持情况判断
  • 其他能力支持判断

SmartSupportAbility(options: Function)

版本要求:
@ray-js/panel-sdk≥1.10.0

描述

设备能力检测,判断设备支持的功能点与协议类型

参数

参数类型必填说明
options{ initDevInfo?: (devInfo) => void }否设备能力检测配置

返回值

类型:SmartSupportAbility
SmartSupportAbility 实例

方法

方法名说明
isSupportDp检查给定的功能点编码是否受设备支持
isInGateway判断设备是否已添加到网关下
isGroupDevice判断当前是否是群组设备
isSupportBright判断设备是否支持白光亮度功能点
isSupportTemp判断设备是否支持色温功能点
isSupportColour判断设备是否支持彩光功能点
isSupportCloudTimer判断设备是否支持云端定时功能
isWifiDevice判断是否是 WiFi 设备
isGprsDevice判断是否是 GPRS 设备
isBluetoothDevice判断是否是蓝牙 Bluetooth 设备
isBleMeshDevice判断是否是 BLE Mesh 设备
isZigbeeDevice判断是否是 Zigbee 设备
isSigMeshDevice判断是否是 SIG Mesh 设备
isBleDevice判断是否是蓝牙类设备(包含 Bluetooth、BLE Mesh、SIG Mesh)
isCat1Device判断是否是 Cat.1 设备
isBeaconDevice判断是否是 Beacon 设备
isLteCat4Device判断是否是 LTE Cat.4 设备
isLteCat10Device判断是否是 LTE Cat.10 设备
isLteCatMDevice判断是否是 LTE Cat.M 设备
isThreadDevice判断是否是 Thread 设备
isMatterDevice判断是否是 Matter 设备
isTuyaMatterDevice判断是否是涂鸦 Matter 设备
isTripartiteMatter判断是否是三方 Matter 设备
isSupportMatterWhite判断是否支持 Matter 白光

示例代码

示例

// 使用方式 1 (推荐)
import { SmartDeviceModel, SmartSupportAbility } from '@ray-js/panel-sdk';

const sdm = new SmartDeviceModel({ abilities: [new SmartSupportAbility()] });
const isSupportxxx = sdm.support.xxx()

// 使用方式 2(不推荐)
const support = new SmartSupportAbility({
  initDevInfo: (devInfo) => {
    return {
      ...devInfo,
      isMatter: true,
    };
  },
});

await support.init({ deviceId: '1234567890' });