arduino / arduino/ArduinoCore-API
BLE central API
- Langage dominant
- C++
- Étoiles
- 306
- Forks
- 150
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
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
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Examinez l’ébauche dans api/BLE/central ainsi que les exemples scan.ino, scan_callback.ino, led_control.ino, sensortag_button.ino et peripheral_explorer.ino. Commencez par lire les exemples et BLERemotePeripheralAttributeWithValue.h, puis résolvez les questions ouvertes concernant l’API, la lecture/écriture des attributs et le nommage des classes. Le travail sera considéré comme terminé lorsque la conception de l’API centrale sera approuvée et que l’ébauche reflétera cette décision.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- cpp
- Domaine
- api, embedded-iot
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 25/100