bluez/android
Szymon Janc 8fd569476b android/hal-pan: Use generic IPC message handling for events
Register handlers on service init and unregister on cleanup.
2013-11-19 16:42:02 +02:00
..
client android/debug: Move debug functions to hal-utils.c 2013-11-14 10:27:15 +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: Use sdp_data_free for freeing sdp data types 2013-11-19 12: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
bluetooth.c android: Improve IPC helper to not send invalid status response 2013-11-18 15:17:22 +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: Add implemention of .cleanup 2013-11-14 14:19:02 +02:00
hal-bluetooth.c android/hal-bluetooth: Register IPC message handlers 2013-11-19 16:42:01 +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: Add initial code for IPC message handlers 2013-11-19 16:42:01 +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: Use generic IPC message handling for events 2013-11-19 16:42:02 +02:00
hal-sock.c android/hal-sock: Print bdaddr string instead of pointer 2013-11-19 16:06:13 +02:00
hal-utils.c android/debug: Move debug functions to hal-utils.c 2013-11-14 10:27: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-pan: Use generic IPC message handling for events 2013-11-19 16:42:02 +02:00
hidhost.c android: Improve IPC helper to not send invalid status response 2013-11-18 15:17:22 +02:00
hidhost.h android: Rename hid.c to hidhost.c 2013-11-07 18:44:57 +02:00
ipc.c android: Improve IPC helper to not send invalid status response 2013-11-18 15:17:22 +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/build: Remove unnecessary mentions of source files in EXTRA_DIST 2013-11-14 15:57:27 +02:00
pan.c android/pan: Fix wrong struct parameter in disconnect function call 2013-11-19 15:23:20 +02:00
pan.h android: Pass notification socket fd to service handlers 2013-11-07 17:05:47 +02:00
README android: Add README file with instructions 2013-10-30 11:15:21 +02:00
socket.c android: Improve IPC helper to not send invalid status response 2013-11-18 15:17:22 +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.