我正在尝试使用 CoreBluetooth(蓝牙 4.0)通过 iPhone 连接到 Raspberry Pi。我已经发现了该设备并使用以下代码发出连接请求:
if (peripheral != self.foundPeripheral) {
NSLog(@"Try to connect to %@", peripheral.name);
self.foundPeripheral = peripheral;
[self.centralManager stopScan];
[self.centralManager connectPeripheral:peripheral options:nil];
}
didConnectPeripheral 或 didFailedToConnectPeripheral 都不会被调用。我还确保将 RPi 设置为宣传蓝牙低能耗
sudo hciconfig hci0 leadv
但是当我检查活动连接时
hcitool con
没有活动连接。我是否缺少 RPi 的某些设置?另外外设上的名称变量是空白的,是因为我还没有连接吗?
Try out bleno https://github.com/sandeepmistry/bleno,它是一个 node.js 库,可用于在 OS X 和 Linux 上创建 BLE 外设。它在我运行 Raspbian 的 Raspberry Pi 上运行良好。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)