且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

iphone可以用作具有涡流格式的信标吗?

更新时间:2023-01-24 08:06:00

不幸的是,这是不可能的. Apple限制了其CoreBluetooth API可以发送的广告类型.虽然您可以使用与Eddystone相同的GATT服务UUID广播广告,但是您无法附加必要的数据.这是因为将服务数据与广告关联的CBAdvertisementDataServiceDataKey在iOS上是只读的.您无法设置数据.

Unfortunately, this is not possible. Apple restricts the type of advertisements that can be sent out by its CoreBluetooth APIs. While you can broadcast an advertisement with the same GATT Service UUID as required for Eddystone, you cannot attach the necessary data. This is because the CBAdvertisementDataServiceDataKey that associates service data to an advertisement is read-only on iOS. You can't set the data.

因此,当您要使iOS设备发布这样的广告时:

So while you want to make the iOS device advertise something like this:

0201060303aafe1516aafe00e72f234454f4911ba9ffa6000000000001

您最终会发布这样的广告:

You end up advertising something like this:

0201060303aafe0316aafe

这将省略Eddystone-UID类型代码(00),校准功率(e7),名称空间标识符(2f234454f4911ba9ffa6)和实例标识符(000000000001).结果,它不会被识别为Eddystone-UID框架.

This leaves off the Eddystone-UID type code (00), the calibrated power (e7), the namespace identifier (2f234454f4911ba9ffa6) and the instance identifier (000000000001). As a result, it won't be recognized as an Eddystone-UID frame.