Files
bumble_fork/getting_started.html
T
2022-05-16 19:54:59 -07:00

1076 lines
26 KiB
HTML

<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="icon" href="images/favicon.ico">
<meta name="generator" content="mkdocs-1.2, mkdocs-material-7.1.7">
<title>Getting Started - Bumble</title>
<link rel="stylesheet" href="assets/stylesheets/main.ca7ac06f.min.css">
<link rel="stylesheet" href="assets/stylesheets/palette.f1a3b89f.min.css">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700%7CRoboto+Mono&display=fallback">
<style>:root{--md-text-font-family:"Roboto";--md-code-font-family:"Roboto Mono"}</style>
<link rel="stylesheet" href="assets/_mkdocstrings.css">
</head>
<body dir="ltr" data-md-color-scheme="" data-md-color-primary="none" data-md-color-accent="none">
<script>function __prefix(e){return new URL(".",location).pathname+"."+e}function __get(e,t=localStorage){return JSON.parse(t.getItem(__prefix(e)))}</script>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">
<a href="#getting-started-with-bumble" class="md-skip">
Skip to content
</a>
</div>
<div data-md-component="announce">
</div>
<header class="md-header" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="Header">
<a href="index.html" title="Bumble" class="md-header__button md-logo" aria-label="Bumble" data-md-component="logo">
<img src="images/logo.png" alt="logo">
</a>
<label class="md-header__button md-icon" for="__drawer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2z"/></svg>
</label>
<div class="md-header__title" data-md-component="header-title">
<div class="md-header__ellipsis">
<div class="md-header__topic">
<span class="md-ellipsis">
Bumble
</span>
</div>
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">
Getting Started
</span>
</div>
</div>
</div>
</nav>
</header>
<div class="md-container" data-md-component="container">
<main class="md-main" data-md-component="main">
<div class="md-main__inner md-grid">
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href="index.html" title="Bumble" class="md-nav__button md-logo" aria-label="Bumble" data-md-component="logo">
<img src="images/logo.png" alt="logo">
</a>
Bumble
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="index.html" class="md-nav__link">
Introduction
</a>
</li>
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc">
<a href="getting_started.html" class="md-nav__link md-nav__link--active">
Getting Started
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_3" type="checkbox" id="__nav_3" >
<label class="md-nav__link" for="__nav_3">
Use Cases
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Use Cases" data-md-level="1">
<label class="md-nav__title" for="__nav_3">
<span class="md-nav__icon md-icon"></span>
Use Cases
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="use_cases/index.html" class="md-nav__link">
Overview
</a>
</li>
<li class="md-nav__item">
<a href="use_cases/use_case_1.html" class="md-nav__link">
Use Case 1
</a>
</li>
<li class="md-nav__item">
<a href="use_cases/use_case_2.html" class="md-nav__link">
Use Case 2
</a>
</li>
<li class="md-nav__item">
<a href="use_cases/use_case_3.html" class="md-nav__link">
Use Case 3
</a>
</li>
<li class="md-nav__item">
<a href="use_cases/use_case_4.html" class="md-nav__link">
Use Case 4
</a>
</li>
<li class="md-nav__item">
<a href="use_cases/use_case_5.html" class="md-nav__link">
Use Case 5
</a>
</li>
<li class="md-nav__item">
<a href="use_cases/use_case_6.html" class="md-nav__link">
Use Case 6
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_4" type="checkbox" id="__nav_4" >
<label class="md-nav__link" for="__nav_4">
Components
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Components" data-md-level="1">
<label class="md-nav__title" for="__nav_4">
<span class="md-nav__icon md-icon"></span>
Components
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="components/controller.html" class="md-nav__link">
Controller
</a>
</li>
<li class="md-nav__item">
<a href="components/host.html" class="md-nav__link">
Host
</a>
</li>
<li class="md-nav__item">
<a href="components/gatt.html" class="md-nav__link">
GATT
</a>
</li>
<li class="md-nav__item">
<a href="components/security_manager.html" class="md-nav__link">
Security Manager
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_5" type="checkbox" id="__nav_5" >
<label class="md-nav__link" for="__nav_5">
Transports
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Transports" data-md-level="1">
<label class="md-nav__title" for="__nav_5">
<span class="md-nav__icon md-icon"></span>
Transports
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="transports/index.html" class="md-nav__link">
Overview
</a>
</li>
<li class="md-nav__item">
<a href="transports/serial.html" class="md-nav__link">
Serial
</a>
</li>
<li class="md-nav__item">
<a href="transports/usb.html" class="md-nav__link">
USB
</a>
</li>
<li class="md-nav__item">
<a href="transports/pty.html" class="md-nav__link">
PTY
</a>
</li>
<li class="md-nav__item">
<a href="transports/udp.html" class="md-nav__link">
UDP
</a>
</li>
<li class="md-nav__item">
<a href="transports/tcp_client.html" class="md-nav__link">
TCP Client
</a>
</li>
<li class="md-nav__item">
<a href="transports/tcp_server.html" class="md-nav__link">
TCP Server
</a>
</li>
<li class="md-nav__item">
<a href="transports/ws_client.html" class="md-nav__link">
WebSocket Client
</a>
</li>
<li class="md-nav__item">
<a href="transports/ws_server.html" class="md-nav__link">
WebSocket Server
</a>
</li>
<li class="md-nav__item">
<a href="transports/vhci.html" class="md-nav__link">
VHCI
</a>
</li>
<li class="md-nav__item">
<a href="transports/hci_socket.html" class="md-nav__link">
HCI Socket
</a>
</li>
<li class="md-nav__item">
<a href="transports/android_emulator.html" class="md-nav__link">
Android Emulator
</a>
</li>
<li class="md-nav__item">
<a href="transports/file.html" class="md-nav__link">
File
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_6" type="checkbox" id="__nav_6" >
<label class="md-nav__link" for="__nav_6">
API
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="API" data-md-level="1">
<label class="md-nav__title" for="__nav_6">
<span class="md-nav__icon md-icon"></span>
API
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="api/guide.html" class="md-nav__link">
Guide
</a>
</li>
<li class="md-nav__item">
<a href="api/examples.html" class="md-nav__link">
Examples
</a>
</li>
<li class="md-nav__item">
<a href="api/reference.html" class="md-nav__link">
Reference
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_7" type="checkbox" id="__nav_7" >
<label class="md-nav__link" for="__nav_7">
Apps & Tools
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Apps & Tools" data-md-level="1">
<label class="md-nav__title" for="__nav_7">
<span class="md-nav__icon md-icon"></span>
Apps & Tools
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="apps_and_tools/index.html" class="md-nav__link">
Overview
</a>
</li>
<li class="md-nav__item">
<a href="apps_and_tools/console.html" class="md-nav__link">
Console
</a>
</li>
<li class="md-nav__item">
<a href="apps_and_tools/link_relay.html" class="md-nav__link">
Link Relay
</a>
</li>
<li class="md-nav__item">
<a href="apps_and_tools/hci_bridge.html" class="md-nav__link">
HCI Bridge
</a>
</li>
<li class="md-nav__item">
<a href="apps_and_tools/gg_bridge.html" class="md-nav__link">
Golden Gate Bridge
</a>
</li>
<li class="md-nav__item">
<a href="apps_and_tools/show.html" class="md-nav__link">
Show
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_8" type="checkbox" id="__nav_8" >
<label class="md-nav__link" for="__nav_8">
Hardware
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Hardware" data-md-level="1">
<label class="md-nav__title" for="__nav_8">
<span class="md-nav__icon md-icon"></span>
Hardware
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="hardware/index.html" class="md-nav__link">
Overview
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_9" type="checkbox" id="__nav_9" >
<label class="md-nav__link" for="__nav_9">
Platforms
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Platforms" data-md-level="1">
<label class="md-nav__title" for="__nav_9">
<span class="md-nav__icon md-icon"></span>
Platforms
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="platforms/index.html" class="md-nav__link">
Overview
</a>
</li>
<li class="md-nav__item">
<a href="platforms/macos.html" class="md-nav__link">
macOS
</a>
</li>
<li class="md-nav__item">
<a href="platforms/linux.html" class="md-nav__link">
Linux
</a>
</li>
<li class="md-nav__item">
<a href="platforms/windows.html" class="md-nav__link">
Windows
</a>
</li>
<li class="md-nav__item">
<a href="platforms/android.html" class="md-nav__link">
Android
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_10" type="checkbox" id="__nav_10" >
<label class="md-nav__link" for="__nav_10">
Examples
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Examples" data-md-level="1">
<label class="md-nav__title" for="__nav_10">
<span class="md-nav__icon md-icon"></span>
Examples
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="examples/index.html" class="md-nav__link">
Overview
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
</nav>
</div>
</div>
</div>
<div class="md-content" data-md-component="content">
<article class="md-content__inner md-typeset">
<h1 id="getting-started-with-bumble">GETTING STARTED WITH BUMBLE<a class="headerlink" href="#getting-started-with-bumble" title="Permanent link">&para;</a></h1>
<h1 id="prerequisites">Prerequisites<a class="headerlink" href="#prerequisites" title="Permanent link">&para;</a></h1>
<p>You need Python 3.8 or above. Python &gt;= 3.9 is recommended, but 3.8 should be sufficient if
necessary (there may be some optional functionality that will not work on some platforms with
python 3.8).<br />
Visit the <a href="https://www.python.org/">Python site</a> for instructions on how to install Python
for your platform.<br />
Throughout the documentation, when shell commands are shown, it is assumed that you can
invoke Python as
<div class="highlight"><pre><span></span><code>$ python
</code></pre></div>
If invoking python is different on your platform (it may be <code>python3</code> for example, or just <code>py</code> or <code>py.exe</code>),
adjust accordingly.</p>
<p>You may be simply using Bumble as a module for your own application or as a dependency to your own
module, or you may be working on modifying or contributing to the Bumble module or example code
itself.</p>
<h1 id="working-with-bumble-as-a-module">Working With Bumble As A Module<a class="headerlink" href="#working-with-bumble-as-a-module" title="Permanent link">&para;</a></h1>
<h2 id="installing">Installing<a class="headerlink" href="#installing" title="Permanent link">&para;</a></h2>
<p>You may choose to install the Bumble module from an online package repository, with a package
manager, or from source.</p>
<div class="admonition tip">
<p class="admonition-title">Python Virtual Environments</p>
<p>When you install Bumble, you have the option to install it as part of your default
python environment, or in a virtual environment, such as a <code>venv</code>, <code>pyenv</code> or <code>conda</code> environment</p>
</div>
<h3 id="venv">venv<a class="headerlink" href="#venv" title="Permanent link">&para;</a></h3>
<p><code>venv</code> is a standard module that is included with python.
Visit the <a href="https://docs.python.org/3/library/venv.html"><code>venv</code> documentation</a> page for details.</p>
<h3 id="pyenv">Pyenv<a class="headerlink" href="#pyenv" title="Permanent link">&para;</a></h3>
<p><code>pyenv</code> lets you easily switch between multiple versions of Python. It's simple, unobtrusive, and follows the UNIX tradition of single-purpose tools that do one thing well.<br />
Visit the <a href="https://github.com/pyenv/pyenv"><code>pyenv</code> site</a> for instructions on how to install
and use <code>pyenv</code></p>
<h3 id="conda">Conda<a class="headerlink" href="#conda" title="Permanent link">&para;</a></h3>
<p>Conda is a convenient package manager and virtual environment.
The file <code>environment.yml</code> is a Conda environment file that you can use to create
a new Conda environment. Once created, you can simply activate this environment when
working with Bumble.<br />
Visit the <a href="https://docs.conda.io/en/latest/">Conda side</a> for instructions on how to install
and use Conda.
A few useful commands: </p>
<h4 id="create-a-new-bumble-conda-environment">Create a new <code>bumble</code> Conda environment<a class="headerlink" href="#create-a-new-bumble-conda-environment" title="Permanent link">&para;</a></h4>
<p><div class="highlight"><pre><span></span><code>$ conda env create -f environment.yml
</code></pre></div>
This will create a new environment, named <code>bumble</code>, which you can then activate with:
<div class="highlight"><pre><span></span><code>$ conda activate bumble
</code></pre></div></p>
<h4 id="update-an-existing-bumble-environment">Update an existing <code>bumble</code> environment<a class="headerlink" href="#update-an-existing-bumble-environment" title="Permanent link">&para;</a></h4>
<div class="highlight"><pre><span></span><code>$ conda env update -f environment.yml
</code></pre></div>
<h3 id="install-from-source">Install From Source<a class="headerlink" href="#install-from-source" title="Permanent link">&para;</a></h3>
<p>The instructions for working with virtual Python environments above also apply in this case.</p>
<p>Install with <code>pip</code>
<div class="highlight"><pre><span></span><code>$ python -m pip install -e .
</code></pre></div></p>
<h1 id="working-on-the-bumble-code">Working On The Bumble Code<a class="headerlink" href="#working-on-the-bumble-code" title="Permanent link">&para;</a></h1>
<p>When you work on the Bumble code itself, and run some of the tests or example apps, or import the
module in your own code, you typically either install the package from source in "development mode" as described above, or you may choose to skip the install phase. </p>
<h2 id="without-installing">Without Installing<a class="headerlink" href="#without-installing" title="Permanent link">&para;</a></h2>
<p>If you prefer not to install the package (even in development mode), you can load the module directly from its location in the project.
A simple way to do that is to set your <code>PYTHONPATH</code> to
point to the root project directory, where the <code>bumble</code> subdirectory is located. You may set
<code>PYTHONPATH</code> globally, or locally with each command line execution (on Unix-like systems).</p>
<p>Example with a global <code>PYTHONPATH</code>, from a unix shell, when the working directory is the root
directory of the project.</p>
<div class="highlight"><pre><span></span><code>$ <span class="nb">export</span> <span class="nv">PYTHONPATH</span><span class="o">=</span>.
$ python apps/console.py serial:/dev/tty.usbmodem0006839912171
</code></pre></div>
<p>or running an example, with the working directory set to the <code>examples</code> subdirectory
<div class="highlight"><pre><span></span><code>$ <span class="nb">cd</span> examples
$ <span class="nb">export</span> <span class="nv">PYTHONPATH</span><span class="o">=</span>..
$ python run_scanner.py usb:0
</code></pre></div></p>
<p>Or course, <code>export PYTHONPATH</code> only needs to be invoked once, not before each app/script execution.</p>
<p>Setting <code>PYTHONPATH</code> locally with each command would look something like:
<div class="highlight"><pre><span></span><code>$ PYTHONPATH=. python examples/run_advertiser.py examples/device1.json serial:/dev/tty.usbmodem0006839912171
</code></pre></div></p>
</article>
</div>
</div>
</main>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid">
<a href="index.html" title="Introduction" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
</div>
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span class="md-footer-nav__direction">
Previous
</span>
Introduction
</span>
</div>
</a>
<a href="use_cases/index.html" title="Overview" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span class="md-footer-nav__direction">
Next
</span>
Overview
</span>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
</div>
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
<div class="md-footer-copyright__highlight">
Copyright 2021-2022 Google LLC
</div>
</div>
</div>
</div>
</footer>
</div>
<div class="md-dialog" data-md-component="dialog">
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"base": ".", "features": [], "translations": {"clipboard.copy": "Copy to clipboard", "clipboard.copied": "Copied to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.placeholder": "Search", "search.result.placeholder": "Type to start searching", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.term.missing": "Missing", "select.version.title": "Select version"}, "search": "assets/javascripts/workers/search.b0710199.min.js", "version": null}</script>
<script src="assets/javascripts/bundle.76f349be.min.js"></script>
</body>
</html>