When multiple data measurements are made between Bluetooth devices, characteristics are used to distinguish and accurately make sense of that data. Characteristics are defined as a component of a particular service or data type. For example, if a temperature sensor makes multiple measurements, each measurement is transmitted under a different characteristic. Each characteristic represents a specific type of data; for example, one characteristic may contain temperature data, while another may contain humidity data. Thanks to this structure, the receiving device can easily recognize which characteristic represents which type of data and accurately distinguish between them. When sharing data between devices measuring multiple data measurements using Bluetooth technology, it is important to define characteristics to identify and distinguish which type of data these data are. In this chapter, you will learn how to define and use Bluetooth characteristics.
GATT stands for Generic Attribute Profile, a core component of Bluetooth Low Energy (BLE) technology. GATT is a standard protocol that governs how BLE devices exchange and communicate data. It determines how BLE devices share and control data and what data is shared. On the pop-up screen, there are Name, Characteristic ID, Service ID, and Characteristic Type fields describing the main components of GATT.
2. From the pop-up, configure the settings in your application's method.
For example, a temperature measurement characteristic represents temperature data and can allow the central device to read this data. A characteristic is a value that indicates the type or nature of the data it carries. This means that the data is temperature, humidity, pressure or some other type of measurement. The characteristic type usually corresponds to the types defined in a specific Bluetooth profile or manual. For example, Temperature Measurement.
3. Once the required fields are filled in, click on the “SAVE” button to create the method.
4. Select the method so that the created method can be interpreted by the Kuika platform.
5. Click on “+ADD ACTION” from the Properties panel on the right side. For example, click “+ADD ACTION >Sub Array” to convert the first two values read from a device to Byte (divide by 128) and convert them to temperature value. Click on the Symbol Picker in the Sub Array.
6. In the “Count” field, enter the value “2” since the first two values are requested.
7. Click on “+ADD ACTION>Arithmetic>Divide” for byte conversion.
8. Click the Symbol Picker in Value in Divide and select “Action Results>Sub Array” to call the value from Sub Array. Then type “128” in the value2 field.
9. Then click the “UPDATE” button in the right corner.
Method Input allows you to define all the inputs required for a method interacting with Bluetooth to work successfully. You can use the “ADD METHOD INPUT” drop-down menu in the Properties panel to define the inputs for the method used when receiving data from a Bluetooth device or when the device is sending data.
To add a new Method Input: