Hi Olivier,

Have you seen the sample applications on the developer site?

https://developer.android.com/samples/BluetoothLeGatt/index.html
https://developer.android.com/samples/BluetoothAdvertisements/index.html

I think the functionality you are looking for is exposed in the Java APIs.  You shouldn't need to send HCI commands directly or implement any low-level GATT code.

Thanks,
Myles

On Wed, Mar 8, 2017 at 2:33 AM, Olivier MARTIN <olivier@labapart.com> wrote:
Hi all,
for one of my projects I need my Android device to act as a Bluetooth LE peripheral device. I noticed this feature has been added in Android 5.0 (https://developer.android.com/about/versions/android-5.0.html). Unfortunately my Nexus 4 is unlikely to get this feature (https://altbeacon.github.io/android-beacon-library/beacon-transmitter-devices.html). But I also have a 96Board Hikey board that has become an official platform in AOSP.

Is there a plan to support Bluetooth LE peripheral role to Hikey? If yes, any idea of the ETA?
I would not necessary excited to do it but if there is no plan I would add the support myself. I am familiar with GATT (Bluez), JNI, Linux Kernel, Android application. I know the Hikey is capable of BLE peripheral as I already used Bluez and its DBus interface to make Hikey appears a BLE peripheral.

I am new to AOSP world. So I am a bit lost in the various components. I already read these pages:
- https://source.android.com/devices/index.html: Android Interfaces and Architecture
- https://source.android.com/devices/bluetooth.html: Bluetooth
- https://source.android.com/devices/Android-6.0-Bluetooth-HCI-Reqs.pdf: Android 6.0 Bluetooth HCI Requirements

I understand the HAL peripheral support is generally divided in module (defined by hw_module_t) and device (defined by hw_device_t).
I saw HAL interfaces are defined by libhardware and potentially the one that would interest me is `bt_gatt_server.h`.
But I am a bit unclear by the link between Android Bluetooth HCI and `bt_gatt_server.h`.
If I wanted to add GATT Server to Hikey what should I do?

Sorry if you have nothing to do with this issue. I collected emails around repositories and web resources. I am not sure who is the best person to answer this question.

Thanks in advance,
Olivier