How to identify a device found via bluetooth using BLE for iOS

白昼怎懂夜的黑 提交于 2020-01-07 05:04:10

问题


I am writing an app for checking attendance on a classroom via bluetooth. It works just fine so far, I have been testing with my Macbook, iPad, Apple TV. And I get their name, such as: "Eduardo's iPad, Apple TV, Eduardo's Macbook". The problem is that yesterday I tested it on a mall, and all I got was a bunch of "unnamed" devices. That's going to be a problem on the classroom as well.

I am also getting an id, but I don't know how to identify that id on the iOS or Android device, this are the kind of objects I get when I scan:

{
  id: "2BD5D5A7-EF50-B4F4-D4FD-9A8413006D4B",
  rssi: -24,
  advertising: {
    kCBAdvDataIsConnectable: true
  },
  name: "Eduardo's iPad"
}

Please notate that the id I get here is 2BD5D5A7-EF50-B4F4-D4FD-9A8413006D4B, but if I go on my iPad to Settings/General/About/Bluetooth the id shown there is F0:D1:A9:E3:F9:E9.

So, can I get the short id from the long id somehow? Or, is there a way to get that long id on iOS or Android using their graphic interface? Thanks in advance.


回答1:


In iOS not allow to get MAC address of peripheral(BLE Device), so iOS generate UUID for peripheral.

Diff. iOS devices allocate diff. UUID.

So, There is no any other way to identify a peripheral device in iOS.

If peripheral advertisement data shows any Id then we can identify BLE device.



来源:https://stackoverflow.com/questions/47003983/how-to-identify-a-device-found-via-bluetooth-using-ble-for-ios

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