蓝牙地址的规则

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

XX  作       者:ZHS(文化人)

XX  联系方式:文章末尾Chat快问(或进群:471144274)

XX  版权声明:原创文章,欢迎评论和转载~转载时能告诉我一声就最好了

XX  要说的话:作者水平有限,难免有不足之处,恳请指正!

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

蓝牙地址分为三部分:

LAP(24位地址低端部分)、UAP(8位地址高端部分)和NAP(16位无意义地址部分)。

其中,NAP和UAP是生产厂商的唯一标识码,必须由蓝牙权威部门分配给不同的厂商。

而LAP是由厂商内部自由分配。

以下是CSR官方文档有关蓝牙地址的描述:

The local device's Bluetooth address.  This should be unique to this device.  It is allocated during manufacturing.
The type bdaddr can be viewed as a uint16[4] array:

    1st uint16:  The top 8 bits of the LAP are in the bottom 8 bits of this word. The top 8 bits of this word must be zero.
    2nd uint16: The lower 16 bits of the LAP
    3rd uint16:  The 8-bit UAP is in the bottom 8 bits of this word. The top 8 bits of this word must be zero.
    4th uint16:  16-bit NAP

For example, the Bluetooth address 0002  5b  00a5a5 is encoded as 0000, a5a5, 005b, 0002.


The default value of this key is one of CSR's legal addresses: 0002  5b  00a5a5.
As stated in the Bluetooth specification, LAP values from 9e8b00 up to, and including, 9e8b3f must not be used as this range is reserved for inquiry access codes (IACs).

Bluetooth module manufacturers must obtain their own block of addresses from the Bluetooth SIG/IEEE. If CSR's experience is typical, these authorities define the NAP and UAP, allowing manufacturers to set the 24-bit LAP.

对于某一种型号的手机或者设备,所有个体的NAP、UAP是固定的,可变的是LAP。

LAP共有24位,一般来说厂家在制造时会从0开始分配地址直到2的24次方,以保证个体之间地址的区别。

但是当产品数量太多,导致2的24次方都用完之后,或者在写地址的时候出了问题,就会出现蓝牙地址重复使用的情况, 但是概率非常小。

猜你喜欢

转载自blog.csdn.net/zhanghuaishu0/article/details/80990876