【发布时间】:2016-01-04 19:57:21
【问题描述】:
我对 Arduino 101 上的 BLE 外设有以下疑问:
- 可以在广告数据包中发布任何特征值(动态数据)而不是 UUID。如果是这样,那么 API 是什么?我的目标是获取 adv 数据包中的任何温度数据,而不是连接到外围设备。
当前观察:我只能使用 API setAdvertisedServiceUuid 和 setLocalName 来宣传服务 uuid 和本地名称。
2.在下面的代码中,我能够在第一个实例中启动并捕获广告,但在字母实例中,begin 的返回值是错误的。我做错什么了吗?想法是启动和停止广告,甚至可能更改广告数据。
#include <CurieBle.h>
void setup() {
// set LED pin to output mode
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
//BLE Peripheral
BLEPeripheral * blePeripheral = new BLEPeripheral;
//Set the Local Name
blePeripheral->setLocalName("MyDevice");
//Start Advertising
blePeripheral->begin();
//Run the advertisement for 20 seconds
delay(20000);
//Stop the advertisement
blePeripheral->end();
//Delete the BLE Peripheral
delete blePeripheral;
//Wait 5 seconds before starting the next adv
delay(5000);
}
任何帮助将不胜感激。
谢谢。 斯沃鲁普
【问题讨论】:
标签: arduino bluetooth-lowenergy