我想开发一个应用程序BLE为Android。
I am trying to develop a BLE application for Android.
时的任何方式,通过它我可以检测和读取UDID,专业,烽火小Android设备?
Is the any way through which i can detect and read UDID, Major, Minor of beacon on android devices?
我看了RadiusNetworks Android的ibeacon服务,但我不明白为什么:
I have read the RadiusNetworks android-ibeacon-service, but I can't understand why:
major = (256 * (0xFF & paramArrayOfByte[(i + 20)]) +
(0xFF & paramArrayOfByte[(i + 21)]));
其中 paramArrayOfByte
是 LeScanCallback byte []的scanRecord
在获得字节[] scanRecord
从 BluetoothAdapter.LeScanCallback
,它将包括蓝牙LE标头,它可以是可变长度取决于iBeacon的类型。
When you get the byte[] scanRecord
from BluetoothAdapter.LeScanCallback
, it will include the Bluetooth LE headers, which can be variable length depending on the type of iBeacon.
由于可变长度的头四个字节表示一个iBeacon广告( 4C 00 02 15
)可以在任何地方开始从第三个字节( scanRecord [2]
),一直到第六个字节( scanRecord [5]
)。在最新code ,在的Android iBeacon库找到的 4C 00 02 15 在 scanRecord
,并称其为 startByte
。一切是在一个固定的位置,相对于 startByte
。
Because of the variable length headers the four bytes that indicate an iBeacon advertisement (4c 00 02 15
) may begin anywhere from the third byte (scanRecord[2]
) up to the sixth byte (scanRecord[5]
). In the latest code, the Android iBeacon Library finds the index position of the 4c 00 02 15
within the scanRecord
and calls it the startByte
. Everything else is at a fixed position relative to that startByte
.