Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
162 commits
Select commit Hold shift + click to select a range
1db05a0
Refactor BTUUID class
spacecheese Sep 4, 2022
34f3bff
Replace old BTUUID parsing
spacecheese Sep 4, 2022
4e189bf
Fix tests
spacecheese Dec 31, 2022
44bb701
Replace PEP604 union
spacecheese Dec 31, 2022
eb29e69
Fix uuid128 test
spacecheese Dec 31, 2022
5a3bb73
Fix references to BTUUID
spacecheese Dec 29, 2022
88ec102
Regenerate api docs
spacecheese Dec 31, 2022
8a0f6e7
Private internal util functions
spacecheese Dec 31, 2022
7e3ec88
Fix missing service import
spacecheese Dec 31, 2022
f981fa5
Add pipfile
spacecheese Dec 31, 2022
c52a2c8
Remove uuid16 docstring typing
spacecheese Dec 31, 2022
7b9bb85
Update docs requirements.txt
spacecheese Dec 31, 2022
68e3cb3
Fix broken test imports
spacecheese Dec 31, 2022
284f273
Update sphinx config
spacecheese Dec 31, 2022
191042e
Add imports to __init__s
spacecheese Dec 31, 2022
15787fa
Remove inventory hack
spacecheese Dec 31, 2022
e961ea2
Initial error classes
spacecheese Dec 31, 2022
48d8029
Add get_message_bus to bluez_peripheral namespace
spacecheese Jan 3, 2023
25bb23d
Add format checking workflow
spacecheese Jan 3, 2023
feb5934
README fixes
spacecheese Jan 3, 2023
79e1252
Source formatting and docstring fixes
spacecheese Jan 3, 2023
6d672cb
Add more doc makefile rules
spacecheese Jan 3, 2023
9a5562b
Re-add spelling checking to test workflow
spacecheese Jan 3, 2023
58091cd
Rewrite static docs
spacecheese Jan 3, 2023
c4fbf3b
Add __call__ to characteristic/ descriptor ref
spacecheese Jan 3, 2023
ecf428a
Rename Advertisement.__init__.packet_type
spacecheese Jan 3, 2023
87c0fb0
Remove requirements and migrate workflows
spacecheese Jan 3, 2023
0fb06cc
Add black install to test workflow
spacecheese Jan 3, 2023
7aae565
Run workflows in pipenv shell
spacecheese Jan 3, 2023
0ec9c6b
Attempt pipenv workflow fix
spacecheese Jan 3, 2023
5d149e9
Revert "Attempt pipenv workflow fix"
spacecheese Jan 3, 2023
c365f84
Revert "Run workflows in pipenv shell"
spacecheese Jan 3, 2023
576b473
Revert "Add black install to test workflow"
spacecheese Jan 3, 2023
042d744
Revert "Remove requirements and migrate workflows"
spacecheese Jan 3, 2023
755435f
Update docs requirements.txt
spacecheese Jan 3, 2023
e072135
Remove pipfile
spacecheese Jan 3, 2023
b924e77
Promote sphinx warnings
spacecheese Jan 3, 2023
0b6d506
Always run spelling and linkcheck
spacecheese Jan 3, 2023
9ff9f96
Rename link check step
spacecheese Jan 3, 2023
3e93478
Fix spelling and linkcheck tests
spacecheese Jan 3, 2023
b232677
Remove user facing TODOs
spacecheese Jan 3, 2023
2c5fa24
Fix advertising page
spacecheese Jan 3, 2023
1019d71
Shorten advertising example comments
spacecheese Jan 3, 2023
4178443
Add some advertising TODO notes
spacecheese Jan 3, 2023
ba579c1
Fix broken characteristic/ descriptor links
spacecheese Jan 3, 2023
5d00d4e
Escalate spelling warnings
spacecheese Jan 3, 2023
c801df7
Spelling corrections
spacecheese Jan 3, 2023
c1dfd73
Reword services.rst
spacecheese May 9, 2023
806fb4e
Fix characteristic assigned numbers link
spacecheese May 9, 2023
9be1a70
Create .readthedocs.yaml
spacecheese May 9, 2023
20c42ff
Make python CI versions consistent
spacecheese May 9, 2023
dd17c2c
Fix service.py formatting error
spacecheese May 9, 2023
38b06e5
Specify readthedocs config and requirements paths
spacecheese May 9, 2023
3309ae8
Fix broken links
spacecheese May 9, 2023
c5e8a43
Fix typo in README.md
spacecheese May 9, 2023
8a9df15
Merge branch 'master' into rework-docs
spacecheese May 22, 2023
28876dd
Fix some test issues
spacecheese May 22, 2023
5189a8b
Fix formatting check
spacecheese May 22, 2023
3b3146b
Fix uui16.py formatting
spacecheese May 22, 2023
727e52f
Remove UUID16 docstring types
spacecheese May 22, 2023
5cd2498
Add type hinting
spacecheese May 23, 2023
6e9c1c9
Add Interrogate docstring check
spacecheese May 23, 2023
2f80ff3
Rework /var/lib/bluetooth reference
spacecheese Jun 27, 2023
75d8f49
Update pairing.rst
spacecheese Jun 27, 2023
31cfcf5
Don't suggest deleting /var/lib/blueooth
spacecheese Jun 27, 2023
eb76b94
Refactor adapter
spacecheese Jun 23, 2025
9bb33e3
Initial test implementation
spacecheese Jun 23, 2025
d7c14ab
Implement Adapter.remove_device
spacecheese Jun 24, 2025
b824e2e
Remove Adapter.get_devices bus argument
spacecheese Jun 24, 2025
454293b
Add Device.get_name
spacecheese Jun 24, 2025
e9203b2
Fix broken module imports
spacecheese Jun 24, 2025
022ca1b
Test proof of concept updates
spacecheese Jun 24, 2025
e10b975
bluez_images integration prototype
spacecheese Aug 14, 2025
0154e35
Minor characteristics/ descriptors tidy up
spacecheese Aug 18, 2025
9f6a343
Update bluez links
spacecheese Aug 18, 2025
b306c41
Add sphinx-autobuild recipe
spacecheese Aug 18, 2025
79b7acf
Add sphinx.ext.linkcode
spacecheese Aug 18, 2025
0773390
Merge branch 'master' into rework-docs
spacecheese Aug 19, 2025
6b8ece6
Initial pylint and mypy clean pass
spacecheese Aug 20, 2025
36a2707
Fix pylint action
spacecheese Aug 20, 2025
3aba16c
Fix docstring warnings
spacecheese Aug 20, 2025
449f576
Update apidoc listings
spacecheese Aug 20, 2025
67dca15
Fix formatting
spacecheese Aug 20, 2025
6d4fc32
Fix spell checking
spacecheese Aug 22, 2025
7731b09
Fix typo is comment
spacecheese Aug 22, 2025
5e7a83b
Remove workarounds in intersphinx config
spacecheese Aug 22, 2025
7463e69
Link to current ref source
spacecheese Aug 22, 2025
1ae4999
Merge branch 'master' into rework-docs
spacecheese Aug 22, 2025
f588374
Move remaining flags to common types module
spacecheese Aug 22, 2025
6be79f9
Revert "Move remaining flags to common types module"
spacecheese Aug 22, 2025
e20c603
Fix lint issues
spacecheese Aug 22, 2025
0005e29
Fix typo in characteristic docstring
spacecheese Aug 22, 2025
5b7ad88
Fix typo in Advertisement __init__ docstring
spacecheese Aug 22, 2025
099ced9
Use autodoc_typehints description
spacecheese Aug 22, 2025
2af0815
Fix bad merge
spacecheese Aug 22, 2025
a3cb16e
Add python test version matrix
spacecheese Aug 30, 2025
5ead741
Remove always() conditions
spacecheese Aug 30, 2025
a1c8fb0
Refactor service interface
spacecheese Sep 14, 2025
5eeceed
Attempt automated coverage reporting
spacecheese Sep 14, 2025
86e835c
Disable fail-fast
spacecheese Sep 14, 2025
bb525e5
Fix test formatting
spacecheese Sep 14, 2025
b957fe2
Remove TypeAlias references
spacecheese Sep 14, 2025
3fa5264
Try uniquifying coverage reports
spacecheese Sep 14, 2025
a2176d4
Fix key names
spacecheese Sep 14, 2025
a39ff1d
Add token permissions
spacecheese Sep 14, 2025
55a81cf
Fix typo
spacecheese Sep 14, 2025
7098596
Remove pages deployment
spacecheese Sep 14, 2025
f2e4372
Fix upload-artifact version
spacecheese Sep 14, 2025
ee52157
Improve coverage report presentation
spacecheese Sep 14, 2025
b4bad21
Fix spelling issues
spacecheese Sep 14, 2025
37f6b77
Add "unexported" to spelling wordlist
spacecheese Sep 14, 2025
f28ea16
Reduce linkcheck workers
spacecheese Sep 14, 2025
5c95536
Exclude setup.py from coverage
spacecheese Sep 14, 2025
45ed51f
Improve uuid16 tests
spacecheese Sep 14, 2025
f926028
Ensure service unregister is called in tests
spacecheese Sep 14, 2025
37abe3b
Remove optional qualifier on read/write options
spacecheese Sep 14, 2025
5c35d97
Add empty read/write options test
spacecheese Sep 14, 2025
545b62c
Remove optional write options qualifier
spacecheese Sep 14, 2025
c05493b
Fix test formatting
spacecheese Sep 14, 2025
2a33cbd
Add toml support dependency
spacecheese Sep 14, 2025
64872f7
Unregister adverisements in tests
spacecheese Sep 14, 2025
d22add0
Document async attribute/ descriptors
spacecheese Sep 14, 2025
bb602cc
Implement doctests
spacecheese Sep 14, 2025
70e8b2c
Add test readme.rst
spacecheese Sep 14, 2025
cc4a1dd
Revert "Add test readme.rst"
spacecheese Sep 14, 2025
15d5344
Fix lint issues
spacecheese Sep 14, 2025
12b2113
Merge remote-tracking branch 'origin/rework-docs' into rework-testing
spacecheese Dec 29, 2025
eb4033a
Fix ci issues
spacecheese Dec 29, 2025
8fe2659
Move unit tests to separate module
spacecheese Dec 29, 2025
a344375
Fix "Install dependencies"
spacecheese Dec 29, 2025
8878341
Fix unit test imports
spacecheese Dec 29, 2025
f6064a5
Fix some state issues during exceptions
spacecheese Dec 29, 2025
65187e6
Bump ubuntu versions
spacecheese Dec 29, 2025
5ff58ba
Implement test-qemu job
spacecheese Dec 29, 2025
4169f87
Fix doc references to Advertisement.__init__ args
spacecheese Dec 29, 2025
5160ae4
Workflow fixes
spacecheese Dec 29, 2025
04a9be6
Install qemu runtime dependencies
spacecheese Dec 29, 2025
3a5d809
Add cross references to org.bluez pages
spacecheese Dec 30, 2025
ee25f94
Replace m2r2 with sphinx_include
spacecheese Dec 30, 2025
61912d2
Link to raw rst to avoid upsetting github
spacecheese Dec 30, 2025
657b561
Format docs conf.py
spacecheese Dec 30, 2025
87bf66d
Update gatt structure diagram link
spacecheese Dec 30, 2025
f3f6a40
Add contributing guide
spacecheese Dec 30, 2025
8191251
Remove aspell dependency
spacecheese Dec 30, 2025
cdf30f1
Remove deprecated license tags
spacecheese Dec 30, 2025
db147e3
Port tests to pytest
spacecheese Jan 3, 2026
d0687a3
Fix pre-commit black file spec
spacecheese Jan 3, 2026
0cb28ce
Fix ci commands
spacecheese Jan 3, 2026
4c4a0d4
Replace asyncio.timeout with wait_for
spacecheese Jan 3, 2026
71efaba
Explicitly specify asyncio.TimeoutError
spacecheese Jan 3, 2026
eb23823
Remove local install for loopback test
spacecheese Jan 3, 2026
01335ab
Add interactive loopback test launch option
spacecheese Jan 4, 2026
0484340
Explicitly exclude loopback test assets is rsync
spacecheese Jan 4, 2026
40754be
Fix registration logic to use updated BaseServiceInterface export mec…
spacecheese Jan 4, 2026
655119f
Add debug script
spacecheese Jan 4, 2026
aab5aad
Source venv before running pytest
spacecheese Jan 4, 2026
8eb4517
Fix error detection in test run
spacecheese Jan 4, 2026
6e3caab
Fix test running pwd
spacecheese Jan 4, 2026
ff5bff7
Print separate messages for unit and loopback tests
spacecheese Jan 4, 2026
07baa28
Fix loopback test_advert
spacecheese Jan 4, 2026
e493686
Rename test_real to test_bluez
spacecheese Jan 4, 2026
97aa1eb
Add test_characteristic.test_bluez
spacecheese Jan 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ on:

jobs:
deploy:

runs-on: ubuntu-latest
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
python-version: '3.11.x'
cache: 'pip'
- name: Install dependencies
run: |
Expand Down
127 changes: 119 additions & 8 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,153 @@ on: [ pull_request, workflow_dispatch ]

jobs:
test-docs:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9.x'
python-version: '3.11.x'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
sudo apt-get update && sudo apt-get install -y enchant-2 aspell-en
sudo apt-get update && sudo apt-get install -y enchant-2
- name: Build Docs
run: |
cd docs
make clean
make html
- name: Spelling Check
run: |
cd docs
make spelling
- name: Test Code Snippets
run: |
cd docs
make doctest
- name: Link Check
run: |
cd docs
make linkcheck
test:
runs-on: ubuntu-22.04

test-container:
runs-on: ubuntu-24.04
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
fail-fast: false
permissions:
pages: write
id-token: write
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9.x'
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r tests/requirements.txt
pip install "coverage[toml]"
- name: Add DBus Config
run: |
sudo cp tests/com.spacecheese.test.conf /etc/dbus-1/system.d
sudo cp tests/unit/com.spacecheese.test.conf /etc/dbus-1/system.d
- name: Run Tests
run: |
python -m unittest discover -s tests -p "test_*.py" -v
coverage run --source=. --branch -m pytest tests/unit -v
- name: Report Coverage
run: |
coverage html
coverage report -m
- name: Upload Coverage Artifact
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.python-version }}
path: htmlcov/

test-qemu:
runs-on: ubuntu-24.04
strategy:
matrix:
image_id: ["ubuntu-24.04-bluez-5.64", "ubuntu-24.04-bluez-5.66", "ubuntu-24.04-bluez-5.70"]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y qemu-system-x86 qemu-utils
- name: Download qemu images
env:
image_repo: "spacecheese/bluez_images"
run: |
image_id=${{ matrix.image_id }}
mkdir -p tests/loopback/assets
curl -L -o tests/loopback/assets/id_ed25519 \
https://github.com/$image_repo/releases/latest/download/id_ed25519
chmod 600 tests/loopback/assets/id_ed25519
curl -L -o tests/loopback/assets/image.qcow2 \
https://github.com/$image_repo/releases/latest/download/${image_id}.qcow2
- name: Run loopback Tests
run: |
tests/loopback/test.sh tests/loopback/assets/image.qcow2 tests/loopback/assets/id_ed25519 .

format-check:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11.x'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install black
- name: Check Formatting
run: |
python -m black --check bluez_peripheral
python -m black --check tests

type-hint-check:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11.x'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install mypy
- name: Check type hints
run: |
python -m mypy bluez_peripheral

lint-check:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11.x'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pylint
- name: Run lint checks
run: |
python -m pylint bluez_peripheral

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,7 @@ dmypy.json
cython_debug/

# VSCode Config Files
.vscode/
.vscode/

# Testing images
tests/loopback/assets
54 changes: 54 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
repos:
- repo: https://github.com/psf/black
rev: 25.12.0
hooks:
- id: black
name: black (code formatting)
files: ^(bluez_peripheral/|tests/)

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.19.1
hooks:
- id: mypy
name: mypy (type hints)
additional_dependencies:
- dbus_fast
files: ^bluez_peripheral/

- repo: https://github.com/pylint-dev/pylint
rev: v4.0.4
hooks:
- id: pylint
additional_dependencies:
- dbus_fast
files: ^bluez_peripheral/

- repo: local
hooks:
- id: docs-build
name: docs (build)
entry: bash -c "cd docs && make clean && make html"
language: system
pass_filenames: false
stages: [manual]

- id: docs-spelling
name: docs (spell check)
entry: bash -c "cd docs && make spelling"
language: system
pass_filenames: false
stages: [manual]

- id: docs-doctest
name: docs (test code snippets)
entry: bash -c "cd docs && make doctest"
language: system
pass_filenames: false
stages: [manual]

- id: docs-linkcheck
name: docs (linkcheck)
entry: bash -c "cd docs && make linkcheck"
language: system
pass_filenames: false
stages: [manual]
13 changes: 13 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2

build:
os: ubuntu-24.04
tools:
python: "3.11"

sphinx:
configuration: docs/source/conf.py

python:
install:
- requirements: docs/requirements.txt
27 changes: 27 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Contributing
Contributions of are encouraged and greatly appreciated.

## Getting Started
Code must pass the following CI checks before it will be accepted:
- Be preformatted with [black](https://github.com/psf/black)
- A mypy type hinting check
- A pylint check (including full docstring coverage)
- shphinx linkcheck, spelling and doctest (code snippet tests)
- Unit and end-to-end tests

Most of these checks can be run locally using [pre-commit](https://pre-commit.com/). To configure this run:
```bash
pip install pre-commit
pre-commit install
```
pylint, mypy and formatting checks will then be automatically run as part of your git hooks. sphinx tests can also be run by pre-commit, though you must first install some additional dependencies to build the documentation:
```bash
pip install -r docs/requirements.txt
sudo apt-get install enchant-2 # This depends on your distribution- for more see the pyenchant documentation
```
You can then run all pre-commit checks manually:
```bash
pre-commit run --hook-stage manual --all-files
```

For instructions on running tests locally please consult the respective markdown files- this process more more complex since bluez, dbus and the hci_vhci kernel module are required.
25 changes: 11 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,25 @@ Install bluez (eg. `sudo apt-get install bluez`)

## GATT Overview

GATT is a BLE protocol that allows you to offer services to other devices.
You can find a list of standardised services on the [Bluetooth SIG website](https://www.bluetooth.com/specifications/specs/) (you can largely ignore profiles when working with BLE). You should refer to the "Service Characteristics" in these specifications for the purposes of this library.
GATT is a protocol that allows you to offer services to other devices.
You can find a list of standardized services on the [Bluetooth SIG website](https://www.bluetooth.com/specifications/specs/).

![Peripheral Hierarchy Diagram](https://doc.qt.io/qt-5/images/peripheral-structure.png)
![Peripheral Hierarchy Diagram](https://doc.qt.io/qt-6/images/peripheral-structure.png)

_Courtesey of Qt documentation (GNU Free Documentation License)_

A peripheral defines a list of services that it provides. Services are a collection of characteristics which expose particular data (eg. a heart rate or mouse position). Characteristics may also have descriptors that contain metadata (eg. the units of a characteristic). Services can optionally include other services. All BLE attributes (Services, Characterisics and Descriptors) are identified by a 16-bit number [assigned by the Bluetooth SIG](https://www.bluetooth.com/specifications/assigned-numbers/).
A peripheral defines a list of services that it provides. Services are a collection of characteristics which expose particular data (eg. a heart rate or mouse position). Characteristics may also have descriptors that contain metadata (eg. the units of a characteristic). Services can optionally include other services. All BLE attributes (Services, Characteristics and Descriptors) are identified by a 16-bit number [assigned by the Bluetooth SIG](https://www.bluetooth.com/specifications/assigned-numbers/).

Characteristics may operate in a number of modes depending on their purpose. By default characteristics are read-only in this library however they may also be writable and provide notification (like an event system) when their value changes. Additionally some characteristics require security protection. You can read more about BLE on the [Bluetooth SIG blog](https://www.bluetooth.com/blog/a-developers-guide-to-bluetooth/).
Characteristics may operate in a number of modes depending on their purpose. By default characteristics are read-only in this library however they may also be writable and provide notification (like an event system) when their value changes. Additionally some characteristics may require security protection. You can read more about BLE on the [Bluetooth SIG blog](https://www.bluetooth.com/blog/a-developers-guide-to-bluetooth/). [This video](https://www.youtube.com/watch?v=BZwOrQ6zkzE) gives a more in-depth overview of BLE.

## Usage

There are a few important things you need to remember when using this library:

- **Do not attempt to create the Generic Access Service or a Client Characteristic Configuration Descriptor** (if you don't know what this means don't worry). These are both handled automatically by Bluez and attempting to define them will result in errors.
- Services are not implicitly threaded. **If you register a service in your main thread blocking that thread will stop your service (and particularly notifications) from working**. Therefore you must frequently yeild to the asyncio event loop (for example using asyncio.sleep) and ideally use multithreading.
When using this library please remember that services are not implicitly threaded. **The thread used to register your service must regularly yeild otherwise your service will not work** (particularly notifications). Therefore you must frequently yield to the asyncio event loop (for example using asyncio.sleep) and ideally use multithreading.

The easiest way to use the library is to create a class describing the service that you wish to provide.

```python
from bluez_peripheral.gatt.service import Service
from bluez_peripheral.gatt.characteristic import characteristic, CharacteristicFlags as CharFlags
from bluez_peripheral.gatt import Service, characteristic, CharacteristicFlags as CharFlags

import struct

Expand Down Expand Up @@ -89,15 +85,16 @@ async def main():
service = HeartRateService()
await service.register(bus)

# An agent is required to handle pairing
# An agent is required if you wish to handle pairing.
agent = NoIoAgent()
# This script needs superuser for this to work.
# This line needs superuser for this to work.
await agent.register(bus)

adapter = await Adapter.get_first(bus)

# Start an advert that will last for 60 seconds.
advert = Advertisement("Heart Monitor", ["180D"], 0x0340, 60)
advert = Advertisement("Heart Monitor", ["180D"],
appearance=0x0340, timeout=60)
await advert.register(bus, adapter)

while True:
Expand Down
3 changes: 3 additions & 0 deletions bluez_peripheral/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .advert import Advertisement
from .uuid16 import UUID16
from .util import get_message_bus
Loading