Commit Graph

38 Commits

Author SHA1 Message Date
Dan Halbert
4e3cb55ce7 share more of _bleio dict; fix one doc error 2020-09-01 12:41:58 -04:00
Dan Halbert
f5a5fc4c84 Fix stub; mismatched triple quotes 2020-08-30 14:59:03 -04:00
Dan Halbert
b27d511251 address review; use constructor for HCI Adapter 2020-08-30 14:06:48 -04:00
Dan Halbert
770c204d5a sphinx fixes 2020-08-21 17:03:45 -04:00
Dan Halbert
8d785cbbe5 fix stubs; make translate 2020-08-21 11:37:15 -04:00
Dan Halbert
0e30dd8bcc merge from upstream; working; includes debug_out code for debugging via Saleae for posterity 2020-08-20 20:29:57 -04:00
Yihui Xiong
52990a332d fix 2020-08-14 17:48:15 +08:00
Yihui Xiong
e7da652711 able to change ble mac address 2020-08-13 16:54:29 +08:00
Taku Fukada
56c898da80 Modify some Python stubs 2020-08-07 01:01:28 +09:00
Dan Halbert
0a60aee3e4 wip: compiles 2020-08-02 11:36:38 -04:00
Taku Fukada
d356581651 Fix several type hints 2020-07-27 18:05:13 +09:00
Taku Fukada
54a342a7f5 Add and correct some type hints 2020-07-24 18:20:03 +09:00
Dan Halbert
b08b0264cc back to working; check for extended advertising support 2020-07-15 09:46:13 -04:00
Dan Halbert
f6869c69c5 wip: advertising; not tested 2020-07-12 19:45:23 -04:00
Dan Halbert
f03045b97e address working; improved pkt dump 2020-07-08 23:15:48 -04:00
Dan Halbert
a5ab2829eb use zephyr include files; wip: compiles 2020-07-08 09:33:41 -04:00
dherrada
d0d949cd24 Made every init return None 2020-07-03 14:23:34 -04:00
dherrada
3df03a5650 Made most of the requested changes 2020-07-03 13:49:00 -04:00
dherrada
26f1fd0071 Added type hints to _bleio 2020-07-02 14:11:25 -04:00
Dan Halbert
11cb3e3b4b hci skeleton done; not working yet 2020-06-30 23:19:40 -04:00
Dan Halbert
f879114c43 do HCI pin init in Python, not here 2020-06-26 19:27:05 -04:00
Dan Halbert
1bc2e979eb wip; compiles; much commented out 2020-06-26 17:23:20 -04:00
Dan Halbert
759929c24a hci early wip; refactor supervisor bluetooth.c for nrf: tested 2020-06-25 20:57:17 -04:00
Sean Cross
34f91f01c6 bleio: adapter: add advertising timeout and status
Add a field to allow specifying a timeout when initiating advertising.
As part of this, add a new property to determine if the device is still
advertising.

Additionally, have the `anonymous` property require a timeout, and set
the timeout to the maximum possible value if no timeout is specified.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-19 15:01:19 +08:00
Sean Cross
cfe65742a3 _bleio: support anonymous advertising
Add a new parameter to the `start_advertising()` function to enable
anonymous advertising.  This forces a call to `sd_ble_gap_privacy_set()`
with `privacy_mode` set to `BLE_GAP_PRIVACY_MODE_DEVICE_PRIVACY` and
`private_addr_type` set to
`BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE`.

With this, addresses will cycle at a predefined rate (currently once
every 15 minutes).

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-19 15:01:18 +08:00
Scott Shawcroft
4e8de3c554
Swap sphinx to autoapi and the inline stubs 2020-05-12 17:28:24 -07:00
dherrada
0e465e63b9
Did audiopwmio, bitbangio, and _bleio 2020-05-01 18:23:27 -04:00
Dan Halbert
e31ac710be Enable _bleio adapter when _bleio is imported 2020-02-20 21:55:04 -05:00
Dan Halbert
346ce3b73b wip: HID bonding works! 2020-01-10 23:55:45 -05:00
Scott Shawcroft
9a3d45e7d0
Add extended, connectable and scannable error.
Related to https://github.com/adafruit/Adafruit_CircuitPython_BLE/issues/44
2019-12-12 13:46:59 -08:00
Scott Shawcroft
3fc58cee38
Merge remote-tracking branch 'adafruit/master' into support_extended_advertising 2019-11-26 13:12:43 -08:00
Scott Shawcroft
39f4046f70
Fix pairing when peripheral. Central untested. 2019-11-21 16:32:42 -08:00
Scott Shawcroft
5e857fdb67
Use BluetoothError in _bleio
This better differentiates errors than using OSError everywhere.
2019-11-20 14:02:15 -08:00
Scott Shawcroft
11c2c3443f
Add support for extended (>31 byte) BLE advertisements. 2019-11-19 13:55:58 -08:00
Dan Halbert
8584c1e824 Fix start_scan timeout default value 2019-11-13 21:34:20 -05:00
Scott Shawcroft
91c9d519ae
Refine comments and switch prefix_len to size_t 2019-10-22 23:09:56 -07:00
Scott Shawcroft
ae30a1e5aa
Refine _bleio
This PR refines the _bleio API. It was originally motivated by
the addition of a new CircuitPython service that enables reading
and modifying files on the device. Moving the BLE lifecycle outside
of the VM motivated a number of changes to remove heap allocations
in some APIs.

It also motivated unifying connection initiation to the Adapter class
rather than the Central and Peripheral classes which have been removed.
Adapter now handles the GAP portion of BLE including advertising, which
has moved but is largely unchanged, and scanning, which has been enhanced
to return an iterator of filtered results.

Once a connection is created (either by us (aka Central) or a remote
device (aka Peripheral)) it is represented by a new Connection class.
This class knows the current connection state and can discover and
instantiate remote Services along with their Characteristics and
Descriptors.

Relates to #586
2019-10-21 18:57:03 -07:00
Dan Halbert
7a64af9280 rename bleio module to _bleio 2019-08-29 18:44:27 -04:00