@capacitor-community/bluetooth-le
Version:
Capacitor plugin for Bluetooth Low Energy
1,316 lines • 107 kB
JSON
{
"api": {
"name": "BleClientInterface",
"slug": "bleclientinterface",
"docs": "",
"tags": [],
"methods": [
{
"name": "initialize",
"signature": "(options?: InitializeOptions | undefined) => Promise<void>",
"parameters": [
{
"name": "options",
"docs": "",
"type": "InitializeOptions | undefined"
}
],
"returns": "Promise<void>",
"tags": [],
"docs": "Initialize Bluetooth Low Energy (BLE). If it fails, BLE might be unavailable on this device.\r\nOn **Android** it will ask for the location permission. On **iOS** it will ask for the Bluetooth permission.\r\nFor an example, see [usage](#usage).",
"complexTypes": [
"InitializeOptions"
],
"slug": "initialize"
},
{
"name": "isEnabled",
"signature": "() => Promise<boolean>",
"parameters": [],
"returns": "Promise<boolean>",
"tags": [],
"docs": "Reports whether Bluetooth is enabled on this device.\r\nAlways returns `true` on **web**.",
"complexTypes": [],
"slug": "isenabled"
},
{
"name": "requestEnable",
"signature": "() => Promise<void>",
"parameters": [],
"returns": "Promise<void>",
"tags": [],
"docs": "Request enabling Bluetooth. Show a system activity that allows the user to turn on Bluetooth. See https://developer.android.com/reference/android/bluetooth/BluetoothAdapter#ACTION_REQUEST_ENABLE\r\nOnly available on **Android**.",
"complexTypes": [],
"slug": "requestenable"
},
{
"name": "enable",
"signature": "() => Promise<void>",
"parameters": [],
"returns": "Promise<void>",
"tags": [
{
"name": "deprecated",
"text": "Will fail on Android SDK >= 33. Use `requestEnable` instead. See https://developer.android.com/reference/android/bluetooth/BluetoothAdapter#enable()"
}
],
"docs": "Enable Bluetooth.\r\nOnly available on **Android**.\r\n**Deprecated** Will fail on Android SDK >= 33. Use `requestEnable` instead. See https://developer.android.com/reference/android/bluetooth/BluetoothAdapter#enable()",
"complexTypes": [],
"slug": "enable"
},
{
"name": "disable",
"signature": "() => Promise<void>",
"parameters": [],
"returns": "Promise<void>",
"tags": [
{
"name": "deprecated",
"text": "Will fail on Android SDK >= 33. See https://developer.android.com/reference/android/bluetooth/BluetoothAdapter#disable()"
}
],
"docs": "Disable Bluetooth.\r\nOnly available on **Android**.\r\n**Deprecated** Will fail on Android SDK >= 33. See https://developer.android.com/reference/android/bluetooth/BluetoothAdapter#disable()",
"complexTypes": [],
"slug": "disable"
},
{
"name": "startEnabledNotifications",
"signature": "(callback: (value: boolean) => void) => Promise<void>",
"parameters": [
{
"name": "callback",
"docs": "Callback function to use when the Bluetooth state changes.",
"type": "(value: boolean) => void"
}
],
"returns": "Promise<void>",
"tags": [
{
"name": "param",
"text": "callback Callback function to use when the Bluetooth state changes."
}
],
"docs": "Register a callback function that will be invoked when Bluetooth is enabled (true) or disabled (false) on this device.\r\nNot available on **web** (the callback will never be invoked).",
"complexTypes": [],
"slug": "startenablednotifications"
},
{
"name": "stopEnabledNotifications",
"signature": "() => Promise<void>",
"parameters": [],
"returns": "Promise<void>",
"tags": [],
"docs": "Stop the enabled notifications registered with `startEnabledNotifications`.",
"complexTypes": [],
"slug": "stopenablednotifications"
},
{
"name": "isLocationEnabled",
"signature": "() => Promise<boolean>",
"parameters": [],
"returns": "Promise<boolean>",
"tags": [],
"docs": "Reports whether Location Services are enabled on this device.\r\nOnly available on **Android**.",
"complexTypes": [],
"slug": "islocationenabled"
},
{
"name": "openLocationSettings",
"signature": "() => Promise<void>",
"parameters": [],
"returns": "Promise<void>",
"tags": [],
"docs": "Open Location settings.\r\nOnly available on **Android**.",
"complexTypes": [],
"slug": "openlocationsettings"
},
{
"name": "openBluetoothSettings",
"signature": "() => Promise<void>",
"parameters": [],
"returns": "Promise<void>",
"tags": [],
"docs": "Open Bluetooth settings.\r\nOnly available on **Android**.",
"complexTypes": [],
"slug": "openbluetoothsettings"
},
{
"name": "openAppSettings",
"signature": "() => Promise<void>",
"parameters": [],
"returns": "Promise<void>",
"tags": [],
"docs": "Open App settings.\r\nNot available on **web**.\r\nOn **iOS** when a user declines the request to use Bluetooth on the first call of `initialize`, it is not possible\r\nto request for Bluetooth again from within the app. In this case Bluetooth has to be enabled in the app settings\r\nfor the app to be able use it.",
"complexTypes": [],
"slug": "openappsettings"
},
{
"name": "setDisplayStrings",
"signature": "(displayStrings: DisplayStrings) => Promise<void>",
"parameters": [
{
"name": "displayStrings",
"docs": "",
"type": "DisplayStrings"
}
],
"returns": "Promise<void>",
"tags": [
{
"name": "param",
"text": "displayStrings"
}
],
"docs": "Set the strings that are displayed in the `requestDevice` dialog.",
"complexTypes": [
"DisplayStrings"
],
"slug": "setdisplaystrings"
},
{
"name": "requestDevice",
"signature": "(options?: RequestBleDeviceOptions | undefined) => Promise<BleDevice>",
"parameters": [
{
"name": "options",
"docs": "Device filters, see [RequestBleDeviceOptions](#RequestBleDeviceOptions)",
"type": "RequestBleDeviceOptions | undefined"
}
],
"returns": "Promise<BleDevice>",
"tags": [
{
"name": "param",
"text": "options Device filters, see [RequestBleDeviceOptions](#RequestBleDeviceOptions)"
}
],
"docs": "Request a peripheral BLE device to interact with. This will scan for available devices according to the filters in the options and show a dialog to pick a device.\r\nFor an example, see [usage](#usage).",
"complexTypes": [
"BleDevice",
"RequestBleDeviceOptions"
],
"slug": "requestdevice"
},
{
"name": "requestLEScan",
"signature": "(options: RequestBleDeviceOptions, callback: (result: ScanResult) => void) => Promise<void>",
"parameters": [
{
"name": "options",
"docs": "",
"type": "RequestBleDeviceOptions"
},
{
"name": "callback",
"docs": "",
"type": "(result: ScanResult) => void"
}
],
"returns": "Promise<void>",
"tags": [
{
"name": "param",
"text": "options"
},
{
"name": "param",
"text": "callback"
}
],
"docs": "Start scanning for BLE devices to interact with according to the filters in the options. The callback will be invoked on each device that is found.\r\nScanning will continue until `stopLEScan` is called. For an example, see [usage](#usage).\r\n**Note**: Use with care on **web** platform, the required API is still behind a flag in most browsers.",
"complexTypes": [
"RequestBleDeviceOptions",
"ScanResult"
],
"slug": "requestlescan"
},
{
"name": "stopLEScan",
"signature": "() => Promise<void>",
"parameters": [],
"returns": "Promise<void>",
"tags": [],
"docs": "Stop scanning for BLE devices. For an example, see [usage](#usage).",
"complexTypes": [],
"slug": "stoplescan"
},
{
"name": "getDevices",
"signature": "(deviceIds: string[]) => Promise<BleDevice[]>",
"parameters": [
{
"name": "deviceIds",
"docs": "List of device IDs, e.g. saved from a previous app run.",
"type": "string[]"
}
],
"returns": "Promise<BleDevice[]>",
"tags": [
{
"name": "param",
"text": "deviceIds List of device IDs, e.g. saved from a previous app run."
}
],
"docs": "On iOS and web, if you want to connect to a previously connected device without scanning first, you can use `getDevice`.\r\nUses [retrievePeripherals](https://developer.apple.com/documentation/corebluetooth/cbcentralmanager/1519127-retrieveperipherals) on iOS and\r\n[getDevices](https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/getDevices) on web.\r\nOn Android, you can directly connect to the device with the deviceId.",
"complexTypes": [
"BleDevice"
],
"slug": "getdevices"
},
{
"name": "getBondedDevices",
"signature": "() => Promise<BleDevice[]>",
"parameters": [],
"returns": "Promise<BleDevice[]>",
"tags": [],
"docs": "Get a list of currently bonded devices.\r\nOnly available on **Android**.\r\nUses [getBondedDevices](https://developer.android.com/reference/android/bluetooth/BluetoothAdapter#getBondedDevices()) on Android",
"complexTypes": [
"BleDevice"
],
"slug": "getbondeddevices"
},
{
"name": "getConnectedDevices",
"signature": "(services: string[]) => Promise<BleDevice[]>",
"parameters": [
{
"name": "services",
"docs": "List of services to filter the devices by. If no service is specified, no devices will be returned. Only applies to iOS.",
"type": "string[]"
}
],
"returns": "Promise<BleDevice[]>",
"tags": [
{
"name": "param",
"text": "services List of services to filter the devices by. If no service is specified, no devices will be returned. Only applies to iOS."
}
],
"docs": "Get a list of currently connected devices.\r\nUses [retrieveConnectedPeripherals](https://developer.apple.com/documentation/corebluetooth/cbcentralmanager/1518924-retrieveconnectedperipherals) on iOS,\r\n[getConnectedDevices](https://developer.android.com/reference/android/bluetooth/BluetoothManager#getConnectedDevices(int)) on Android\r\nand [getDevices](https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/getDevices) on web.",
"complexTypes": [
"BleDevice"
],
"slug": "getconnecteddevices"
},
{
"name": "connect",
"signature": "(deviceId: string, onDisconnect?: ((deviceId: string) => void) | undefined, options?: TimeoutOptions | undefined) => Promise<void>",
"parameters": [
{
"name": "deviceId",
"docs": "The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))",
"type": "string"
},
{
"name": "onDisconnect",
"docs": "Optional disconnect callback function that will be used when the device disconnects",
"type": "((deviceId: string) => void) | undefined"
},
{
"name": "options",
"docs": "Options for plugin call",
"type": "TimeoutOptions | undefined"
}
],
"returns": "Promise<void>",
"tags": [
{
"name": "param",
"text": "deviceId The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))"
},
{
"name": "param",
"text": "onDisconnect Optional disconnect callback function that will be used when the device disconnects"
},
{
"name": "param",
"text": "options Options for plugin call"
}
],
"docs": "Connect to a peripheral BLE device. For an example, see [usage](#usage).",
"complexTypes": [
"TimeoutOptions"
],
"slug": "connect"
},
{
"name": "createBond",
"signature": "(deviceId: string, options?: TimeoutOptions | undefined) => Promise<void>",
"parameters": [
{
"name": "deviceId",
"docs": "The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))",
"type": "string"
},
{
"name": "options",
"docs": "Options for plugin call",
"type": "TimeoutOptions | undefined"
}
],
"returns": "Promise<void>",
"tags": [
{
"name": "param",
"text": "deviceId The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))"
},
{
"name": "param",
"text": "options Options for plugin call"
}
],
"docs": "Create a bond with a peripheral BLE device.\r\nOnly available on **Android**. On iOS bonding is handled by the OS.",
"complexTypes": [
"TimeoutOptions"
],
"slug": "createbond"
},
{
"name": "isBonded",
"signature": "(deviceId: string) => Promise<boolean>",
"parameters": [
{
"name": "deviceId",
"docs": "The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))",
"type": "string"
}
],
"returns": "Promise<boolean>",
"tags": [
{
"name": "param",
"text": "deviceId The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))"
}
],
"docs": "Report whether a peripheral BLE device is bonded.\r\nOnly available on **Android**. On iOS bonding is handled by the OS.",
"complexTypes": [],
"slug": "isbonded"
},
{
"name": "disconnect",
"signature": "(deviceId: string) => Promise<void>",
"parameters": [
{
"name": "deviceId",
"docs": "The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))",
"type": "string"
}
],
"returns": "Promise<void>",
"tags": [
{
"name": "param",
"text": "deviceId The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))"
}
],
"docs": "Disconnect from a peripheral BLE device. For an example, see [usage](#usage).",
"complexTypes": [],
"slug": "disconnect"
},
{
"name": "getServices",
"signature": "(deviceId: string) => Promise<BleService[]>",
"parameters": [
{
"name": "deviceId",
"docs": "The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))",
"type": "string"
}
],
"returns": "Promise<BleService[]>",
"tags": [
{
"name": "param",
"text": "deviceId The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))"
}
],
"docs": "Get services, characteristics and descriptors of a device.",
"complexTypes": [
"BleService"
],
"slug": "getservices"
},
{
"name": "discoverServices",
"signature": "(deviceId: string) => Promise<void>",
"parameters": [
{
"name": "deviceId",
"docs": "The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))",
"type": "string"
}
],
"returns": "Promise<void>",
"tags": [
{
"name": "param",
"text": "deviceId The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))"
}
],
"docs": "Discover services, characteristics and descriptors of a device.\r\nYou only need this method if your peripheral device changes its services and characteristics at runtime.\r\nIf the discovery was successful, the remote services can be retrieved using the getServices function.\r\nNot available on **web**.",
"complexTypes": [],
"slug": "discoverservices"
},
{
"name": "getMtu",
"signature": "(deviceId: string) => Promise<number>",
"parameters": [
{
"name": "deviceId",
"docs": "The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))",
"type": "string"
}
],
"returns": "Promise<number>",
"tags": [
{
"name": "param",
"text": "deviceId The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))"
}
],
"docs": "Get the MTU of a connected device. Note that the maximum write value length is 3 bytes less than the MTU.\r\nNot available on **web**.",
"complexTypes": [],
"slug": "getmtu"
},
{
"name": "requestConnectionPriority",
"signature": "(deviceId: string, connectionPriority: ConnectionPriority) => Promise<void>",
"parameters": [
{
"name": "deviceId",
"docs": "The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))",
"type": "string"
},
{
"name": "connectionPriority",
"docs": "Request a specific connection priority. See [ConnectionPriority](#connectionpriority)",
"type": "ConnectionPriority"
}
],
"returns": "Promise<void>",
"tags": [
{
"name": "param",
"text": "deviceId The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))"
},
{
"name": "param",
"text": "connectionPriority Request a specific connection priority. See [ConnectionPriority](#connectionpriority)"
}
],
"docs": "Request a connection parameter update.\r\nOnly available on **Android**. https://developer.android.com/reference/android/bluetooth/BluetoothGatt#requestConnectionPriority(int)",
"complexTypes": [
"ConnectionPriority"
],
"slug": "requestconnectionpriority"
},
{
"name": "readRssi",
"signature": "(deviceId: string) => Promise<number>",
"parameters": [
{
"name": "deviceId",
"docs": "The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))",
"type": "string"
}
],
"returns": "Promise<number>",
"tags": [
{
"name": "param",
"text": "deviceId The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))"
}
],
"docs": "Read the RSSI value of a connected device.\r\nNot available on **web**.",
"complexTypes": [],
"slug": "readrssi"
},
{
"name": "read",
"signature": "(deviceId: string, service: string, characteristic: string, options?: TimeoutOptions | undefined) => Promise<DataView>",
"parameters": [
{
"name": "deviceId",
"docs": "The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))",
"type": "string"
},
{
"name": "service",
"docs": "UUID of the service (see [UUID format](#uuid-format))",
"type": "string"
},
{
"name": "characteristic",
"docs": "UUID of the characteristic (see [UUID format](#uuid-format))",
"type": "string"
},
{
"name": "options",
"docs": "Options for plugin call",
"type": "TimeoutOptions | undefined"
}
],
"returns": "Promise<DataView>",
"tags": [
{
"name": "param",
"text": "deviceId The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))"
},
{
"name": "param",
"text": "service UUID of the service (see [UUID format](#uuid-format))"
},
{
"name": "param",
"text": "characteristic UUID of the characteristic (see [UUID format](#uuid-format))"
},
{
"name": "param",
"text": "options Options for plugin call"
}
],
"docs": "Read the value of a characteristic. For an example, see [usage](#usage).",
"complexTypes": [
"DataView",
"TimeoutOptions"
],
"slug": "read"
},
{
"name": "write",
"signature": "(deviceId: string, service: string, characteristic: string, value: DataView, options?: TimeoutOptions | undefined) => Promise<void>",
"parameters": [
{
"name": "deviceId",
"docs": "The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))",
"type": "string"
},
{
"name": "service",
"docs": "UUID of the service (see [UUID format](#uuid-format))",
"type": "string"
},
{
"name": "characteristic",
"docs": "UUID of the characteristic (see [UUID format](#uuid-format))",
"type": "string"
},
{
"name": "value",
"docs": "The value to write as a DataView. To create a DataView from an array of numbers, there is a helper function, e.g. numbersToDataView([1, 0])",
"type": "DataView"
},
{
"name": "options",
"docs": "Options for plugin call",
"type": "TimeoutOptions | undefined"
}
],
"returns": "Promise<void>",
"tags": [
{
"name": "param",
"text": "deviceId The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))"
},
{
"name": "param",
"text": "service UUID of the service (see [UUID format](#uuid-format))"
},
{
"name": "param",
"text": "characteristic UUID of the characteristic (see [UUID format](#uuid-format))"
},
{
"name": "param",
"text": "value The value to write as a DataView. To create a DataView from an array of numbers, there is a helper function, e.g. numbersToDataView([1, 0])"
},
{
"name": "param",
"text": "options Options for plugin call"
}
],
"docs": "Write a value to a characteristic. For an example, see [usage](#usage).",
"complexTypes": [
"DataView",
"TimeoutOptions"
],
"slug": "write"
},
{
"name": "writeWithoutResponse",
"signature": "(deviceId: string, service: string, characteristic: string, value: DataView, options?: TimeoutOptions | undefined) => Promise<void>",
"parameters": [
{
"name": "deviceId",
"docs": "The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))",
"type": "string"
},
{
"name": "service",
"docs": "UUID of the service (see [UUID format](#uuid-format))",
"type": "string"
},
{
"name": "characteristic",
"docs": "UUID of the characteristic (see [UUID format](#uuid-format))",
"type": "string"
},
{
"name": "value",
"docs": "The value to write as a DataView. To create a DataView from an array of numbers, there is a helper function, e.g. numbersToDataView([1, 0])",
"type": "DataView"
},
{
"name": "options",
"docs": "Options for plugin call",
"type": "TimeoutOptions | undefined"
}
],
"returns": "Promise<void>",
"tags": [
{
"name": "param",
"text": "deviceId The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))"
},
{
"name": "param",
"text": "service UUID of the service (see [UUID format](#uuid-format))"
},
{
"name": "param",
"text": "characteristic UUID of the characteristic (see [UUID format](#uuid-format))"
},
{
"name": "param",
"text": "value The value to write as a DataView. To create a DataView from an array of numbers, there is a helper function, e.g. numbersToDataView([1, 0])"
},
{
"name": "param",
"text": "options Options for plugin call"
}
],
"docs": "Write a value to a characteristic without waiting for a response.",
"complexTypes": [
"DataView",
"TimeoutOptions"
],
"slug": "writewithoutresponse"
},
{
"name": "readDescriptor",
"signature": "(deviceId: string, service: string, characteristic: string, descriptor: string, options?: TimeoutOptions | undefined) => Promise<DataView>",
"parameters": [
{
"name": "deviceId",
"docs": "The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))",
"type": "string"
},
{
"name": "service",
"docs": "UUID of the service (see [UUID format](#uuid-format))",
"type": "string"
},
{
"name": "characteristic",
"docs": "UUID of the characteristic (see [UUID format](#uuid-format))",
"type": "string"
},
{
"name": "descriptor",
"docs": "UUID of the descriptor (see [UUID format](#uuid-format))",
"type": "string"
},
{
"name": "options",
"docs": "Options for plugin call",
"type": "TimeoutOptions | undefined"
}
],
"returns": "Promise<DataView>",
"tags": [
{
"name": "param",
"text": "deviceId The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))"
},
{
"name": "param",
"text": "service UUID of the service (see [UUID format](#uuid-format))"
},
{
"name": "param",
"text": "characteristic UUID of the characteristic (see [UUID format](#uuid-format))"
},
{
"name": "param",
"text": "descriptor UUID of the descriptor (see [UUID format](#uuid-format))"
},
{
"name": "param",
"text": "options Options for plugin call"
}
],
"docs": "Read the value of a descriptor.",
"complexTypes": [
"DataView",
"TimeoutOptions"
],
"slug": "readdescriptor"
},
{
"name": "writeDescriptor",
"signature": "(deviceId: string, service: string, characteristic: string, descriptor: string, value: DataView, options?: TimeoutOptions | undefined) => Promise<void>",
"parameters": [
{
"name": "deviceId",
"docs": "The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))",
"type": "string"
},
{
"name": "service",
"docs": "UUID of the service (see [UUID format](#uuid-format))",
"type": "string"
},
{
"name": "characteristic",
"docs": "UUID of the characteristic (see [UUID format](#uuid-format))",
"type": "string"
},
{
"name": "descriptor",
"docs": "UUID of the descriptor (see [UUID format](#uuid-format))",
"type": "string"
},
{
"name": "value",
"docs": "The value to write as a DataView. To create a DataView from an array of numbers, there is a helper function, e.g. numbersToDataView([1, 0])",
"type": "DataView"
},
{
"name": "options",
"docs": "Options for plugin call",
"type": "TimeoutOptions | undefined"
}
],
"returns": "Promise<void>",
"tags": [
{
"name": "param",
"text": "deviceId The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))"
},
{
"name": "param",
"text": "service UUID of the service (see [UUID format](#uuid-format))"
},
{
"name": "param",
"text": "characteristic UUID of the characteristic (see [UUID format](#uuid-format))"
},
{
"name": "param",
"text": "descriptor UUID of the descriptor (see [UUID format](#uuid-format))"
},
{
"name": "param",
"text": "value The value to write as a DataView. To create a DataView from an array of numbers, there is a helper function, e.g. numbersToDataView([1, 0])"
},
{
"name": "param",
"text": "options Options for plugin call"
}
],
"docs": "Write a value to a descriptor.",
"complexTypes": [
"DataView",
"TimeoutOptions"
],
"slug": "writedescriptor"
},
{
"name": "startNotifications",
"signature": "(deviceId: string, service: string, characteristic: string, callback: (value: DataView) => void) => Promise<void>",
"parameters": [
{
"name": "deviceId",
"docs": "The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))",
"type": "string"
},
{
"name": "service",
"docs": "UUID of the service (see [UUID format](#uuid-format))",
"type": "string"
},
{
"name": "characteristic",
"docs": "UUID of the characteristic (see [UUID format](#uuid-format))",
"type": "string"
},
{
"name": "callback",
"docs": "Callback function to use when the value of the characteristic changes",
"type": "(value: DataView) => void"
}
],
"returns": "Promise<void>",
"tags": [
{
"name": "param",
"text": "deviceId The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))"
},
{
"name": "param",
"text": "service UUID of the service (see [UUID format](#uuid-format))"
},
{
"name": "param",
"text": "characteristic UUID of the characteristic (see [UUID format](#uuid-format))"
},
{
"name": "param",
"text": "callback Callback function to use when the value of the characteristic changes"
}
],
"docs": "Start listening to changes of the value of a characteristic.\r\nNote that you should only start the notifications once per characteristic in your app and share the data and\r\nnot call `startNotifications` in every component that needs the data.\r\nFor an example, see [usage](#usage).",
"complexTypes": [
"DataView"
],
"slug": "startnotifications"
},
{
"name": "stopNotifications",
"signature": "(deviceId: string, service: string, characteristic: string) => Promise<void>",
"parameters": [
{
"name": "deviceId",
"docs": "The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))",
"type": "string"
},
{
"name": "service",
"docs": "UUID of the service (see [UUID format](#uuid-format))",
"type": "string"
},
{
"name": "characteristic",
"docs": "UUID of the characteristic (see [UUID format](#uuid-format))",
"type": "string"
}
],
"returns": "Promise<void>",
"tags": [
{
"name": "param",
"text": "deviceId The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan))"
},
{
"name": "param",
"text": "service UUID of the service (see [UUID format](#uuid-format))"
},
{
"name": "param",
"text": "characteristic UUID of the characteristic (see [UUID format](#uuid-format))"
}
],
"docs": "Stop listening to the changes of the value of a characteristic. For an example, see [usage](#usage).",
"complexTypes": [],
"slug": "stopnotifications"
}
],
"properties": []
},
"interfaces": [
{
"name": "InitializeOptions",
"slug": "initializeoptions",
"docs": "",
"tags": [],
"methods": [],
"properties": [
{
"name": "androidNeverForLocation",
"tags": [
{
"text": "false",
"name": "default"
}
],
"docs": "If your app doesn't use Bluetooth scan results to derive physical\r\nlocation information, you can strongly assert that your app\r\ndoesn't derive physical location. (Android only)\r\nRequires adding 'neverForLocation' to AndroidManifest.xml\r\nhttps://developer.android.com/guide/topics/connectivity/bluetooth/permissions#assert-never-for-location",
"complexTypes": [],
"type": "boolean | undefined"
}
]
},
{
"name": "DisplayStrings",
"slug": "displaystrings",
"docs": "",
"tags": [],
"methods": [],
"properties": [
{
"name": "scanning",
"tags": [
{
"text": "0.0.1",
"name": "since"
},
{
"text": "\"Scanning...\"",
"name": "default"
},
{
"text": "\"Am Scannen...\"",
"name": "example"
}
],
"docs": "",
"complexTypes": [],
"type": "string | undefined"
},
{
"name": "cancel",
"tags": [
{
"text": "0.0.1",
"name": "since"
},
{
"text": "\"Cancel\"",
"name": "default"
},
{
"text": "\"Abbrechen\"",
"name": "example"
}
],
"docs": "",
"complexTypes": [],
"type": "string | undefined"
},
{
"name": "availableDevices",
"tags": [
{
"text": "0.0.1",
"name": "since"
},
{
"text": "\"Available devices\"",
"name": "default"
},
{
"text": "\"Verfügbare Geräte\"",
"name": "example"
}
],
"docs": "",
"complexTypes": [],
"type": "string | undefined"
},
{
"name": "noDeviceFound",
"tags": [
{
"text": "0.0.1",
"name": "since"
},
{
"text": "\"No device found\"",
"name": "default"
},
{
"text": "\"Kein Gerät gefunden\"",
"name": "example"
}
],
"docs": "",
"complexTypes": [],
"type": "string | undefined"
}
]
},
{
"name": "BleDevice",
"slug": "bledevice",
"docs": "",
"tags": [],
"methods": [],
"properties": [
{
"name": "deviceId",
"tags": [],
"docs": "ID of the device, which will be needed for further calls.\r\nOn **Android** this is the BLE MAC address.\r\nOn **iOS** and **web** it is an identifier.",
"complexTypes": [],
"type": "string"
},
{
"name": "name",
"tags": [],
"docs": "Name of the peripheral device.",
"complexTypes": [],
"type": "string | undefined"
},
{
"name": "uuids",
"tags": [],
"docs": "",
"complexTypes": [],
"type": "string[] | undefined"
}
]
},
{
"name": "RequestBleDeviceOptions",
"slug": "requestbledeviceoptions",
"docs": "",
"tags": [],
"methods": [],
"properties": [
{
"name": "services",
"tags": [],
"docs": "Filter devices by service UUIDs.\r\nUUIDs have to be specified as 128 bit UUID strings,\r\ne.g. ['0000180d-0000-1000-8000-00805f9b34fb']\r\nThere is a helper function to convert numbers to UUIDs.\r\ne.g. [numberToUUID(0x180f)]. (see [UUID format](#uuid-format))",
"complexTypes": [],
"type": "string[] | undefined"
},
{
"name": "name",
"tags": [],
"docs": "Filter devices by name",
"complexTypes": [],
"type": "string | undefined"
},
{
"name": "namePrefix",
"tags": [],
"docs": "Filter devices by name prefix",
"complexTypes": [],
"type": "string | undefined"
},
{
"name": "optionalServices",
"tags": [],
"docs": "For **web**, all services that will be used have to be listed under services or optionalServices,\r\ne.g. [numberToUUID(0x180f)] (see [UUID format](#uuid-format))",
"complexTypes": [],
"type": "string[] | undefined"
},
{
"name": "allowDuplicates",
"tags": [],
"docs": "Normally scans will discard the second and subsequent advertisements from a single device.\r\nIf you need to receive them, set allowDuplicates to true (only applicable in `requestLEScan`).\r\n(default: false)",
"complexTypes": [],
"type": "boolean | undefined"
},
{
"name": "scanMode",
"tags": [],
"docs": "Android scan mode (default: ScanMode.SCAN_MODE_BALANCED)",
"complexTypes": [
"ScanMode"
],
"type": "ScanMode"
},
{
"name": "manufacturerData",
"tags": [],
"docs": "Allow scanning for devices with a specific manufacturer data\r\nhttps://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/requestDevice#manufacturerdata",
"complexTypes": [
"ManufacturerDataFilter"
],
"type": "ManufacturerDataFilter[] | undefined"
}
]
},
{
"name": "ManufacturerDataFilter",
"slug": "manufacturerdatafilter",
"docs": "",
"tags": [],
"methods": [],
"properties": [
{
"name": "companyIdentifier",
"tags": [],
"docs": "Company ID (sometimes called the manufacturer ID) to search for in the manufacturer data field.",
"complexTypes": [],
"type": "number"
},
{
"name": "dataPrefix",
"tags": [],
"docs": "Prefix to match in the manufacturer data field.\r\nOn **Android** this field is mandatory.",
"complexTypes": [
"Uint8Array"
],
"type": "Uint8Array"
},
{
"name": "mask",
"tags": [],
"docs": "Set filter on partial manufacture data. For any bit in the mask, set it the 1 if it needs to match the one in manufacturer data, otherwise set it to 0.\r\nThe `mask` must have the same length of dataPrefix.",
"complexTypes": [
"Uint8Array"
],
"type": "Uint8Array"
}
]
},
{
"name": "Uint8Array",
"slug": "uint8array",
"docs": "A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the\r\nrequested number of bytes could not be allocated an exception is raised.",
"tags": [],
"methods": [
{
"name": "copyWithin",
"signature": "(target: number, start: number, end?: number | undefined) => this",
"parameters": [
{
"name": "target",
"docs": "If target is negative, it is treated as length+target where length is the\r\nlength of the array.",
"type": "number"
},
{
"name": "start",
"docs": "If start is negative, it is treated as length+start. If end is negative, it\r\nis treated as length+end.",
"type": "number"
},
{
"name": "end",
"docs": "If not specified, length of the this object is used as its default value.",
"type": "number | undefined"
}
],
"returns": "this",
"tags": [
{
"name": "param",
"text": "target If target is negative, it is treated as length+target where length is the\r\nlength of the array."
},
{
"name": "param",
"text": "start If start is negative, it is treated as length+start. If end is negative, it\r\nis treated as length+end."
},
{
"name": "param",
"text": "end If not specified, length of the this object is used as its default value."
}
],
"docs": "Returns the this object after copying a section of the array identified by start and end\r\nto the same array starting at position target",
"complexTypes": [],
"slug": "copywithin"
},
{
"name": "every",
"signature": "(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any) => boolean",
"parameters": [
{
"name": "predicate",
"docs": "A function that accepts up to three arguments. The every method calls\r\nthe predicate function for each element in the array until the predicate returns a value\r\nwhich is coercible to the Boolean value false, or until the end of the array.",
"type": "(value: number, index: number, array: Uint8Array) => unknown"
},
{
"name": "thisArg",
"docs": "An object to which the this keyword can refer in the predicate function.\r\nIf thisArg is omitted, undefined is used as the this value.",
"type": "any"
}
],
"returns": "boolean",
"tags": [
{
"name": "param",
"text": "predicate A function that accepts up to three arguments. The every method calls\r\nthe predicate function for each element in the array until the predicate returns a value\r\nwhich is coercible to the Boolean value false, or until the end of the array."
},
{
"name": "param",
"text": "thisArg An object to which the this keyword can refer in the predicate function.\r\nIf thisArg is omitted, undefined is used as the this value."
}
],
"docs": "Determines whether all the members of an array satisfy the specified test.",
"complexTypes": [
"Uint8Array"
],
"slug": "every"
},
{
"name": "fill",
"signature": "(value: number, start?: number | undefined, end?: number | undefined) => this",
"parameters": [
{
"name": "value",
"docs": "value to fill array section with",
"type": "number"
},
{
"name": "start",
"docs": "index to start filling the array at. If start is negative, it is treated as\r\nlength+start where length is the length of the array.",
"type": "number | undefined"
},
{
"name": "end",
"docs": "index to stop filling the array at. If end is negative, it is treated as\r\nlength+end.",
"type": "number | undefined"
}
],
"returns": "this",
"tags": [
{
"name": "param",
"text": "value value to fill array section with"
},
{
"name": "param",
"text": "start index to start filling the array at. If start is negative, it is treated as\r\nlength+start where length is the length of the array."
},
{
"name": "param",
"text": "end index to stop filling the array at. If end is negative, it is treated as\r\nlength+end."
}
],
"docs": "Returns the this object after filling the section identified by start and end with value",
"complexTypes": [],
"slug": "fill"
},
{
"name": "filter",
"signature": "(predicate: (value: number, index: number, array: Uint8Array) => any, thisArg?: any) => Uint8Array",
"parameters": [
{
"name": "predicate",
"docs": "A function that accepts up to three arguments. The filter method calls\r\nthe predicate function one time for each element in the array.",
"type": "(value: number, index: number, array: Uint8Array) => any"
},
{
"name": "thisArg",
"docs": "An object to which the this keyword can refer in the predicate function.\r\nIf thisArg is omitted, undefined is used as the this value.",
"type": "any"
}
],
"returns": "Uint8Array",
"tags": [
{
"name": "param",
"text": "predicate A function that accepts up to three arguments. The filter method calls\r\nthe predicate function one time for each element in the array."
},
{
"name": "param",
"text": "thisArg An object to which the this keyword can refer in the predicate function.\r\nIf thisArg is omitted, undefined is used as the this value."
}
],
"docs": "Returns the elements of an array that meet the condition specified in a callback function.",
"complexTypes": [
"Uint8Array"
],
"slug": "filter"
},
{
"name": "find",
"signature": "(predicate: (value: number, index: number, obj: Uint8Array) => boolean, thisArg?: any) => number | undefined",
"parameters": [
{
"name": "predicate",
"docs": "find calls predicate once for each element of the array, in ascending\r\norder, until it finds one where predicate returns true. If such an element is found, find\r\nimmediately returns that element value. Otherwise, find returns undefined.",
"type": "(value: number, index: number, obj: Uint8Array) => boolean"
},
{
"name": "thisArg",
"docs": "If provided, it will be used as the this value for