---
name: "bluetoothCapabilityIsSupport"
mode: "kit"
versionRequirements:
  - { name: "DeviceKit", version: "2.2.1" }
  - { name: "@ray-js/ray", version: "0.6.23" }
platform:
  - "iOS"
  - "Android"
async: true
title: "bluetoothCapabilityIsSupport - 蓝牙设备是否支持某个能力"
---

## bluetoothCapabilityIsSupport

> [VERSION] DeviceKit >= 2.2.1 | @ray-js/ray >= 0.6.23

> [PLATFORM] iOS, Android

> ⚡ **支持 Promise 调用** — 不传 success / fail / complete 回调时，该方法返回 Promise。

### 描述

蓝牙设备是否支持某个能力 capability 不同值对应查询的具体能力值 0：OTA时DP是否可控 1：网关和App对于该设备是否使用低功耗在线逻辑 2：是否具备Beacon能力 3：是否有蓝牙LINK层加密使能 4：是否支持扩展模块 5：是否支持定时 6：是否支持蓝牙BT/BLE双模 7：是否需要强制LINK层加密

### 参数

| 属性 | 类型 | 必填 | 默认值 | 最低版本 | 描述 |
| --- | --- | --- | --- | --- | --- |
| `deviceId` | `string` | 是 | - | `2.2.1` | 设备Id |
| `capability` | `number` | 是 | - | `2.2.1` | 能力值标位 5：定时 |
| `complete` | `() => void` | 否 | - | - | 接口调用结束的回调函数（调用成功、失败都会执行） |
| `success` | `(params: Object) => void` ↓见下方 | 否 | - | - | 接口调用成功的回调函数 |
| `fail` | `(params: Object) => void` ↓见下方 | 否 | - | - | 接口调用失败的回调函数 |

#### success 回调参数

| 属性 | 类型 | 最低版本 | 描述 |
| --- | --- | --- | --- |
| `isSupport` | `boolean` | `3.3.0` | 是否支持蓝牙相关能力的结果回调 isSupport 是否支持 |

#### fail 回调参数

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `errorMsg` | `string` | 错误信息 |
| `errorCode` | `string \| number` | 错误码 |
| `innerError` | `Object` | 错误扩展 |

##### fail(params).innerError 的属性

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `errorCode` | `string \| number` | 错误扩展码 |
| `errorMsg` | `string` | 错误扩展信息 |


### 示例代码

#### 基础调用

```tsx
import { device } from '@ray-js/ray'

const { bluetoothCapabilityIsSupport } = device;

bluetoothCapabilityIsSupport({
  deviceId: 'device_001',
  capability: 0,
  success: (result) => {
    console.log('bluetoothCapabilityIsSupport success', result);
  },
  fail: (error) => {
    console.log('bluetoothCapabilityIsSupport fail', error.errorMsg);
  },
});
```
