> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rebellapp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# my.getConnectedBluetoothDevices

> Get currently connected Bluetooth devices.

Use this API to get the list of Bluetooth devices that are currently connected.

## Parameters

| Property | Type     | Required | Description                       |
| -------- | -------- | -------- | --------------------------------- |
| deviceId | String   | Yes      | Device ID of the Bluetooth device |
| success  | Function | No       | Callback on success               |
| fail     | Function | No       | Callback on failure               |
| complete | Function | No       | Callback that always executes     |

## Success Callback Parameters

| Property | Type  | Description               |
| -------- | ----- | ------------------------- |
| devices  | Array | List of connected devices |

## Device Object Properties

| Property | Type   | Description       |
| -------- | ------ | ----------------- |
| deviceId | String | Device identifier |
| name     | String | Device name       |

## Code Example

### Basic Usage

```javascript theme={null}
my.getConnectedBluetoothDevices({
  success(res) {
    console.log('Connected devices:', res.devices);
  }
});
```

### Check Specific Device

```javascript theme={null}
my.getConnectedBluetoothDevices({
  deviceId: 'XX:XX:XX:XX:XX:XX',
  success(res) {
    console.log('Connected devices:', res.devices);
  }
});
```

### Check Connection Status

```javascript theme={null}
Page({
  data: {
    connectedDevices: []
  },

  checkConnections() {
    my.getConnectedBluetoothDevices({
      success: (res) => {
        this.setData({ connectedDevices: res.devices });

        if (res.devices.length === 0) {
          my.showToast({ content: 'No devices connected' });
        }
      }
    });
  }
});
```

### Reconnection Logic

```javascript theme={null}
Page({
  targetDeviceId: 'XX:XX:XX:XX:XX:XX',

  checkAndReconnect() {
    my.getConnectedBluetoothDevices({
      success: (res) => {
        const isConnected = res.devices.some(
          d => d.deviceId === this.targetDeviceId
        );

        if (!isConnected) {
          this.reconnectDevice();
        }
      }
    });
  },

  reconnectDevice() {
    my.connectBLEDevice({
      deviceId: this.targetDeviceId,
      success: () => {
        my.showToast({ content: 'Reconnected' });
      }
    });
  }
});
```

## Related APIs

<CardGroup cols={2}>
  <Card title="my.getBluetoothDevices" icon="list" href="/jsapi/device/bluetooth/my.getBluetoothDevices">
    Get discovered devices
  </Card>

  <Card title="my.connectBLEDevice" icon="link" href="/jsapi/device/bluetooth/my.connectBLEDevice">
    Connect to device
  </Card>
</CardGroup>
