diff options
Diffstat (limited to 'examples/bluetooth/ble_advertising.py')
-rw-r--r-- | examples/bluetooth/ble_advertising.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/examples/bluetooth/ble_advertising.py b/examples/bluetooth/ble_advertising.py index 2fe17d640..f0b97d7f5 100644 --- a/examples/bluetooth/ble_advertising.py +++ b/examples/bluetooth/ble_advertising.py @@ -79,12 +79,9 @@ def decode_name(payload): def decode_services(payload): services = [] - for u in decode_field(payload, _ADV_TYPE_UUID16_COMPLETE): - services.append(bluetooth.UUID(struct.unpack("<h", u)[0])) - for u in decode_field(payload, _ADV_TYPE_UUID32_COMPLETE): - services.append(bluetooth.UUID(struct.unpack("<d", u)[0])) - for u in decode_field(payload, _ADV_TYPE_UUID128_COMPLETE): - services.append(bluetooth.UUID(u)) + for code in (_ADV_TYPE_UUID16_COMPLETE, _ADV_TYPE_UUID32_COMPLETE, _ADV_TYPE_UUID128_COMPLETE): + for u in decode_field(payload, code): + services.append(bluetooth.UUID(u)) return services |