简体   繁体   English

如何使用iOS版BLE识别通过蓝牙找到的设备

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

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. 到目前为止,它的运行情况还不错,我已经在Macbook,iPad和Apple TV上进行过测试。 And I get their name, such as: "Eduardo's iPad, Apple TV, Eduardo's Macbook". 我得到了他们的名字,例如:“ Eduardo的iPad,Apple TV,Eduardo的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,但是我不知道如何在iOS或Android设备上识别该ID,这是我扫描时得到的对象:

{
  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 . 请注意,我在这里获得的ID是2BD5D5A7-EF50-B4F4-D4FD-9A8413006D4B ,但如果我在iPad上转到“设置” /“常规” /“关于” /“蓝牙”,则显示的ID为F0:D1:A9:E3:F9:E9

So, can I get the short id from the long id somehow? 那么,我能以某种方式从长ID中获得短ID吗? Or, is there a way to get that long id on iOS or Android using their graphic interface? 或者,是否有一种方法可以使用其图形界面在iOS或Android上获取该长ID? Thanks in advance. 提前致谢。

In iOS not allow to get MAC address of peripheral(BLE Device), so iOS generate UUID for peripheral. 在iOS中,不允许获取外围设备(BLE设备)的MAC地址,因此iOS为外围设备生成UUID。

Diff. iOS devices allocate diff. iOS设备分配差异。 UUID. UUID。

So, There is no any other way to identify a peripheral device in iOS. 因此,在iOS中没有其他方法可以识别外围设备。

If peripheral advertisement data shows any Id then we can identify BLE device. 如果外围广告数据显示任何ID,则我们可以识别BLE设备。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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