# DeviceBluetoothBinding

`import { DeviceBluetoothBinding } from "destack:device/binding";`

Bluetooth binding family.

```ds title="DeviceBluetoothBinding"
export interface DeviceBluetoothBinding {
    listBluetoothAdapters(): Result<BluetoothAdapter[], HostError>;
    openBluetoothAdapterWatch(): Result<BluetoothAdapterWatchHandle, HostError>;
    closeBluetoothAdapterWatch(watch: BluetoothAdapterWatchHandle): Result<void, HostError>;
    readBluetoothAdapterWatch(watch: BluetoothAdapterWatchHandle, timeoutNs?: uint64 | undefined): Result<BluetoothAdapterEvent, HostError>;
    openBluetoothScan(options: &'a readonly BluetoothScanOptions): Result<BluetoothScanHandle, HostError>;
    closeBluetoothScan(scan: BluetoothScanHandle): Result<void, HostError>;
    readBluetoothScan(scan: BluetoothScanHandle, timeoutNs?: uint64 | undefined): Result<BluetoothScanEvent, HostError>;
    openBluetoothDevice(id: &'a readonly string): Result<BluetoothDeviceHandle, HostError>;
    closeBluetoothDevice(device: BluetoothDeviceHandle): Result<void, HostError>;
    describeBluetoothDevice(device: BluetoothDeviceHandle): Result<BluetoothDevice, HostError>;
    readBluetoothEvent(device: BluetoothDeviceHandle, timeoutNs?: uint64 | undefined): Result<BluetoothSessionEvent, HostError>;
    pairBluetoothDevice(device: BluetoothDeviceHandle): Result<void, HostError>;
    unpairBluetoothDevice(device: BluetoothDeviceHandle): Result<void, HostError>;
    readBluetoothRssi(device: BluetoothDeviceHandle): Result<int32, HostError>;
    listBluetoothGattServices(device: BluetoothDeviceHandle): Result<BluetoothGattService[], HostError>;
    listBluetoothGattCharacteristics(device: BluetoothDeviceHandle, serviceId: &'a readonly string): Result<BluetoothGattCharacteristic[], HostError>;
    listBluetoothGattDescriptors(device: BluetoothDeviceHandle, characteristicId: &'a readonly string): Result<BluetoothGattDescriptor[], HostError>;
    readBluetoothGattCharacteristic(device: BluetoothDeviceHandle, characteristicId: &'a readonly string, buffer: &'b [uint8]): Result<uint64, HostError>;
    writeBluetoothGattCharacteristic(device: BluetoothDeviceHandle, characteristicId: &'a readonly string, value: &'b readonly [uint8], mode: BluetoothGattWriteMode): Result<void, HostError>;
    readBluetoothGattDescriptor(device: BluetoothDeviceHandle, descriptorId: &'a readonly string, buffer: &'b [uint8]): Result<uint64, HostError>;
    writeBluetoothGattDescriptor(device: BluetoothDeviceHandle, descriptorId: &'a readonly string, value: &'b readonly [uint8]): Result<void, HostError>;
    subscribeBluetoothGatt(device: BluetoothDeviceHandle, characteristicId: &'a readonly string): Result<BluetoothSubscriptionHandle, HostError>;
    unsubscribeBluetoothGatt(subscription: BluetoothSubscriptionHandle): Result<void, HostError>;
    readBluetoothGattEvent(subscription: BluetoothSubscriptionHandle, buffer: &'a [uint8], timeoutNs?: uint64 | undefined): Result<BluetoothGattValueEvent, HostError>;
}
```

[language/library/src/device/binding/bluetooth.ds:408:667](https://github.com/destack-sh/destack/blob/main/language/library/src/device/binding/bluetooth.ds#L408-L667)

## Members

### `listBluetoothAdapters(): Result<BluetoothAdapter[], HostError>`

List Bluetooth adapters.

### `openBluetoothAdapterWatch(): Result<BluetoothAdapterWatchHandle, HostError>`

Open a Bluetooth adapter topology watch.

### `closeBluetoothAdapterWatch(watch: BluetoothAdapterWatchHandle): Result<void, HostError>`

Close a Bluetooth adapter topology watch.

### `readBluetoothAdapterWatch(watch: BluetoothAdapterWatchHandle, timeoutNs?: uint64 | undefined): Result<BluetoothAdapterEvent, HostError>`

Read one Bluetooth adapter topology event.

### `openBluetoothScan(options: &'a readonly BluetoothScanOptions): Result<BluetoothScanHandle, HostError>`

Open a Bluetooth LE scan.

### `closeBluetoothScan(scan: BluetoothScanHandle): Result<void, HostError>`

Close a Bluetooth LE scan.

### `readBluetoothScan(scan: BluetoothScanHandle, timeoutNs?: uint64 | undefined): Result<BluetoothScanEvent, HostError>`

Read one Bluetooth scan event.

### `openBluetoothDevice(id: &'a readonly string): Result<BluetoothDeviceHandle, HostError>`

Open a Bluetooth device session.

### `closeBluetoothDevice(device: BluetoothDeviceHandle): Result<void, HostError>`

Close a Bluetooth device session.

### `describeBluetoothDevice(device: BluetoothDeviceHandle): Result<BluetoothDevice, HostError>`

Describe a Bluetooth device session.

### `readBluetoothEvent(device: BluetoothDeviceHandle, timeoutNs?: uint64 | undefined): Result<BluetoothSessionEvent, HostError>`

Read one Bluetooth session event.

### `pairBluetoothDevice(device: BluetoothDeviceHandle): Result<void, HostError>`

Pair a Bluetooth device.

### `unpairBluetoothDevice(device: BluetoothDeviceHandle): Result<void, HostError>`

Unpair a Bluetooth device.

### `readBluetoothRssi(device: BluetoothDeviceHandle): Result<int32, HostError>`

Read Bluetooth signal strength.

### `listBluetoothGattServices(device: BluetoothDeviceHandle): Result<BluetoothGattService[], HostError>`

List Bluetooth GATT services.

### `listBluetoothGattCharacteristics(device: BluetoothDeviceHandle, serviceId: &'a readonly string): Result<BluetoothGattCharacteristic[], HostError>`

List Bluetooth GATT characteristics.

### `listBluetoothGattDescriptors(device: BluetoothDeviceHandle, characteristicId: &'a readonly string): Result<BluetoothGattDescriptor[], HostError>`

List Bluetooth GATT descriptors.

### `readBluetoothGattCharacteristic(device: BluetoothDeviceHandle, characteristicId: &'a readonly string, buffer: &'b [uint8]): Result<uint64, HostError>`

Read a Bluetooth GATT characteristic.

### `writeBluetoothGattCharacteristic(device: BluetoothDeviceHandle, characteristicId: &'a readonly string, value: &'b readonly [uint8], mode: BluetoothGattWriteMode): Result<void, HostError>`

Write a Bluetooth GATT characteristic.

### `readBluetoothGattDescriptor(device: BluetoothDeviceHandle, descriptorId: &'a readonly string, buffer: &'b [uint8]): Result<uint64, HostError>`

Read a Bluetooth GATT descriptor.

### `writeBluetoothGattDescriptor(device: BluetoothDeviceHandle, descriptorId: &'a readonly string, value: &'b readonly [uint8]): Result<void, HostError>`

Write a Bluetooth GATT descriptor.

### `subscribeBluetoothGatt(device: BluetoothDeviceHandle, characteristicId: &'a readonly string): Result<BluetoothSubscriptionHandle, HostError>`

Subscribe to Bluetooth GATT value notifications.

### `unsubscribeBluetoothGatt(subscription: BluetoothSubscriptionHandle): Result<void, HostError>`

Unsubscribe from Bluetooth GATT value notifications.

### `readBluetoothGattEvent(subscription: BluetoothSubscriptionHandle, buffer: &'a [uint8], timeoutNs?: uint64 | undefined): Result<BluetoothGattValueEvent, HostError>`

Read one Bluetooth GATT value notification.
