How to identify a device found via bluetooth using

2019-08-29 13:32发布

问题:

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.