From 3436223630751c770c04b2dca35ef0002143f033 Mon Sep 17 00:00:00 2001 From: Jim Mussared Date: Wed, 13 Nov 2019 17:00:35 +1100 Subject: [PATCH] examples/bluetooth: Add helpers for decoding advertising payloads. Extracts name and service UUID fields. --- examples/bluetooth/ble_advertising.py | 37 +++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/examples/bluetooth/ble_advertising.py b/examples/bluetooth/ble_advertising.py index b57d5e031c..3a06beb740 100644 --- a/examples/bluetooth/ble_advertising.py +++ b/examples/bluetooth/ble_advertising.py @@ -2,6 +2,7 @@ from micropython import const import struct +import bluetooth # Advertising payloads are repeated packets of the following form: # 1 byte data length (N + 1) @@ -46,3 +47,39 @@ def advertising_payload(limited_disc=False, br_edr=False, name=None, services=No _append(_ADV_TYPE_APPEARANCE, struct.pack('