了解iBeacon显示数据:发电场和其它字节 [英] Understanding iBeacon data : the power field and other bytes

查看:220
本文介绍了了解iBeacon显示数据:发电场和其它字节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的蓝牙系统,我想了解用于苹果新的技术数据:iBeacon显示

目前已有一些很好的答案,这说明它是如何工作的,我一直在阅读了所有我能找到(尤其是蓝牙规范)。不过,我错过了一些观点,我会去一个例子第一:(我是用的设置广告数据命令的,它错过这里的 hcitool CMD 的OGF之前)

  0×08×0008 02 1E 01 1A 1A FF 4C 00 02 15 E2 C5 6D B5 DF FB 48 D2 B0 60 D0 F5 A7 10 96 E0 00 00 00 00 00 C5

我将列出这里是什么我不明白的或找到的信息。


  1. 有关于OGF任何地方的任何信息(这里是 0×08 )?我知道这代表作品code组字段但contratry到随OGF的OCF,我没有发现任何东西。

  2. 什么是 02 01 1A 1A 字节线代表什么?我知道的第一个字节, 1E ,讲述了其余数据的长度和行后,从 FF ,你得到制造商的具体数据。但我无法找到有关这些4个字节的任何事情。

  3. 如何做的权力字节工作?这是 C5 。我知道,我所得到的测距(在我的iPhone比如)我iBeacon显示,当是的dBm值。我知道,该值越高(上的字节功率的),这意味着更高的精确度,但也更能耗功率越高。 但你如何使用字节?什么是最小值和最大值可以设置?或者是有任何的公式有吗?你对字节设定值得到一组的dBm值(从您的iBeacon显示一米),?

感谢您。


解决方案

解答前两个问题都可以在巨大的蓝牙4.0核心规范


  1. 该OGF 0x08的群体OCF为LE控制器命令:


      

    对于LE控制器命令时,OGF $ C $,c定义为0x08的。
           (蓝牙规范4.0版[第2卷],1114页)


    由于×0008 OCF命令是一个控制器命令,你必须使用0x08的OGF code吧。困惑?算了吧。只要知道你用0x08的用×0008 hcitool 来设置广告数据。


  2. 启动所述广告的字节序列如下:

     跟随在广告中的字节数1E
    02字节数是按照第一次AD结构
    01标志AD型
    1A Flags值0x1A的= 000011010
       位0(OFF)LE有限公司检测模式
       第1位(ON)LE一般检测模式
       第2位(OFF)BR / EDR不支持
       第3位(ON),同时LE和BR / EDR到同一设备可(控制器)
       第4位(ON),同时LE和BR / EDR到同一设备可(主机)
    随后在第二个(也是最后一次)AD结构中的字节数1A
    FF制造商特定的数据类型AD
    4C公司标识code LSB
    00公司标识code MSB(0x004C ==苹果)
    iBeacon显示广告指标02字节0
    iBeacon显示广告指标15字节1

    - 蓝牙规范4.0版[第3卷],广告和扫描响应数据格式页。 375

    - 蓝牙规范4.0版[第3卷],附录C(标准):EIR和广告格式,第401


  3. 电力领域仅仅是一个字节的二进制补码数再presenting RSSI中的测得的功率在同一meeter了。简单来说

    下面是如何工作的:


    1. 保留一个iBeacon显示扫描仪(如找到了iBeacon显示适用于iOS)一米的变送器iBeacon显示了。

    2. 阅读RSSI信号强度。这将是-1和-127之间的数字。 (-1是非常强的,-127很弱)

    3. 转换这个数字将使用两个补十六进制。 (添加256然后转换为十六进制)


注:电源场可以80-FF。如果是00的iOS不会做一个距离计算的。你可以阅读更多关于如何在这里使用

I am new to the Bluetooth system and I am trying to understand the data used for the new Apple's technology : iBeacon.

There is already some nice answers which explain how it works and I have been reading everything I could find (especially the Bluetooth Specification). Still, I am missing some points and I will go for an example first : (I am using the Set Advertising Data Command, it misses here the hcitool cmd before the OGF)

0x08 0x0008 1E 02 01 1A 1A FF 4C 00 02 15 E2 C5 6D B5 DF FB 48 D2 B0 60 D0 F5 A7 10 96 E0 00 00 00 00 C5 00

I will list here what I didn't understand or find information about.

  1. Is there any information anywhere about the OGF (here it is 0x08)? I know it stands for OpCode Group Field, but contratry to the OCF which follows the OGF, I didn't find anything.
  2. What does the 02 01 1A 1A bytes line stand for? I know that the first byte, 1E, tells the length of the rest of the data and after that line, starting with FF, you get the manufacturer specific data. But I couldn't find anything about those 4 bytes.
  3. How does the power byte work? Here it is C5. I know that what I get is the dBm value when ranging my iBeacon (on my iPhone for instance). And I know that the higher the value (on that power byte), the higher the power which means more accuracy but also more energy consumption. But how do you use that byte? What are the min and max values you can set? Or is there any kind of formula there? Do you get a set dBm value (at one meter from your iBeacon) for a set value on the byte?

Thank you.

解决方案

Answers to the first two questions can be found in the gigantic Bluetooth 4.0 Core spec.

  1. The OGF of 0x08 groups OCF commands for LE Controllers:

    For the LE Controller Commands, the OGF code is defined as 0x08. (Bluetooth Specification Version 4.0 [Vol 2], page 1114)

    Because the 0x0008 OCF command is a controller command, you have to use the 0x08 OGF code with it. Confused? Forget it. Just know you use 0x08 0x0008 to set the advertising data using hcitool.

  2. The byte sequence starting the advertisement is as follows:

    1E Number of bytes that follow in the advertisement
    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)
    1A Number of bytes that follow in second (and last) AD structure
    FF Manufacturer specific data AD type
    4C Company identifier code LSB
    00 Company identifier code MSB (0x004C == Apple)
    02 Byte 0 of iBeacon advertisement indicator
    15 Byte 1 of iBeacon advertisement indicator
    

    -- Bluetooth Specification Version 4.0 [Vol 3], "ADVERTISING AND SCAN RESPONSE DATA FORMAT" p. 375

    -- Bluetooth Specification Version 4.0 [Vol 3], Appendix C (NORMATIVE): EIR AND AD FORMATS", p. 401

  3. The power field is simply a one byte two's complement number representing the "measured power" in RSSI at one meeter away. In simpler terms

    Here is how that works:

    1. Hold an iBeacon scanner (like Locate for iBeacon for iOS) one meter away from your iBeacon transmitter.
    2. Read its signal strength in RSSI. It will be a number between -1 and -127. (-1 is very strong, -127 is very weak)
    3. Convert this number into a hex using two's complement. (Add 256 then convert to hex)

Note: The power field can be 80-FF. If it is 00, iOS will not do a distance calculation at all. You can read more on how this is used here.

这篇关于了解iBeacon显示数据:发电场和其它字节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆