简体   繁体   English

Android Bluetooth LE API onScanResult ScanRecord字节的含义

[英]Android Bluetooth LE API onScanResult ScanRecord bytes meaning

I am developing an app which scans for beacons in range and displays beacons' data to the user. 我正在开发一个可扫描范围内的信标并向用户显示信标数据的应用程序。 I am using Android Bluetooth LE API. 我正在使用Android蓝牙LE API。 In onScanResult() method I get ScanResult object which I then parse to raw bytes. onScanResult()方法中,我得到ScanResult对象,然后将其解析为原始字节。 This is a sample of what I get from one of my beacons: 这是我从一个信标得到的样本:

02:01:06:1A:FF:4C:00:02:15:74:27:8B:DA:B6:44:45:20:8F:0C:72:0E:AF:05:99:35:00:00:00:01:C5:02:0A:00:08:16:F0:FF:64:00:00:00:01:11:09:4D:69:6E:69:42:65:61:63:6F:6E:5F:33:36:38:35:30:00:00

I had no problems with finding out what the first part mean - it corresponds to the iBeacon format: 我发现第一部分的含义没有问题-它与iBeacon格式相对应:

02:01:06:1A:FF:4C:00:02:15 - iBeacon prefix
74:27:8B:DA:B6:44:45:20:8F:0C:72:0E:AF:05:99:35 - UUID
00:00 - Major
00:01 - Minor
C5 - TX power

But I have completely no idea what the rest of the bytes are. 但是我完全不知道其余字节是什么。 Are these some kind of manufacturer specific data or what? 这些是制造商特定的数据还是什么? Can they be used to get any useful information? 它们可以用来获取任何有用的信息吗?

02:0A:00:08:16:F0:FF:64:00:00:00:01:11:09:4D:69:6E:69:42:65:61:63:6F:6E:5F:33:36:38:35:30:00:00

Bluetooth packets are broken down into what are called PDUs. 蓝牙数据包被分解为所谓的PDU。 A PDU starts with a one byte length followed by a one byte type. PDU以一个字节的长度开始,然后是一个字节的类型。 The interpretation of the remaining bytes is specific to the PDU type. 其余字节的解释特定于PDU类型。

Some of that extra data is of interest (mainly the Bluetooth name) but most of it is not. 一些额外的数据值得关注(主要是蓝牙名称),但大多数却没有。

So these bytes mean: 因此,这些字节表示:

02:0A:00 (Flags PDU. Not of much interest.) 02:0A:00(标记PDU。没有太大意义。)

08:16:F0:FF:64:00:00:00:01 (Service Data PDU. Service UUID: FFF0, Service Data: 64:00:00:00:01) 08:16:F0:FF:64:00:00:00:01(服务数据PDU。服务UUID:FFF0,服务数据:64:00:00:00:01)

11:09:4D:69:6E:69:42:65:61:63:6F:6E:5F:33:36:38:35:30 (Complete Local Name PDU: "MiniBeacon_36850") 11:09:4D:69:6E:69:42:65:61:63:6F:6E:5F:33:36:38:35:30(完整的本地名称PDU:“ MiniBeacon_36850”)

00:00 (Buffer fill) 00:00(缓冲区填充)

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

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