diff options
| author | Damien George <damien.p.george@gmail.com> | 2020-03-10 11:45:03 +1100 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2020-03-11 14:00:44 +1100 |
| commit | dd0bc26e65734b8a4fafa3769008e92e2ec6645d (patch) | |
| tree | 9312f74c625e65ddf6c44e5a5e9264ee667190e5 /docs | |
| parent | bd746a46309efc261d6124b546b5bf6775d47460 (diff) | |
extmod/modbluetooth: Change scan result's "connectable" to "adv_type".
This commit changes the BLE _IRQ_SCAN_RESULT data from:
addr_type, addr, connectable, rssi, adv_data
to:
addr_type, addr, adv_type, rssi, adv_data
This allows _IRQ_SCAN_RESULT to handle all scan result types (not just
connectable and non-connectable passive scans), and to distinguish between
them using adv_type which is an integer taking values 0x00-0x04 per the BT
specification.
This is a breaking change to the API, albeit a very minor one: the existing
connectable value was a boolean and True now becomes 0x00, False becomes
0x02.
Documentation is updated and a test added.
Fixes #5738.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/library/ubluetooth.rst | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/docs/library/ubluetooth.rst b/docs/library/ubluetooth.rst index 88dc98eca..a16019e60 100644 --- a/docs/library/ubluetooth.rst +++ b/docs/library/ubluetooth.rst @@ -93,7 +93,7 @@ Event Handling conn_handle, attr_handle = data elif event == _IRQ_SCAN_RESULT: # A single scan result. - addr_type, addr, connectable, rssi, adv_data = data + addr_type, addr, adv_type, rssi, adv_data = data elif event == _IRQ_SCAN_COMPLETE: # Scan duration finished or manually stopped. pass @@ -185,7 +185,15 @@ Observer Role (Scanner) interval and window are 1.28 seconds and 11.25 milliseconds respectively (background scanning). - For each scan result, the ``_IRQ_SCAN_RESULT`` event will be raised. + For each scan result the ``_IRQ_SCAN_RESULT`` event will be raised, with event + data ``(addr_type, addr, adv_type, rssi, adv_data)``. ``adv_type`` values correspond + to the Bluetooth Specification: + + * 0x00 - ADV_IND - connectable and scannable undirected advertising + * 0x01 - ADV_DIRECT_IND - connectable directed advertising + * 0x02 - ADV_SCAN_IND - scannable undirected advertising + * 0x03 - ADV_NONCONN_IND - non-connectable undirected advertising + * 0x04 - SCAN_RSP - scan response When scanning is stopped (either due to the duration finishing or when explicitly stopped), the ``_IRQ_SCAN_COMPLETE`` event will be raised. |
