2017-01-20 09:42:36 +08:00
|
|
|
.. _bluetooth_setup:
|
|
|
|
|
|
|
|
Bluetooth
|
|
|
|
##########
|
|
|
|
|
2017-11-09 13:25:12 +08:00
|
|
|
To build any of the Bluetooth samples, follow the same steps as building
|
|
|
|
any other Zephyr application. Refer to the
|
|
|
|
:ref:`Getting Started Guide <getting_started>` for more information.
|
|
|
|
|
|
|
|
When building for qemu (e.g. BOARD=qemu_x86 or BOARD=qemu_cortex_m3),
|
|
|
|
the setup assumes that the host's Bluetooth controller is connected to
|
|
|
|
the second QEMU serial line through a Unix socket (QEMU option -serial
|
|
|
|
unix:/tmp/bt-server-bredr). This option is automatically added to the
|
|
|
|
qemu command line whenever building for a qemu target and Bluetooth
|
|
|
|
support has been enabled.
|
2017-01-20 09:42:36 +08:00
|
|
|
|
|
|
|
On the host side BlueZ allows to "connect" Bluetooth controller through a
|
|
|
|
so-called user channel. Use the btproxy tool for that:
|
|
|
|
|
|
|
|
Note that before calling ``btproxy`` make sure that Bluetooth controller is
|
|
|
|
down.
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ sudo tools/btproxy -u
|
|
|
|
Listening on /tmp/bt-server-bredr
|
|
|
|
|
2017-06-13 05:30:03 +08:00
|
|
|
Running the application in QEMU will connect the second serial line to
|
2017-08-09 14:21:11 +08:00
|
|
|
``bt-server-bredr`` Unix socket. When Bluetooth (CONFIG_BT) and Bluetooth
|
|
|
|
HCI UART driver (CONFIG_BT_H4) are enabled, the Bluetooth driver
|
2017-01-20 09:42:36 +08:00
|
|
|
registers with the system.
|
|
|
|
|
|
|
|
From now on Bluetooth may be used by the application. To run applications in
|
2017-06-13 05:30:03 +08:00
|
|
|
the QEMU emulation environment, type:
|
2017-01-20 09:42:36 +08:00
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ make run
|
|
|
|
|
|
|
|
.. toctree::
|
|
|
|
:maxdepth: 1
|
|
|
|
:glob:
|
|
|
|
|
|
|
|
**/*
|