Using CoreBluetooth with iBeacons

╄→尐↘猪︶ㄣ 提交于 2019-12-20 14:38:57

问题


I've been doing quite a bit of research on iBeacons and CoreBluetooth on iOS devices. Your posts and research have been great. I've learned quite a bit. Unfortunately, i'm running into a dead end as it pertains to what I actually want to do.

I was reading this post: http://developer.radiusnetworks.com/2013/10/21/corebluetooth-doesnt-let-you-see-ibeacons.html....

...and it points out that you can't really do much with CoreBluetooth without the proximityUUID. That said, what if I actually DO have it?

What i want to do is place iBeacons around a given location. I'll use the didEnterRegion CLLocationManager delegate method to know when we've entered the region. I want to use that to trigger some CoreBluetooth monitoring of the beacons so it can be done in the background. I only need the RSSI and a unique identifier (I can do without the Major and Minor for now), which i've been able to get in the foreground, but not in the background.

I was under the impression that I should still be able to get this basic data in the background if my app had 'bluetooth-central' (now "App Communicates using CoreBluetooth") set.

Can you shed any light on what I'm trying to do? At present, it doesn't seem like anyone else has tried this and I'd love to get it going and share it, as it seems like a viable work-around if I can get past this barrier.

Thoughts?


回答1:


As mentioned in the blog post, you cannot get any of the iBeacon identifiers out of the CoreBluetooth APIs because iOS does not provide access to the raw advertising data that encapsulates these identifiers.

You may be able to do correlations. If only one BluetoothLE device is visible, and you just saw an iBeacon using CoreLocation APIs, you can continue to track the beacon with CoreBluetooth, reading the RSSI as you suggest.

The trouble comes when multiple BluetoothLE devices are visible. Without access to the iBeacon identifiers in CoreBluetooth, how will you know which device you are seeing in CoreBluetooth lines up with which of the iBeacons you see with CoreLocation? Unfortunately, I do not think there is any way to match them up.




回答2:


As suggested, is not possible but almost every big manufacturer like Kontakt.io or Estimote uses a special UUID Service for identifier, battery and other things.

You can write your own framework that recognize this kind of iBeacon using CoreBluetooth, keep in your mind that Service UUID data is not the major, minor, uuid etc.. but just an identifier of a device, you should definitely create a database or plist with matching between id of Service data and UUID, major and minor of iBeacon.

In this way you are able to take every packet from iBeacon and do your stuff with it.



来源:https://stackoverflow.com/questions/20387327/using-corebluetooth-with-ibeacons

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