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 for the Bluetooth device which is registered to deviceAddress, so the process 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 deviceAddress. 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 deviceAddress. 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.
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 Bluetooth device which is registered to deviceAddress.
Removes the bond (result of a successful pairing process) with a specific Bluetooth device which is registered to deviceAddress. It deletes the link key associated with that device and, by doing so, the connections to that device are terminated immediately as reflected in the deviceInformation as an unpaired disconnected device.
Sets the platform side connection policy for profile of the Bluetooth device, which is registered to deviceAddress. When isAllowed is set to true
, the connection will allowed for the profile otherwise the connection will be disallowed.
Initiates pairing with a specific Bluetooth device which is registered to deviceAddress. Once the bond state has changed BluetoothConnectivityStatus.bondState will be update for the device entry in deviceInformation.
Cancels the currently running discovery process. isDiscoveryActive can be used to check if the discovery process is active or not.
Stops the currently running pairing process for device which is registered to deviceAddress.
Turns off the Bluetooth adapter. The Bluetooth state changes are reflected by bluetoothState.
Turns on the Bluetooth adapter. The Bluetooth state changes are reflected by bluetoothState.