The Bluetooth API lets a packaged app discover, pair with, and connect to Bluetooth devices. As it is a experimental and non-standard API, the API is currently available for certified and privileged apps only. Notice that 'bluetooth' permission is required for using Bluetooth API.
Note: App developers who wish to send data to a Bluetooth device can use the share activity. This activity allows sharing of images, audio, video and vCard content only.
The main entry point for the API is the Navigator.mozBluetooth property, which returns a BluetoothManager object.
The following interfaces provide an app with basic Bluetooth functionality
BluetoothManagerAllows access to all Bluetooth adapters available on the device. Adapters are the connection interface to connect another Bluetooth-enabled device to the current device.
BluetoothAdapterUsed to handle all the operations requested by Bluetooth networks.
BluetoothClassOfDeviceProvides identifying/classification information about a given remote Bluetooth device, available at discovery stage.
BluetoothDeviceProvides information regarding a given remote Bluetooth device.
BluetoothDiscoveryHandleUsed to notify the current application about the discovery of a remote bluetooth device.
The following interfaces allow KaiOS to communicate with and consume Gatt (Generic Attribute Profile)-based services on remote Smart/LE (low energy) devices.
BluetoothGattHandles initial communications and connections with Gatt services.
BluetoothGattServiceRepresents a service provided by a GATT server, including the service definition, a list of included services, and a list of the characteristics of this service.
BluetoothGattCharacteristicRepresents a GATT service characteristic, which includes characteristic definition, value, properties and configuration info, and a list of descriptors that provide related information.
BluetoothGattDescriptorRepresents a GATT descriptor, which contains related information about a characteristic value.
Bluetooth event interfaces
These objects represent different events occuring within a Bluetooth interaction.
BluetoothAdapterEventProvides access to a BluetoothAdapter object and its address as the parameter of a adapteradded or adapterremoved event handler (see BluetoothManager.onadapteradded and BluetoothManager.onadapterremoved), when fired.
BluetoothAttributeEventProvides access to changed attributes and their new values as the parameter of attributechanged event handlers (including BluetoothManager.onattributechanged, BluetoothAdapter.onattributechanged, and BluetoothDevice.onattributechanged), when fired.
BluetoothDeviceEventProvides access to a found/paired device (BluetoothDevice) object or the address or an unpaired device as the parameter of a devicefound, devicepaired or deviceunpaired event handler (see BluetoothDiscoveryHandle.ondevicefound, BluetoothAdapter.ondevicepaired, BluetoothAdapter.ondeviceunpaired), when fired.
BluetoothGattCharacteristicEventProvides access to an updated BluetoothGattCharacteristic object as the parameter of the BluetoothGatt.oncharacteristicchanged, handler, when the characteristicchanged event is fired.
BluetoothLeDeviceEventProvides access to an LE device BluetoothDevice object and its RSSI value and advertisement record, as the parameter of a devicefound event handler (see BluetoothDiscoveryHandle.ondevicefound), when fired.