bluez/android
Andrei Emeltchenko 33323282cd android/daemon: Add handler for device disconnected
Send event to callback thread which shall call acl state change callback.
2013-11-01 16:39:07 +02:00
..
client android: Fix up the GATT client to handle KitKat API changes 2013-11-01 06:25:30 -07: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
adapter.c android/daemon: Add handler for device disconnected 2013-11-01 16:39:07 +02:00
adapter.h android: Remove not needed adapter parameter from bt_adapter_ready 2013-10-24 18:31:41 +03:00
Android.mk android/hid: Fetch record before attempting to connect 2013-11-01 11:13:07 +02:00
device.c android: Add adapter and device struct for BlueZ daemon 2013-10-16 18:35:11 +03:00
device.h android: Add adapter and device struct for BlueZ daemon 2013-10-16 18:35:11 +03:00
hal-av.c android/hal-av: Fix command struct names 2013-10-28 12:58:56 +02:00
hal-bluetooth.c android/hal: Add debug prints for every HAL callback 2013-11-01 16:39:07 +02:00
hal-hidhost.c android/hal-hidhost: Add implemention of .hid_info_cb 2013-11-01 15:23:26 +02:00
hal-ipc-api.txt android/hal-hidhost: Add implementation of .connection_state_cb 2013-10-31 15:00:10 +02:00
hal-ipc.c android/hal-hidhost: Add implementation of .connection_state_cb 2013-10-31 15:00:10 +02:00
hal-ipc.h android: Make hal_ipc_command return directly the status 2013-10-22 17:18:02 +03:00
hal-log.h android: Add wrapper for HAL logging 2013-10-20 22:37:59 +03:00
hal-msg.h android/ipc: Update HAL IPC header 2013-11-01 16:39:07 +02:00
hal-pan.c android/hal-pan: Add implementation of .disconnect 2013-10-28 14:43:24 +02:00
hal-sock.c android/hal: Add initial socket implementation 2013-10-31 10:29:40 +02:00
hal.h android/hal-hidhost: Add implementation of .connection_state_cb 2013-10-31 15:00:10 +02:00
hid.c android/hid: Add handling of HAL_EV_HID_INFO 2013-11-01 15:23:26 +02:00
hid.h android: Add support for registering and unregistering hid service 2013-10-23 14:26:40 +03:00
ipc.c android: Rename ipc_send_error to ipc_send_rsp 2013-10-25 15:22:24 +03:00
ipc.h android: Rename ipc_send_error to ipc_send_rsp 2013-10-25 15:22:24 +03:00
main.c android: Switch controller off when shutting the daemon down 2013-10-31 12:42:22 -07:00
Makefile.am android/hid: Fetch record before attempting to connect 2013-11-01 11:13:07 +02:00
README android: Add README file with instructions 2013-10-30 11:15:21 +02:00
socket.c android: Initial implementation of socket interface 2013-10-31 10:30:00 +02:00
socket.h android: Initial implementation of socket interface 2013-10-31 10:30:00 +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.