WebBluetoothService

Provides access to the Web Bluetooth API for connecting to Bluetooth Low Energy (BLE) devices. Supports device discovery, GATT service/characteristic read/write, and notifications.

TypeScriptexample.ts
import { WebBluetoothService } from '@angular-helpers/browser-web-apis/experimental'

# Methods

MethodSignatureReturnsDescription
isSupportedisSupported(): booleanbooleanPublic method isSupported.
requestDevicerequestDevice(options?: BluetoothRequestDeviceOptions): Promise<BluetoothDevice>Promise<BluetoothDevice>Requests a Bluetooth device from the user matching the specified options.
getDevicesgetDevices(): Promise<BluetoothDevice[]>Promise<BluetoothDevice[]>Gets a list of permitted Bluetooth devices for this origin.
getAvailabilitygetAvailability(): Promise<boolean>Promise<boolean>Queries whether Bluetooth is available on the user's device/adapter.
connectGattconnectGatt(device: BluetoothDevice): Promise<BluetoothRemoteGATTServer>Promise<BluetoothRemoteGATTServer>Connects to the GATT server on the specified device.
disconnectGattdisconnectGatt(device: BluetoothDevice): voidvoidDisconnects from the GATT server on the specified device.
readCharacteristicreadCharacteristic(characteristic: BluetoothRemoteGATTCharacteristic): Promise<DataView>Promise<DataView>Reads the value of a GATT characteristic.
writeCharacteristicwriteCharacteristic(characteristic: BluetoothRemoteGATTCharacteristic, data: BufferSource, withoutResponse: any): Promise<void>Promise<void>Writes data to a GATT characteristic.
watchCharacteristicNotificationswatchCharacteristicNotifications(characteristic: BluetoothRemoteGATTCharacteristic): Observable<DataView>Observable<DataView>Observes value changes (notifications/indications) on a GATT characteristic.
LCP N/A
CLS N/A
INP N/A