UNPKG

@capacitor-community/bluetooth-le

Version:
1,350 lines (1,349 loc) 110 kB
{ "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?: ConnectClientOptions | 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": "ConnectClientOptions | 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": [ "ConnectClientOptions" ], "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, 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": "callback", "docs": "Callback function to use when the value of the characteristic changes", "type": "(value: DataView) => void" }, { "name": "options", "docs": "Options for plugin call. Timeout not supported on **web**.", "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": "callback Callback function to use when the value of the characteristic changes" }, { "name": "param", "text": "options Options for plugin call. Timeout not supported on **web**." } ], "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", "TimeoutOptions" ], "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": "displayMode", "tags": [ { "text": "\"alert\"", "name": "default" } ], "docs": "Display mode for the device list in `requestDevice` (**iOS** only).\r\n- `\"alert\"`: Classic alert dialog (default)\r\n- `\"list\"`: Scrollable list view", "complexTypes": [], "type": "'alert' | 'list' | undefined" }, { "name": "serviceData", "tags": [], "docs": "Allow scanning for devices with specific service data.\r\nService data is data associated with a specific service UUID in the advertisement packet.\r\nUseful for protocols like OpenDroneID, EddyStone, and Open Beacon.", "complexTypes": [ "ServiceDataFilter" ], "type": "ServiceDataFilter[] | 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.\r\nandroid, ios: DataView\r\nweb: Uint8Array", "complexTypes": [ "DataView", "Uint8Array" ], "type": "DataView | Uint8Array | undefined" }, { "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.\r\nandroid, ios: DataView\r\nweb: Uint8Array", "complexTypes": [ "DataView", "Uint8Array" ], "type": "DataView | Uint8Array | undefined" } ] }, { "name": "DataView", "slug": "dataview", "docs": "", "tags": [], "methods": [ { "name": "getFloat32", "signature": "(byteOffset: number, littleEndian?: boolean | undefined) => number", "parameters": [ { "name": "byteOffset", "docs": "The place in the buffer at which the value should be retrieved.", "type": "number" }, { "name": "littleEndian", "docs": "", "type": "boolean | undefined" } ], "returns": "number", "tags": [ { "name": "param", "text": "byteOffset The place in the buffer at which the value should be retrieved." } ], "docs": "Gets the Float32 value at the specified byte offset from the start of the view. There is\r\nno alignment constraint; multi-byte values may be fetched from any offset.", "complexTypes": [], "slug": "getfloat32" }, { "name": "getFloat64", "signature": "(byteOffset: number, littleEndian?: boolean | undefined) => number", "parameters": [ { "name": "byteOffset", "docs": "The place in the buffer at which the value should be retrieved.", "type": "number" }, { "name": "littleEndian", "docs": "", "type": "boolean | undefined" } ], "returns": "number", "tags": [ { "name": "param", "text": "byteOffset The place in the buffer at which the value should be retrieved." } ], "docs": "Gets the Float64 value at the specified byte offset from the start of the view. There is\r\nno alignment constraint; multi-byte values may be fetched from any offset.", "complexTypes": [], "slug": "getfloat64" }, { "name": "getInt8", "signature": "(byteOffset: number) => number", "parameters": [ { "name": "byteOffset", "docs": "The place in the buffer at which the value should be retrieved.", "type": "number" } ], "returns": "number", "tags": [ { "name": "param", "text": "byteOffset The place in the buffer at which the value should be retrieved." } ], "docs": "Gets the Int8 value at the specified byte offset from the start of the view. There is\r\nno alignment constraint; multi-byte values may be fetched from any offset.", "complexTypes": [], "slug": "getint8" }, { "name": "getInt16", "signature": "(byteOffset: number, littleEndian?: boolean | undefined) => number", "parameters": [ { "name": "byteOffset", "docs": "The place in the buffer at which the value should be retrieved.", "type": "number" }, { "name": "littleEndian", "docs": "", "type": "boolean | undefined" } ], "returns": "number", "tags": [ { "name": "param", "text": "byteOffset The place in the buffer at which the value should be retrieved." } ], "docs": "Gets the Int16 value at the specified byte offset from the start of the view. There is\r\nno alignment constraint; multi-byte values may be fetched from any offset.", "complexTypes": [], "slug": "getint16" }, { "name": "getInt32", "signature": "(byteOffset: number, littleEndian?: boolean | undefined) => number", "parameters": [ { "name": "byteOffset", "docs": "The place in the buffer at which the value should be retrieved.", "type": "number" }, { "name": "littleEndian", "docs": "", "type": "boolean | undefined" } ], "returns": "number", "tags": [ { "name": "param", "text": "byteOffset The place in the buffer at which the value should be retrieved." } ], "docs": "Gets the Int32 value at the specified byte offset from the start of the view. There is\r\nno alignment constraint; multi-byte values may be fetched from any offset.", "complexTypes": [], "slug": "getint32" }, { "name": "getUint8", "signature": "(byteOffset: number) => number", "parameters": [ { "name": "byteOffset", "docs": "The place in the buffer at which the value should be retrieved.", "type": "number" } ], "returns": "number", "tags": [ { "name": "param", "text": "byteOffset The place in the buffer at which the value should be retrieved." } ], "docs": "Gets the Uint8 value at the specified byte offset from the start of the view. There is\r\nno alignment constraint; multi-byte values may be fetched from any offset.", "complexTypes": [], "slug": "getuint8" }, { "name": "getUint16", "signature": "(byteOffset: number, littleEndian?: boolean | undefined) => number", "parameters": [ { "name": "byteOffset", "docs": "The place in the buffer at which the value should be retrieved.", "type": "number"