arduino / arduino/ArduinoCore-API

BLE central API

未关闭
#7 41 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
C++
星标
306
派生
150
PR 合并指标
30 天内没有已合并 PR

描述

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

贡献指南

这个仓库没有索引到贡献指南

调研方向

审查 api/BLE/central 中的草稿,以及 scan.ino、scan_callback.ino、led_control.ino、sensortag_button.ino 和 peripheral_explorer.ino 中的示例。先阅读这些示例和 BLERemotePeripheralAttributeWithValue.h,然后解决有关 API、属性读写和类命名的未决问题。当 central API 设计达成一致且草稿反映该决定时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
cpp
领域
api, embedded-iot
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。