Core Bluetooth - constant RSSI updates of in-range devices

后端 未结 4 968
遥遥无期
遥遥无期 2020-12-08 03:34

I just started with the core bluetooth framework for iOS and I\'m developing an app that needs to constantly scan for BLE devices so that I can retrieve their RSSI number ev

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-08 03:56

    Is far as I can see, this should do what you want.

    When you started scanning for peripherals with the original call, your delegate should begin to get calls whenever a BLE device is discovered. This will continue until you stop the scan with a call to

    [manager stopScan];
    

    I don't think you actually need the second call to scanForPeripheralsWithServices in your centralManager:didRetrievePeripherals method, since, as far as I know, the scanning doesn't stop until you tell it to. I'm still getting started on this, too, though, and there may be a timeout I have not found, yet.

    I'm pretty sure the reason you get a call about once a minute is because the BLE device is only advertising that often. If it advertises more often, like a device in discovery mode, I think you will get the calls more often. I would be interesting if you could confirm that. If the device has a discovery mode, you might try triggering it to see if the notices speed up.

提交回复
热议问题