问题
I am receiving EVT_LE_ADVERTISING_REPORT
from a HCI socket. I want to differentiate between a BLE beacon and normal BLE devices (resolving device names etc) I am little confused whether all BLE devices do emit beacons or they are different. If different then how is the packet format for them?
回答1:
A BLE beacon frame is just a specialized payload inside a BLE advertisement frame. Devices looking for BLE beacons simply perform a scan for BLE advertisements, look at each one, and see if any of them contain the byte pattern of a known BLE beacon format like iBeacon, AltBeacon or Eddystone.
Lots of BLE devices types emit advertisements, often to advertise GATT Services. But unless a device is specifically designed to be a BLE beacon, most BLE devices to not emit BLE beacon frames. A beacon is a specialized type of BLE device, albeit a very simple one.
Common BLE beacon formats use either a BLE service advertisement (Advertising Data type 0x16) or a BLE manufacturer advertisement (Advertising Data type 0xff). They then contain a byte sequence inside these packets that indicates to receivers they are a particular format. Following that byte pattern, they have several bytes dedicated to unique identifiers as well as data and a transmitter power calibration field.
Common beacon formats that use manufacturer advertisements include iBeacon and AltBeacon.
- AltBeacon format
- iBeacon format
Eddystone is a common beacon format that uses a service advertisement.
- Eddystone format
Non-beacon BLE devices also emit GATT Service Advertisements similar to the Eddystone format, but with a different Service UUID that indicates a particular service they offer. (E.g. a heartbeat monitor, or a smart watch configuration service.) However, instead of sending out data inside the advertisement itself, these non-beacon GATT Advertisements are typically used just to advertise their presence, so smartphones and computers can connect to them and exchange data using the more complex GATT service hosted by the device.
来源:https://stackoverflow.com/questions/52304338/is-there-a-difference-between-a-ble-broadcast-frame-and-ble-beacon-frame