summaryrefslogtreecommitdiff
path: root/examples/bluetooth/ble_temperature_central.py
diff options
context:
space:
mode:
authorThomas Friebel <yaron.de@gmail.com>2020-03-11 07:49:21 +0100
committerDamien George <damien.p.george@gmail.com>2020-03-12 10:58:08 +1100
commitbaf8aa286af1af2ddf0179b82b3411d45f513b23 (patch)
treed01ec9073baed2475d7f92be5066da472285bda7 /examples/bluetooth/ble_temperature_central.py
parent110a610f70d1223557e5c770c84fe509c6064cfb (diff)
examples/bluetooth: Replace "connectable" parameter with "adv_type".
Follow up to dd0bc26e65734b8a4fafa3769008e92e2ec6645d which changed the parameter list of the IRQ_SCAN_RESULT event. Adapt ble_temperature_central.py accordingly.
Diffstat (limited to 'examples/bluetooth/ble_temperature_central.py')
-rw-r--r--examples/bluetooth/ble_temperature_central.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/examples/bluetooth/ble_temperature_central.py b/examples/bluetooth/ble_temperature_central.py
index 14ea694a9..04fed0a29 100644
--- a/examples/bluetooth/ble_temperature_central.py
+++ b/examples/bluetooth/ble_temperature_central.py
@@ -27,6 +27,11 @@ _IRQ_GATTC_NOTIFY = const(1 << 13)
_IRQ_GATTC_INDICATE = const(1 << 14)
_IRQ_ALL = const(0xFFFF)
+_ADV_IND = const(0x00)
+_ADV_DIRECT_IND = const(0x01)
+_ADV_SCAN_IND = const(0x02)
+_ADV_NONCONN_IND = const(0x03)
+
# org.bluetooth.service.environmental_sensing
_ENV_SENSE_UUID = bluetooth.UUID(0x181A)
# org.bluetooth.characteristic.temperature
@@ -76,8 +81,10 @@ class BLETemperatureCentral:
def _irq(self, event, data):
if event == _IRQ_SCAN_RESULT:
- addr_type, addr, connectable, rssi, adv_data = data
- if connectable and _ENV_SENSE_UUID in decode_services(adv_data):
+ addr_type, addr, adv_type, rssi, adv_data = data
+ if adv_type in (_ADV_IND, _ADV_DIRECT_IND,) and _ENV_SENSE_UUID in decode_services(
+ adv_data
+ ):
# Found a potential device, remember it and stop scanning.
self._addr_type = addr_type
self._addr = bytes(