AltBeacon:如何使用AltBeacon库获取广告标志(如BR/EDR)?

huangapple go评论115阅读模式
英文:

AltBeacon : How can I get Advertising Flags (such as, BR/EDR) using AltBeacon Lib?

问题

使用Altbeacon库,我可以看到我正在寻找的信标。
@override
public void didEnterRegion(Region region) { ...}

但我还需要读取诸如下面这样的AD Flags,例如:
02#第一个AD结构中跟随的字节数
01#Flags AD类型
1A#Flags值0x1A = 000011010
位0(关闭)LE有限可发现模式
位1(开启)LE通用可发现模式
位2(关闭)BR/EDR不受支持
位3(开启)同一设备支持同时LE和BR/EDR(控制器)
位4(开启)同一设备支持同时LE和BR/EDR(主机)

Altbeacon库中是否有API可以读取这些Flags?

谢谢,
Yong

英文:

Using Altbeacon lib, I can see the beacons that I am looking for.
@override
public void didEnterRegion(Region region) { ...}

But I also need to read AD Flags such as following, for example:
02 # Number of bytes that follow in first AD structure
01 # Flags AD type
1A # Flags value 0x1A = 000011010
bit 0 (OFF) LE Limited Discoverable Mode
bit 1 (ON) LE General Discoverable Mode
bit 2 (OFF) BR/EDR Not Supported
bit 3 (ON) Simultaneous LE and BR/EDR to Same Device Capable (controller)
bit 4 (ON) Simultaneous LE and BR/EDR to Same Device Capable (Host)

Is there an API in Altbeacon lib to read the Flags?

Thanks,
Yong

答案1

得分: 1

你所描述的标志数据是BLE广告的一部分,但它位于与AltBeacon、iBeacon或Eddystone使用的主要AD类型不同的广告部分中,因此该库被设计为忽略标志数据。使库解析此数据需要对库本身进行更改。

作为一种替代方案,您可能希望使用原始的Android扫描API,以便可以访问这些标志。

英文:

The flag data you describe is part of the BLE advertisement, but it is in a different part of the advertisement than the main AD type used for AltBeacon, iBeacon or Eddystone so the library is designed to ignore flag data. Making the library parse this would require changes to the library itself.

As an alternative, you may wish to use raw Android scanning APIs so you can get to the flags.

huangapple
  • 本文由 发表于 2020年9月26日 01:34:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/64068893.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定