Bluetooth
You can use Bluetooth functionalities in your application, such as managing the local Bluetooth adapter, bonding, and exchanging data between Bluetooth-enabled devices. The Bluetooth standard provides a peer-to-peer (P2P) data exchange functionality over short distance between compliant devices.
The Bluetooth API is optional for both Tizen mobile and wearable profiles, which means that it may not be supported in all mobile and wearable devices. The Bluetooth API is not supported on any Tizen Emulators.
The main features of the Bluetooth API include:
- Managing the local Bluetooth adapter
You can manage the local Bluetooth adapter using the system-provided service through the ApplicationControl interface (in mobile and wearable applications).
To use the Bluetooth functionality of the device, you must switch the Bluetooth adapter on.
- Discovering devices
You can discover other Bluetooth devices.
The device discovery process can retrieve multiple types of Bluetooth devices, such as printers, mobile phones, and headphones. To find the kind of devices you want to communicate with, the BluetoothClass interface (in mobile and wearable applications) is used to define characteristics and capabilities of a Bluetooth device. The BluetoothClassDeviceMajor interface (in mobile and wearable applications) and BluetoothClassDeviceMinor interface (in mobile and wearable applications) specify the identifiers for major and minor Class of Device (CoD).
In addition, you can retrieve the known devices which were bonded or found in a prior discovery process.
- Creating a bonding with a Bluetooth device
You can create a bonding with another device retrieved through the discovery process. The bonding allows the 2 devices to establish a connection.
- Connecting to and exchanging data with a Bluetooth device
You can connect to and exchange data with a remote Bluetooth device. When you attempt to open a connection to another device, a Service Discovery Protocol (SDP) look-up is performed on the device, and the protocol and channel to be used for the connection are determined. If a connection is established and the socket is opened successfully, a BluetoothSocket instance (in mobile and wearable applications) with an open state is returned. The socket is subsequently used for exchanging data between the connected devices.
If a device allows other devices to use its functionalities through this kind of connection, it is said to provide a service.
- Communicating with a health source device
The Health Device Profile defines the requirements for the Bluetooth health device implementation. In the profile, there are 2 device type: one device is a source, such as a blood pressure monitor or pulse oximeter, while the other is a sink, such as a mobile phone or laptop. You can use your device as a sink and communicate with a health source device.
The main Bluetooth (4.0) Low Energy features include:
- Managing the local Bluetooth adapter
The Bluetooth adapter management is performed the same way as in the regular Bluetooth API.
- Discovering Bluetooth Low Energy devices
You can discover Bluetooth Low Energy devices in range. Through the discovery process, you can obtain basic information about available remote devices, such as their names and provided services.
- Managing the advertising options
You can manage advertising to control how your device announces itself to other Bluetooth Low Energy devices to be discovered.
- Connecting to a Bluetooth Low Energy device
You can connect to a remote Bluetooth Low Energy device. When connected, you can access services and characteristics of the remote device.
- Receiving notifications on connection state changes
You can monitor the connection state to detect when the connection to the remote device is lost.
- Retrieving Bluetooth GATT services
You can retrieve information about Bluetooth GATT services provided by the remote device.
Every GATT service defines characteristics it includes. By knowing the service, you know what features the Bluetooth device exposes.
- Accessing the Bluetooth GATT characteristic value
You can read and write the Bluetooth GATT characteristic value.
Characteristics allows you to monitor and sometimes control remote Bluetooth Low Energy devices. For example, a sensor reading can be exposed by the sensor device as a Bluetooth GATT characteristic.
- Receiving notifications on characteristic value changes
You can monitor a characteristic value to detect any changes, for example, in sensor readings and battery level.
- Accessing the Bluetooth GATT descriptor value