BLE协议栈中,GAP_ADDR_TYPE这四种类型分别对于什么地址,哪个对于MAC地址?这几种地址是什么一种关系?
addrType就是从机广播的地址类型
/** @defgroup GAP_ADDR_TYPE_DEFINES GAP Address Types
* @{
*/
#define ADDRTYPE_PUBLIC 0x00 //!< Use the BD_ADDR
#define ADDRTYPE_STATIC 0x01 //!< Static address
#define ADDRTYPE_PRIVATE_NONRESOLVE 0x02 //!< Generate Non-Resolvable Private Address
#define ADDRTYPE_PRIVATE_RESOLVE 0x03 //!< Generate Resolvable Private Address
/** @} End GAP_ADDR_TYPE_DEFINES */
看蓝牙协议标准core 4.0
1.3 DEVICE ADDRESS
Devices are identified using a device address. Device addresses may be either
a public device address or a random device address. A public device address
and a random device address are both 48 bits in length.
A device shall contain at least one type of device address and may contain
both.
The public device address shall be created in accordance with section 9.2 ("48-
bit universal LAN MAC addresses") of the IEEE 802-2001 standard (http://standards.
ieee.org/getieee802/download/802-2001.pdf) and using a valid Organizationally
Unique Identifier (OUI) obtained from the IEEE Registration Authority
(see http://standards.ieee.org/regauth/oui/forms/ and sections 9 and 9.1 of the
IEEE 802-2001 specification).
The public device address is divided into the following two fields:
• company_assigned field is contained in the 24 least significant bits
• company_id field is contained in the 24 most significant bits
The random device address is divided into the following two fields:
• hash field is contained in the 24 least significant bits, as defined in [Vol. 3]
Part C, Section 10.8.2.3.
• random field is contained in the 24 most significant bits, as defined in [Vol. 3]
Part C, Section 10.8.2.2.
再看10.8
10.8 RANDOM DEVICE ADDRESS
Random device addresses are defined in the Link Layer section in [Vol. 6], Part
B Section 1.3.
For the purposes of this profile, the random device address may be of either of
the following two sub-types:
• Static address
• Private address.
The term random device address refers to both static and private address
types.
The transmission of a random device address is optional. A device shall accept
the reception of a random device address from a remote device.
The private address may be of either of the following two sub-types:
• Non-resolvable private address
• Resolvable private address