I am trying to use the BlueZ stack on a Linux machine to create a GATT server with custom services and characteristics. The final goal is to use any central device (e.g. iOS or Android device) to connect to the GATT server, discover the services and characteristics, and manipulate the data in the characteristics.
Example:
From the central device, I should see the the peripheral device, connect to it and discover one service (0xFFFF) which has three characteristics (0xAAAA, 0xBBBB, 0xCCCC). I should then be able to read the value of 0xAAAA, read and write to the value of 0xBBBB, and enable notifications on 0xCCCC.
Please note that I am aware that a similar question exists, but it only explains how to use the peripheral as an advertiser. Another solved question explains how to create a GATT server, but does not explain how to play with the properties of the characteristics (e.g. readable, notifiable, etc.), or maybe I'm missing something.
Thank you in advance.
A BLE profile serves as an application layer for specific and already defined use cases. Generally speaking, a BLE profile is a standard collection of services for a specific use case.
Bluetooth Low Energy is a power-conserving variant of Bluetooth personal area network (PAN) technology, designed for use by Internet-connected machines and appliances. Also marketed as Bluetooth Smart, Bluetooth LE was introduced in the Bluetooth 4.0 specification as an alternative to Bluetooth Classic.
What is BlueZ? BlueZ is the Bluetooth stack for Linux. It handles both Bluetooth BR/EDR as well as BLE.
Another solution now exists with Bluetoothctl command line tool. More details of this can be found here:-
BlueZ: How to set up a GATT server from the command line
I'm not sure when Bluetoothctl was introduced, but it's relatively recent at the time of this writing and therefore it didn't exist in previous versions of BlueZ. I'm using BlueZ v5.50 and this the version that I tested it with.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With