Links

Bluetooth Connection

Bluetooth integration refers to the process of enabling communication with other devices through wireless communication technology. Bluetooth is a widely used communication protocol for wireless data transfer, device connections, and various other functions.
For example, consider a mobile application that wants to receive weight data from a scale via a Bluetooth connection.
The application establishes a Bluetooth connection with the scale device. This process may involve selecting and pairing the device in the application or settings. The application communicates with the device using the platform's Bluetooth API or an appropriate Bluetooth SDK, providing functions for opening connections and reading and writing data. The application periodically reads weight data from the scale device over Bluetooth. The scale sends weight measurements over Bluetooth, which the application receives and processes to display in the user interface, for instance, as a number or graph. The application's Bluetooth features enable it to communicate with external devices and receive data from them.
Therefore, adding Bluetooth functionality to many application development projects can enhance the application's functionality and improve the user experience.

Steps for Bluetooth Connection in an Application

  • Then click on the + icon to create a new datasource. Select Bluetooth in the opened screen and name it, then click the Create button.
  • In the opened screen, you will find fields such as Device Name, Device ID, and Device Address.
Device Name: The name of the device as seen by the user.
The Device Name field is mandatory.
Device ID (Identifier): The unique identity of the device. Not every device has one.
Device Address: The physical Bluetooth address of the device.
For example, a Bluetooth device's address might look like 00:1A:2B:3C:4D:5E.
Entering Device ID and Device Address is not mandatory.
If multiple data measurements are taken between Bluetooth devices, characteristics are often used to distinguish and understand these data. Characteristics are used as components of a specific service or data type. For example, if a temperature sensor takes multiple measurements, each measurement is transmitted under a different characteristic.
Each characteristic represents a specific type of data. For instance, a characteristic might contain Temperature Data or Humidity Data. In this way, the receiving device can distinguish these data by recognizing which characteristic represents which type of data.
When sharing data between devices that measure multiple data, it is necessary to create specific methods to distinguish what type of data these are.
Click Add New Method to create a method.
GATT is the abbreviation for Generic Attribute Profile, a fundamental component of Bluetooth Low Energy (BLE) technology. GATT is a standard protocol that regulates data exchange and communication among BLE devices. GATT defines how BLE devices will share data, what data they will share, and how they will be controlled. The opened screen explains GATT's main components, including fields such as Name, Characteristic ID, Service ID, and Characteristic Type.

Name:

The field where the name of the created method is entered.

Characteristic ID:

A number that uniquely identifies characteristics under Bluetooth Low Energy (BLE) services. It is usually used to distinguish each characteristic.

Service ID:

GATT defines services that devices can use to represent specific functions or data types. Each service contains one or more characteristics. Service ID is a service number defining services for Bluetooth BLE devices. Each service contains one or more characteristics. The service ID is a unique number identifying a service.

Characteristic Type:

Characteristics, as units under services, represent a specific function or data. Each characteristic is identified by a UUID (Universally Unique Identifier) and may allow operations like read, write, or notify/indicate.
For example, a temperature measurement characteristic represents temperature data and may allow the central device to read this data. It is a value indicating the type or quality of data carried by a characteristic, such as temperature, humidity, pressure, or another type of measurement. The characteristic type usually corresponds to types defined in a specific Bluetooth profile or guide, like Temperature Measurement.
After filling out the required fields, click the Save button to create the method.
For the created Method to be interpreted by the platform, actions must be created by clicking on +Add Action in the Properties panel. For example, to convert the first two values read from a device into temperature values (by dividing by 128), click +Add Action → Sub Array. Click on the Symbol Picker inside the Sub Array.
Choose Bluetooth value for the read value.
Enter 2 in the Count field since the first two values are required.
For Byte conversion, click +Add Action → Arithmetic → Divide.
In the value field of Divide, click the symbol picker and select Action Results → Sub Array.
Then, enter 128 in the value2 field.
Finally, click the Create button.
Last modified 2mo ago