Bluetooth Beacon (Beacon)
A Bluetooth Beacon is a broadcast protocol built on top of the Bluetooth Low Energy (BLE) protocol.
A Beacon device, acting as a peripheral device in the Bluetooth Low Energy protocol, continuously broadcasts specific data packets containing the device identifier to its surroundings, but cannot establish a connection with a central device. The running device, acting as the central device, can receive the Beacon device's broadcast packets to enable data exchange. It is commonly used in scenarios such as indoor positioning and message push.
1. Device Identifier
Each Beacon device's broadcast packet carries at least the following information, which together form the device's unique identifier.
- UUID (16 bytes): A 128-bit UUID, used to uniquely identify a series of beacon devices.
- major (2 bytes): An unsigned integer from 0 to 65535, which can be used to distinguish a group of devices with the same UUID.
- minor (2 bytes): An unsigned integer from 0 to 65535, which can be used to distinguish devices with the same UUID and major.
2. Device Status
When a Beacon device's signal is received, the following information is also provided:
- rssi: Signal strength, in dBm.
- proximity: An enum value of the distance identified by the Beacon (iOS only).
- accuracy: The distance to the Beacon device, in meters.
3. Notes
- Beacon-related APIs can be used directly, without initializing the Bluetooth adapter module.
- Since Beacon can be used for positioning, it can only be used when the system location permission has been granted.
