Skip to content

Commit 0053587

Browse files
committed
docs: bgapi: update environment variables
After adding environment variable support, update the docs to match. Signed-off-by: Karl Palsson <[email protected]>
1 parent be2d621 commit 0053587

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

docs/backends/bgapi.rst

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,25 @@ This backend uses `pyBGAPI <https://pypi.org/project/pybgapi/>`_ to handle the p
2121

2222
Usage
2323
-----
24-
This backend cannot be automatically selected based on system type, so must be manually
25-
selected, using code such as:
24+
This backend can either be explicitly selected via the ``backend`` kwarg when creating a BleakClient,
25+
or, environment variables can be used.
26+
27+
Environment variables understood:
28+
* BLEAK_BGAPI_XAPI Must be a path to the ``sl_bt.xapi`` file.
29+
If this env var exists, the BGAPI backend will be automatically loaded
30+
* BLEAK_BGAPI_ADAPTER The serial port to use, eg ``/dev/ttyACM1``
31+
* BLEAK_BGAPI_BAUDRATE The serial baudrate to use when opening the port, if required.
32+
33+
Alternatively, these can all be provided directly as kwargs, as show below:
2634

2735
.. code-block:: python
2836
2937
async with bleak.BleakClient(
3038
"11:aa:bb:cc:22:33",
3139
backend=bleak.backends.bgapi.client.BleakClientBGAPI,
32-
bgapi="/home/karlp/SimplicityStudio/SDKs/gecko-4.2.0/protocol/bluetooth/api/sl_bt.xapi",
40+
bgapi="/home/.../SimplicityStudio/SDKs/gecko-4.2.0/protocol/bluetooth/api/sl_bt.xapi",
3341
adapter="/dev/ttyACM1",
42+
baudrate=921600,
3443
) as client:
3544
logging.info("Connected to %s", client)
3645

0 commit comments

Comments
 (0)