bluez/android
Luiz Augusto von Dentz e40bfde22e android: Add copy of current AVDTP implemention
These files are not added to any makefile on purpose because they still
have external dependencies.
2013-11-25 15:59:28 +02:00
..
client android/haltest: Zero initialize cmsg buffer 2013-11-21 16:43:40 +02:00
cutils android: Allow connect() for property_set to fail 2013-11-01 03:18:47 -07:00
hardware android: Copy the KitKat Bluetooth hardware headers 2013-11-01 06:24:55 -07:00
a2dp.c android/a2dp: Cleanup devices on unregister 2013-11-21 10:15:51 +02:00
a2dp.h android: Pass notification socket fd to service handlers 2013-11-07 17:05:47 +02:00
Android.mk android: Rename adapter.c to bluetooth.c 2013-11-14 14:57:56 +02:00
avdtp.c android: Add copy of current AVDTP implemention 2013-11-25 15:59:28 +02:00
avdtp.h android: Add copy of current AVDTP implemention 2013-11-25 15:59:28 +02:00
bluetooth.c android/bluetooth: Fix memory leak 2013-11-25 14:51:08 +02:00
bluetooth.h android: Rename bluetooth service functions to match service name 2013-11-14 14:58:16 +02:00
hal-a2dp.c android/hal-a2dp: Fix expected size of A2DP events 2013-11-20 09:40:23 +02:00
hal-bluetooth.c android/hal-bluetooth: Use static memory for enum convertion 2013-11-25 14:45:59 +02:00
hal-hidhost.c android/hal-hidhost: Use generic IPC message handling for events 2013-11-19 16:42:01 +02:00
hal-ipc-api.txt android/hidhost: Remove deprecated idle opcode from ipc document 2013-11-13 11:26:38 +02:00
hal-ipc.c android/hal: Check if command socket was shutdown by peer 2013-11-19 16:42:02 +02:00
hal-ipc.h android/hal: Add initial code for IPC message handlers 2013-11-19 16:42:01 +02:00
hal-log.h android: Add wrapper for HAL logging 2013-10-20 22:37:59 +03:00
hal-msg.h android: trivial: Add comment making code consistent 2013-11-19 11:16:11 +02:00
hal-pan.c android/hal-pan: Fix order of event handler registration 2013-11-20 09:41:38 +02:00
hal-sock.c android/hal-sock: Print bdaddr on connect 2013-11-25 15:32:14 +02:00
hal-utils.c android/hal-utils: Fix possible NULL pointer dereference 2013-11-25 15:34:15 +02:00
hal-utils.h android/debug: Move debug functions to hal-utils.c 2013-11-14 10:27:15 +02:00
hal.h android/hal-a2dp: Use generic IPC message handling for events 2013-11-19 16:42:02 +02:00
hidhost.c android/hidhost: Fix misuse of errno 2013-11-19 18:20:13 +02:00
hidhost.h android: Rename hid.c to hidhost.c 2013-11-07 18:44:57 +02:00
ipc.c android/ipc: Zero initialize cmsg buffer 2013-11-21 16:43:38 +02:00
ipc.h android: Improve IPC helper to not send invalid status response 2013-11-18 15:17:22 +02:00
main.c android: Improve IPC helper to not send invalid status response 2013-11-18 15:17:22 +02:00
Makefile.am android/pics: Add PTS PICS for DID 2013-11-25 14:47:40 +02:00
pan.c android: Handle multiple init(register) and cleanup(unregister) calls properly 2013-11-19 18:15:37 +02:00
pan.h android: Pass notification socket fd to service handlers 2013-11-07 17:05:47 +02:00
pics-did.txt android/pics: Add PTS PICS for DID 2013-11-25 14:47:40 +02:00
pics-gap.txt android/pics: Fix line lengths 2013-11-19 18:33:10 +02:00
pics-hid.txt android: Add PTS PICS for HID 2013-11-19 18:30:49 +02:00
pics-pan.txt android/pics: Add PTS PICS for PAN 2013-11-25 14:47:40 +02:00
README android: Add README file with instructions 2013-10-30 11:15:21 +02:00
socket.c android/socket: Add error printing possible close() failure 2013-11-25 15:37:17 +02:00
socket.h android/socket: Add connect signal to socket 2013-11-19 11:15:49 +02:00
system-emulator.c android: Make system-emulator start daemon only once 2013-11-01 06:07:42 -07:00
utils.h android: Add helper functions for converting bdaddr transmitted over IPC 2013-10-28 16:10:42 +02:00

BlueZ for Android
*****************

Since Android 4.2 there exists a well standardized HAL interface that the
Bluetooth stack is expected to provide and which enables the easy replacement
of the stack of choice on Android. Android BlueZ is intended as a drop-in
replacement to Android provided Bluetooth stack.

More details about BlueZ for Android architecture and components can be found
in android/hal-apc-api.txt file.

===============================
Building and running on Android
===============================

Build requirements
==================

- GLib - Android 4.2 or later don't provide GLib and one must provide it in
'external/bluetooth/glib' folder of Android tree. Sample Android GLib port
is available at https://code.google.com/p/android-bluez.glib/

- Bionic support - BlueZ requires signalfd and timerfd APIs to be provided
by libc library. Currently only 'master' branch available at
https://android.googlesource.com/platform/bionic provides all required
functionality and running BlueZ on older branch requires backporting missing
features. Sample Bionic for Android on Intel Architecture (Android-IA) with all
required features backported is available at
https://code.google.com/p/android-bluez.bionic/

Runtime requirements
====================

BlueZ HAL library requires 'bluetoothd' service to be available on Android
system. This can be done by defining service in init.rc file of targeted board:

service bluetoothd /system/bin/logwrapper /system/bin/bluetoothd
  class main
  group bluetooth net_admin
  disabled
  oneshot

It is required that bluetooth user could start and stop bluetoothd service by
setting 'ctl.start' or 'ctl.stop' property. This can be achieved by
whitelisting bluetooth user and bluetoothd service in init source code.

Required Android init system modifications can be found at
https://code.google.com/p/android-bluez.system-core/

Downloading and building
========================

Building for Android requires full Android AOSP source tree. Sample Android-IA
tree with all required components present is available at
http://code.google.com/p/android-bluez/

Downloading:
repo init -u https://code.google.com/p/android-bluez.manifest/ -m topics/bluez
repo sync

Build for Intel ultrabook:
'source build/envsetup.sh'
'lunch core_mesa-eng'
'make allimages -j8'

After full build is done it is possible to rebuild only BlueZ:
'cd external/bluetooth/bluez/android/'
'mm' (or 'mm -B' to force rebuilding of all files)
'adb sync' to update target device.

=============================
Building and running on Linux
=============================

It is possible to build and test BlueZ for Android daemon on Linux (eg. PC).
Simply follow instructions available at README file in BlueZ top directory.
Android daemon binary is located at android/bluetoothd. See next section on
how to test Android daemon on Linux.

============
Testing tool
============

BT HAL test tools located in android/haltest is provided for HAL level testing
of both Android daemon and HAL library. Start it and type 'adapter init' in
prompt to initialize HAL library. On Android required bluetoothd service will
be started automatically. On Linux it is required to start android/bluetoothd
manually before init command timeout. To deinitialize HAL library and stop
daemon type 'adapter cleanup'. Type 'help' for more information. Tab completion
is also supported.