pycom / pydocs

4 stars 4 forks source link

BLE documentation, especially Peripheral/Server use cases #6

Open mphasize opened 5 years ago

mphasize commented 5 years ago

Please add more documentation on using Bluetooth / BLE

Is your feature request related to a problem? Please describe.

At the moment the Pycom documentation for the BLE implementation only describes how to use a Pycom board as a BLE client that connects to BLE peripherals. The documentation on how to use the board as a BLE peripheral (i.e. a BLE server) is almost completely missing at this point, however the Pycom forums have various user-contributed code sketches that show that it is at least partially possible.

Describe the solution you'd like

Add an example or tutorial and corresponding API documentation that shows how to use the Pycom boards as BLE peripherals (i.e. BLE server).

Topics to cover would be:

Teachability, Documentation, Adoption, Migration Strategy

Having canonical docs or tutorials would help developers to quickly understand the full capabilities of the ESP32 and BLE and would also help Pycom to get a better picture on the implementation status of the APIs and would make it easier to find and iron out bugs that might still be in the library.
A good set of usable code examples would be great, as an inspiration I would like to mention https://github.com/espressif/arduino-esp32/tree/master/libraries/BLE/examples

catalinio commented 5 years ago

hi @mphasize,

Thanks for your comments. Here are examples of BLE GATT both Server and Client: https://docs.pycom.io/firmwareapi/pycom/network/bluetooth/gattscharacteristic.html I think the READ/WRITE and Notify are being handled there. Also the forum posts are quite old, BLE is constantly improved, given our customers feedback. In principle the BLE features are described in ESP32-IDF documentation here: https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/bluetooth/bt_le.html and it can be quickly exposed in micropython if required. All our firmware/software and documentation is open-source and we are more than happy to accept pull-requests.

mphasize commented 5 years ago

Hi @catalinio,

thanks for the pointers! With the example from GATTSCharacteristic I finally managed to get something to work and I also finally understood that I will not find Python code for the Bluetooth library, but rather will have to look at the C code for the underlying functions.

I will put some notes here with the things I had trouble understanding – maybe they can help someone or inform the next iteration of docs/tutorials.

Cheers Marcus