BluetoothConnectivityService
Interface which can be extended by a service implementation, which is responsible for providing clients with information about nearby Bluetooth devices, and functionality to change the connection state of those devices.
The configuration mode indicates when a UI is currently visible which allows a user to make changes to the connectivity state of Bluetooth devices. The mode is intended to be enabled by multiple clients. A client can call enableConfigurationMode to enable the configuration mode and disableConfigurationMode to disable it. The isConfigurationModeEnabled flag can be observed by a client in order to show a UI related to Bluetooth configuration when it is set to true
and to stop showing the UI when the flag is set to false
.
Types
Clients can implement this listener to know when a pairing request has been received.
Properties
Set of all Bluetooth profiles which are supported by the platform and are connectable. When a profile is connectable, the connection policy can be altered by using method setProfileConnectionPolicy.
Map of all the Bluetooth devices where the key is a unique identifier referring to a BluetoothDeviceAddress entry and where the value provides the current BluetoothDeviceInformation of the device.
List of BluetoothDeviceAddresses of the most recently connected Bluetooth devices ordered by how recently they were connected to, with the most recent first and least recent last. The list includes the current connected devices.
Functions
Provides the currently running pairing process with the required pairingDetails, so it can be finalised successfully.
Cleanup deviceInformation by removing all entries which have BluetoothConnectivityStatus.bondState equal to BluetoothConnectivityStatus.BluetoothBondState.UNPAIRED.
Connects to a specific Bluetooth device which is registered to BluetoothDeviceAddress. BluetoothConnectivityStatus.connectionState will be updated for the device entry in deviceInformation.
Disables configuration mode by setting the isConfigurationModeEnabled to false
.
Disconnects from a specific Bluetooth device which is registered to BluetoothDeviceAddress. BluetoothConnectivityStatus.connectionState will be updated for the device entry in deviceInformation.
Enables configuration mode by setting the isConfigurationModeEnabled to true
.
Start discovering devices. When devices are nearby and discoverable they will be added to deviceInformation.
Removes bond (pairing) with a specific Bluetooth device which is registered to BluetoothDeviceAddress. It deletes the link key associated with that device and, by doing so, the connections to that device are terminated immediately.
Retrieves the platform side connection policies of a specific Bluetooth profile for all devices in a specific connection state and/or specific bond state.
Retrieves the platform side connection policy of a specific Bluetooth profile for a specific Bluetooth device.
Sets the platform side connection policy for a specific Bluetooth device, which is registered to BluetoothDeviceAddress. The connection policy of the remote device is not impacted and will not change.
Initiates pairing with a specific Bluetooth device which is registered to BluetoothDeviceAddress. Once the bond state has changed BluetoothConnectivityStatus.bondState will be update for the device entry in deviceInformation.
Stops the currently running pairing process and BluetoothConnectivityStatus.bondState will be set to BluetoothConnectivityStatus.BluetoothBondState.UNPAIRED for the device entry in deviceInformation.