---
name: "bluetoothCapabilityIsSupport"
mode: "kit"
versionRequirements:
  - { name: "DeviceKit", version: "2.2.1" }
  - { name: "@ray-js/ray", version: "0.6.23" }
platform:
  - "iOS"
  - "Android"
async: true
---

## bluetoothCapabilityIsSupport

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

> [PLATFORM] iOS, Android

> ⚡ **Supports Promise** — Returns a Promise when success / fail / complete callbacks are omitted.

### Description

Whether the Bluetooth device supports a given capability. The capability value maps to specific abilities: 0: whether DP is controllable during OTA; 1: whether the gateway and App use low-power online logic for this device; 2: whether it has Beacon capability; 3: whether Bluetooth LINK-layer encryption is enabled; 4: whether extension modules are supported; 5: whether scheduling is supported; 6: whether Bluetooth BT/BLE dual-mode is supported; 7: whether LINK-layer encryption is required

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `deviceId` | `string` | Yes | - | `2.2.1` | Device ID |
| `capability` | `number` | Yes | - | `2.2.1` | Capability flag bit 5: Scheduling |
| `complete` | `() => void` | No | - | - | Completion callback (executed on both success and failure) |
| `success` | `(params: Object) => void` ↓see below | No | - | - | Callback on successful API call |
| `fail` | `(params: Object) => void` ↓see below | No | - | - | Failure callback |

#### success callback parameters

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `isSupport` | `boolean` | `3.3.0` | Result callback for whether a Bluetooth-related capability is supported isSupport Whether supported |

#### fail callback parameters

| Property | Type | Description |
| --- | --- | --- |
| `errorMsg` | `string` | Error message |
| `errorCode` | `string \| number` | Error code |
| `innerError` | `Object` | Error extension |

##### fail(params).innerError properties

| Property | Type | Description |
| --- | --- | --- |
| `errorCode` | `string \| number` | Error extension code |
| `errorMsg` | `string` | Error extension message |


### Examples

#### Basic usage

```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);
  },
});
```
