David Warren | 5f6ca4f | 2009-04-30 17:11:58 -0700 | [diff] [blame] | 1 | page.title=Bluetooth |
| 2 | pdk.version=1.0 |
| 3 | @jd:body |
| 4 | |
| 5 | <a name="toc"/> |
| 6 | <div style="padding:10px"> |
| 7 | <a href="#androidBluetoothIntro">Introduction</a><br/> |
| 8 | <a href="#androidBluetoothPorting">Porting</a><br/><div style="padding-left:40px"> |
| 9 | |
| 10 | <a href="#androidBluetoothPortingDriver">UART Driver</a><br/> |
| 11 | <a href="#androidBluetoothPortingPowerOnOff">Bluetooth Power On / Off</a><br/></div> |
| 12 | <a href="#androidBluetoothTools">Tools</a><br/></div></font></div> |
| 13 | |
| 14 | <a name="androidBluetoothIntro"></a><h2>Introduction</h2> |
| 15 | |
| 16 | <p>Android's Bluetooth stack uses BlueZ version 3.36 for GAP, SDP, and RFCOMM profiles, and is a SIG-qualified Bluetooth 2.0 host stack.</p> |
| 17 | |
| 18 | <p>Bluez is GPL licensed, so the Android framework interacts with userspace bluez code through D-BUS IPC to avoid proprietary code.</p> |
| 19 | |
| 20 | <p>Headset and Handsfree (v1.5) profiles are implemented in the Android framework and are both tightly coupled with the Phone App. These profiles are also SIG qualified.</p> |
| 21 | |
| 22 | <p>The diagram below offers a library-oriented view of the Bluetooth stack. Click <a href="bluetooth/bluetooth_process.html">Bluetooth Process Diagram</a> for a process-oriented view.</p> |
| 23 | |
| 24 | <p><img src="images/androidBluetooth.gif"></p> |
| 25 | |
| 26 | Solid elements represent Android blocks and dashed elements represent partner-specific blocks. |
| 27 | |
| 28 | |
| 29 | |
| 30 | <a name="androidBluetoothPorting"></a><h2>Porting</h2> |
| 31 | |
| 32 | <p>BlueZ is Bluetooth 2.0 compatible and should work with any 2.0 chipset. There are two integration points:</p> |
| 33 | <p><ul> |
| 34 | <li>UART driver</li> |
| 35 | <li>Bluetooth Power On / Off</li> |
| 36 | </ul> |
| 37 | </p> |
| 38 | |
| 39 | |
| 40 | <a name="androidBluetoothPortingDriver"></a><h3>UART Driver</h3> |
| 41 | |
| 42 | <p>The BlueZ kernel sub-system attaches to your hardware-specific UART driver using the <code>hciattach</code> daemon.</p> |
| 43 | <p>For example, for MSM7201A, this is <code>drivers/serial/msm_serial.c</code>. You may also need to edit command line options to <code>hciattach</code> via <code>init.rc</code>.</p> |
| 44 | |
| 45 | |
| 46 | <a name="androidBluetoothPortingPowerOnOff"></a><h3>Bluetooth Power On / Off</h3> |
| 47 | |
| 48 | <p>The method for powering on and off your bluetooth chip varies from Android V 1.0 to post 1.0.</p> |
| 49 | |
| 50 | <p><ul> |
| 51 | <li><b>1.0</b>: Android framework writes a 0 or 1 to <code>/sys/modules/board_[PLATFORM]/parameters/bluetooth_power_on</code>.</li> |
| 52 | |
| 53 | <li><b>Post 1.0</b>: Android framework uses the linux <code>rfkill</code> API. See <code>arch/arm/mach-msm/board-trout-rfkill.c</code> for an example.</li> |
| 54 | </ul> |
| 55 | </p> |
| 56 | |
| 57 | |
| 58 | <a name="androidBluetoothTools"></a><h2>Tools</h2> |
| 59 | |
| 60 | <p>BlueZ provides a rich set of command line tools for debugging and interacting with the Bluetooth sub-system, including:</p> |
| 61 | <p><ul> |
| 62 | <li><code>hciconfig</code></li> |
| 63 | <li><code>hcitool</code></li> |
| 64 | <li><code>hcidump</code></li> |
| 65 | <li><code>sdptool</code></li> |
| 66 | <li><code>dbus-send</code></li> |
| 67 | <li><code>dbus-monitor</code></li> |
| 68 | </ul> |
| 69 | </p> |