arduino / arduino/ArduinoCore-API

BLE central API

Aperta
#7 41 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
C++
Stelle
306
Fork
150
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Based on the outcome of the API meeting, I've added a first draft of a BLE central API in the [api/BLE/central](https://github.com/arduino/ArduinoCore-API/tree/master/api/BLE/central) folder.

It's probably best to review the examples in the following order:
- [scan.ino](https://github.com/arduino/ArduinoCore-API/blob/master/api/BLE/central/examples/scan/scan.ino): Starts scanning for peripherals and prints out advertisement info. of discovered peripheral
- [scan_callback.ino](https://github.com/arduino/ArduinoCore-API/blob/master/api/BLE/central/examples/scan_callback/scan_callback.ino): Similar to `scan.ino` but callback style
- [led_control.ino](https://github.com/arduino/ArduinoCore-API/blob/master/api/BLE/central/examples/led_control/led_control.ino): Controls the LED on the [101 BLE LED example](https://github.com/01org/corelibs-arduino101/blob/master/libraries/CurieBLE/examples/LED/LED.ino) using a local button
- [sensortag_button.ino](https://github.com/arduino/ArduinoCore-API/blob/master/api/BLE/central/examples/sensortag_button/sensortag_button.ino): Listens to simple key notifications from a TI SensorTag and prints out events to the serial monitor. Similar to Tom's [Node.js sensorTagSlideshow example](https://github.com/tigoe/BluetoothLE-Examples/tree/master/sensorTag/sensorTagSlideshow).
- [peripheral_explorer.ino](https://github.com/arduino/ArduinoCore-API/blob/master/api/BLE/central/examples/peripheral_explorer/peripheral_explorer.ino): Connects to a peripheral and prints out it's services, characteristics, and descriptors. Similar to Tom's [Node.js exploreAsync example](https://github.com/tigoe/BluetoothLE-Examples/blob/master/noble/exploreAsync/explore.js).

Other item's to discuss:
1. Are there too many API's to access attributes of a peripheral? I've added a few to cater for various use cases, however I understand this might make documentation more difficult.
2. Is there a nicer way to handle reading and writing attributes with values (characteristics and descriptors). See [BLERemotePeripheralAttributeWithValue.h](https://github.com/arduino/ArduinoCore-API/blob/master/api/BLE/central/BLERemotePeripheralAttributeWithValue.h). Maybe we can re-use the [UDP](https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/Udp.h) style, with `beginWrite`, `Print` API's, and `endWrite`.
3. Class names, they are long now, mostly to avoid clashes with the BLEPeripheral API. In case there are use cases for using both peripheral and central mode at the same time in the future.

cc/ @tigoe @damellis @cmaglie @agdl

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Esamina la bozza in api/BLE/central e gli esempi in scan.ino, scan_callback.ino, led_control.ino, sensortag_button.ino e peripheral_explorer.ino. Inizia leggendo gli esempi e BLERemotePeripheralAttributeWithValue.h, quindi risolvi le questioni aperte relative all’API, alla lettura/scrittura degli attributi e alla denominazione delle classi. Il lavoro sarà considerato completato quando il design dell’API central sarà concordato e la bozza rifletterà tale decisione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp
Ambito
api, embedded-iot
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.