• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

README.mdD25-Apr-20254 KiB8560

a2dp_sink1.jsonD25-Apr-2025133 76

asha_sink.htmlD25-Apr-20252.9 KiB9581

asha_sink1.jsonD25-Apr-2025133 66

asha_sink2.jsonD25-Apr-2025134 66

async_runner.pyD25-Apr-20252.6 KiB8844

avrcp_as_sink.htmlD25-Apr-20259.4 KiB274253

battery_client.pyD25-Apr-20252.8 KiB7743

battery_server.pyD25-Apr-20252.7 KiB7945

classic1.jsonD25-Apr-202589 65

classic2.jsonD25-Apr-202554 54

device1.jsonD25-Apr-2025174 87

device2.jsonD25-Apr-2025263 98

device3.jsonD25-Apr-202562 54

device_information_client.pyD25-Apr-20254.6 KiB12185

device_information_server.pyD25-Apr-20252.6 KiB7543

device_with_rpa.jsonD25-Apr-2025172 87

heart_rate_client.pyD25-Apr-20252.9 KiB8144

heart_rate_server.pyD25-Apr-20254.8 KiB13089

hfp_gateway.htmlD25-Apr-202514.6 KiB350313

hfp_gateway.jsonD25-Apr-202595 65

hfp_handsfree.htmlD25-Apr-20255.5 KiB132114

hfp_handsfree.jsonD25-Apr-2025125 76

hid_key_map.pyD25-Apr-20254.7 KiB249232

hid_keyboard.jsonD25-Apr-202599 65

hid_report_parser.pyD25-Apr-20256.1 KiB160138

keyboard.htmlD25-Apr-20252.3 KiB6256

keyboard.jsonD25-Apr-2025103 65

keyboard.pyD25-Apr-202516 KiB455364

leaudio.jsonD25-Apr-2025187 98

leaudio_with_classic.jsonD25-Apr-2025216 109

mcp_server.htmlD25-Apr-20252.8 KiB8368

run_a2dp_info.pyD25-Apr-20257.7 KiB201133

run_a2dp_sink.pyD25-Apr-20255.8 KiB174111

run_a2dp_source.pyD25-Apr-20256.8 KiB197127

run_advertiser.pyD25-Apr-20252.6 KiB7746

run_asha_sink.pyD25-Apr-20254 KiB12081

run_avrcp.pyD25-Apr-202514.8 KiB411311

run_cig_setup.pyD25-Apr-20253 KiB10165

run_classic_connect.pyD25-Apr-20254.4 KiB12282

run_classic_discoverable.pyD25-Apr-20254.1 KiB12289

run_classic_discovery.pyD25-Apr-20253 KiB8252

run_connect_and_encrypt.pyD25-Apr-20252.2 KiB6736

run_controller.pyD25-Apr-20253.5 KiB11068

run_controller_with_scanner.pyD25-Apr-20253.1 KiB8749

run_csis_servers.pyD25-Apr-20253.8 KiB10877

run_device_with_snooper.pyD25-Apr-20252 KiB5830

run_esco_connection.pyD25-Apr-20252.9 KiB8753

run_extended_advertiser.pyD25-Apr-20252.4 KiB7445

run_extended_advertiser_2.pyD25-Apr-20253.9 KiB10065

run_gatt_client.pyD25-Apr-20253.7 KiB10663

run_gatt_client_and_server.pyD25-Apr-20254.2 KiB12480

run_gatt_server.pyD25-Apr-20255.4 KiB157106

run_hap_server.pyD25-Apr-20253.5 KiB10874

run_hfp_gateway.pyD25-Apr-202510 KiB288211

run_hfp_handsfree.pyD25-Apr-20256.6 KiB177123

run_hid_device.pyD25-Apr-202528.1 KiB749641

run_hid_host.pyD25-Apr-202521.8 KiB569428

run_mcp_client.pyD25-Apr-20257.1 KiB195151

run_notifier.pyD25-Apr-20255 KiB13385

run_rfcomm_client.pyD25-Apr-20259.4 KiB240171

run_rfcomm_server.pyD25-Apr-20255.3 KiB16499

run_scanner.pyD25-Apr-20253.1 KiB8454

run_unicast_server.pyD25-Apr-20257.4 KiB204161

run_vcp_renderer.pyD25-Apr-20257 KiB193149

speaker.jsonD25-Apr-202597 65

vcp_renderer.htmlD25-Apr-20253.8 KiB10388

README.md

1Bumble Examples
2===============
3
4NOTE:
5To run python scripts from this directory when the Bumble package isn't installed in your environment,
6put .. in your PYTHONPATH: `export PYTHONPATH=..`
7
8# `run_controller.py`
9Run two virtual controllers, one connected to a soft device written in python with a simple GATT server, and the other connected to an external host.
10
11## Running `run_controller.py` with a BlueZ host running on Linux.
12
13In this configuration, a BlueZ stack running on a Linux host is connected to a Bumble virtual
14controller, attached to a local link bus to a second, in-process, virtual controller, itself
15used by a virtual device with a GATT server.
16
17### Running with two separate hosts (ex: a mac laptop and a Linux VM)
18In this setup, the virtual controllers and host run on a mac desktop, and the BlueZ stack on a Linux VM. A UDP socket communicates HCI packets between the macOS host and the Linux guest.
19
20#### Linux setup
21In a terminal, run `socat` to bridge a UDP socket to a local PTY.
22The PTY is used a virtual HCI UART.
23(in this example, the mac's IP address seen from the Linux VM is `172.16.104.1`, replace it with
24the appropriate address for your environment. (you may also use a port number other than `22333` used here)
25```
26socat -d -d -x PTY,link=./hci_pty,rawer UDP-SENDTO:172.16.104.1:22333,bind=:22333
27```
28
29In the local directory, `socat` creates a symbolic link named `hci_pty` that points to the PTY.
30
31In a second terminal, run
32```
33sudo btattach -P h4 -B hci_pty
34```
35
36This tells BlueZ to use the PTY as an HCI UART controller.
37
38(optional) In a third terminal, run `sudo btmon`. This monitors the HCI traffic with BlueZ, which is great to see what's going on.
39
40In a fourth terminal, run `sudo bluetoothctl` to interact with BlueZ as a client. From there, you can scan, advertise, connect, etc.
41
42#### Mac setup
43In a macOS terminal, run
44```
45python run_controller.py device1.json udp:0.0.0.0:22333,172.16.104.161:22333
46```
47
48This configures one of the virtual controllers to use a UDP socket as its HCI transport. In this example, the ip address of the Linux VM is `172.16.104.161`, replace it with the appropriate
49address for your environment.
50
51Once both the Linux and macOS processes are started, you should be able to interact with the
52`bluetoothctl` tool on the Linux side and scan/connect/discover the virtual device running on
53the macOS side. Relevant log output in each of the terminal consoles should show what it going on.
54
55### Running with a single Linux host
56In setup, both the BlueZ stack and tools as well as the Bumble virtual stack are running on the same
57host.
58
59In a terminal, run the example as
60```
61python run_controller.py device1.json pty:hci_pty
62```
63
64In the local directory, a symbolic link named `hci_pty` that points to the PTY is created.
65
66From this point, run the same steps as in the previous example to attach the PTY to BlueZ and use
67`bluetoothctl` to interact with the virtual controller.
68
69
70# `run_gatt_client.py`
71Run a host application connected to a 'real' BLE controller over a UART HCI to a dev board running Zephyr in HCI mode (could be any other UART BLE controller, or BlueZ over a virtual UART). The application connects to a Bluetooth peer specified as an argument.
72Once connected, the application hosts a GATT client that discovers all services and all attributes of the peer and displays them.
73
74# `run_gatt_server.py`
75Run a host application connected to a 'real' BLE controller over a UART HCI to a dev board running Zephyr in HCI mode (could be any other UART BLE controller, or BlueZ over a virtual UART). The application connects to a Bluetooth peer specified as an argument.
76The application hosts a simple GATT server with basic
77services and characteristics.
78
79# `run_gatt_client_and_server.py`
80
81# `run_advertiser.py`
82
83# `run_scanner.py`
84Run a host application connected to a 'real' BLE controller over a UART HCI to a dev board running Zephyr in HCI mode (could be any other UART BLE controller, or BlueZ over a virtual UART), that starts scanning and prints out the scan results.
85