BLE Device Service
The BLE Device Service provides a means of integrating Bluetooth Low Energy (BLE) devices with Edge Xpert. For more information on the protocol, refer to the Bluetooth website.
Breaking Change in Edge Xpert v2.2
- The attribute value
startByte
has changed from string to integer - The attribute values for
isNotification
andisAdvertisement
have changed from strings to booleans
Key Features
The BLE Device Service supports the following key features:
-
Generic Attribute Profile (GATT): Supports GATT devices which allows Edge Xpert to read data from and issue commands to them
-
Read and Write BLE Generic Attribute Profile (GATT) characteristics
-
Notifications for change of value in BLE characteristics
GATT Characteristics
Some of GATT characteristics are vendor-specific and do not comply with the BLE GATT standard data types. Some of these devices return data in a final readable format, such as an Integer or a Float. However, some do not and the data must be converted to a readable format that can be used with Edge Xpert. To address this, a conversion function can be created. For further information about converting GATT characteristics, see Convert Vendor-specific Data.
Prerequisites
The Edge Xpert BLE Device Service uses BlueZ, the official Linux Bluetooth protocol stack. BlueZ is an open-source project and is distributed under GNU Public License (GPL). It has been part of the official Linux kernel since version 2.4.6. The BlueZ Linux module must be installed on the host to support connections between the device service and BLE devices using D-Bus.
Edge Xpert uses the D-Bus protocol to communicate with BlueZ to read and write data with BLE GATT devices. D-Bus is an Inter-Process Communication (IPC) and Remote Procedure Classing (RPC) mechanism, which was specifically designed for efficient and easy-to-use communication between processes running on the same machine. The D-Bus daemon must be running on the host with the device service to allow communication between the BLE Device Service and the BlueZ daemon.
Note
The BLE Device Service can be used with any GATT devices that are compliant with Bluetooth 5.0.
Supported Data Types
The BLE Device Service supports the following data types:
- Bool
- String
- Binary
- UInt8, UInt16, UInt32, UInt64
- Int8, Int16, Int32, Int64
- Float32, Float64
BLE Device Profile
The device profile defines what resources are available on a particular device. You can define the following profile attributes in the YAML file:
Attribute | Type | Required | Description |
---|---|---|---|
characteristicUuid |
String | No, required for data and configuration resources | The UUID of the characteristic. The UUID format is separated by dashes as illustrated: characteristicUuid: "f000aa72-0451-4000-b000-000000000000"For further information on the characteristic UUID, see theBluetooth device specification |
isAdvertisement |
Bool | No | Indicates that the resource is an advertisement packet |
isNotification |
Bool | No | Indicates that the resource controls a notification, as below:
isNotification: true, |
deviceResource |
String | No, required if using `isNotification` | References the existing device resource for which notifications are to be enabled or disabled |
serviceUuid |
String | No | The Universally Unique Identifier (UUID) of the service. The UUID format is separated by dashes as illustrated below: serviceUuid: "f000aa70-0451-4000-b000-000000000000" |
startByte |
Uint32 | No | Specifies the byte from which to cast the rawType when converting vendor-specific data |
conversionFunction |
String | No | Defines the conversion function to use |
rawType |
String | No, required if using `conversionFunction` | Defines the binary data read from the BLE device and uses a value descriptor data type to identify the data type that the user wants to receive |
BLE Protocol Properties
Protocol Property | Description | Valid Values |
---|---|---|
MAC Address | MAC Address of the device | 00:00:00:00:00 Replace 00s with your own device-specific MAC address |
Using the BLE Device Service
An example of setting up and using devices with the Edge Xpert BLE Device Service can be found at BLE Example.