简体   繁体   中英

Raspberry Pi Bluetooth 4.0 Connection

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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