简体   繁体   English

Raspberry Pi蓝牙4.0连接

[英]Raspberry Pi Bluetooth 4.0 Connection

I am trying to connect to a Raspberry Pi via iPhone using CoreBluetooth (bluetooth 4.0). 我正在尝试使用CoreBluetooth(蓝牙4.0)通过iPhone连接到Raspberry Pi。 I have discovered the device and send out a connection request using this code: 我发现了该设备,并使用以下代码发送了连接请求:

if (peripheral != self.foundPeripheral) {
    NSLog(@"Try to connect to %@", peripheral.name);
    self.foundPeripheral = peripheral;
    [self.centralManager stopScan];
    [self.centralManager connectPeripheral:peripheral options:nil];

}

Neither the didConnectPeripheral or didFailedToConnectPeripheral are called. didConnectPeripheral或didFailedToConnectPeripheral均不会被调用。 I also made sure to set the RPi to advertise bluetooth low energy using 我还确保将RPi设置为使用来宣传蓝牙低功耗

sudo hciconfig hci0 leadv

but when I check active connections with 但是当我检查与

hcitool con

there are no active connections. 没有活动的连接。 Am I missing some set up for the RPi? 我是否缺少一些RPi设置? Also the name variable on the peripheral is blank, is that because I have not connected yet? 外围设备上的名称变量也为空白,是因为我尚未连接吗?

Try out bleno , it's a node.js library that can be used to create a BLE peripheral on both OS X and Linux. 尝试bleno ,它是一个node.js库,可用于在OS X和Linux上创建BLE外设。 It works well on my Raspberry Pi running Raspbian. 它在运行Raspbian的Raspberry Pi上运行良好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM