Skip to content

Add vendor/proprietary BLE parser extension examples, tests, and docs#188

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/add-vendor-parsers-examples
Draft

Add vendor/proprietary BLE parser extension examples, tests, and docs#188
Copilot wants to merge 2 commits intomainfrom
copilot/add-vendor-parsers-examples

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 23, 2026

Closes the gap for consumers who need to register parsers for non-SIG (proprietary) UUIDs — previously undocumented and with no examples.

Changes

examples/vendor_parsers/register_parsers.py

Two real-world proprietary characteristic implementations:

  • Nordic LBS (NordicLEDCharacteristic, NordicButtonCharacteristic) — single-byte LED/button state using real Nordic Semiconductor proprietary UUIDs from the nRF5 SDK LBS example
  • Govee-style thermometer (GoveeThermometerCharacteristic) — 4-byte sint16 LE temp ÷ 100 °C + uint16 LE humidity ÷ 100 %, result typed as a msgspec.Struct

register_all() uses explicit register_custom_characteristic_class(..., override=True) rather than auto-registration, making it safe to call idempotently across any lifecycle phase (including test fixtures that clear registries between runs).

from examples.vendor_parsers.register_parsers import register_all, GOVEE_THERMO_UUID
import struct

translator = register_all()

payload = bytearray(struct.pack("<hH", 2250, 6510))
result = translator.parse_characteristic(GOVEE_THERMO_UUID, payload)
# GoveeThermometerReading(temperature=22.5, humidity=65.1)

tests/gatt/characteristics/test_vendor_parsers.py

20 tests covering parse, encode, round-trip, error cases (empty/short payload → CharacteristicParseError), and translator UUID dispatch for all three vendor characteristics. An autouse fixture calls register_all() before each test.

docs/source/how-to/usage.md

New "Vendor / Proprietary Parser Extensions" section with a 3-step walkthrough: define class → register → parse, with inline examples and links to the example script and tests.

Supporting changes

  • pyproject.toml: added ARG002 to examples/** per-file-ignores — ctx/validate are required by the BaseCharacteristic interface even when unused in simple implementations
  • test_characteristic_test_coverage.py: added test_vendor_parsers.py to _EXCLUDED_TEST_FILES (cross-cutting test, not characteristic-specific, same pattern as test_custom_characteristics.py)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • img.shields.io
    • Triggering command: /opt/hostedtoolcache/Python/3.11.15/x64/bin/python python -m pytest tests/ -x -q --tb=short (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Add documentation and examples for vendor parser extensions Add vendor/proprietary BLE parser extension examples, tests, and docs Apr 23, 2026
Copilot AI requested a review from RonanB96 April 23, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document and provide examples for vendor/proprietary parser extensions

2 participants