Raspberry Pi Bluetooth 4.0 Connection

我怕爱的太早我们不能终老 提交于 2020-01-01 04:55:09

问题


I am trying to connect to a Raspberry Pi via iPhone using CoreBluetooth (bluetooth 4.0). 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. I also made sure to set the RPi to advertise bluetooth low energy using

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? Also the name variable on the peripheral is blank, is that because I have not connected yet?


回答1:


Try out bleno, it's a node.js library that can be used to create a BLE peripheral on both OS X and Linux. It works well on my Raspberry Pi running Raspbian.



来源:https://stackoverflow.com/questions/16052882/raspberry-pi-bluetooth-4-0-connection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!