This helper class helps to configure and parse BLE GAP advertisement packets.
BLE peripherals advertises information about their capabilities and other information in advertisement packets. The packet is of finite length, but the format is very flexible.
This class helps you to create several common advertisement formats, e.g. ibeacon:
LBLEAdvertisementData beaconData;
// This is a common AirLocate example UUID.
LBLEUuid uuid("E2C56DB5-DFFB-48D2-B060-D0F5A71096E0");
beaconData.configAsIBeacon(uuid, 01, 02, -40);
You can then simply call LBLEPeripheral.advertise to start advertise.
Constructors
LBLEAdvertisementData()
Creates an LBLEAdvertisementData instance.
Syntax
Parameters
none
Returns
none
Methods
configAsConnectableDevice()
configAsEddystoneURL()
configAsIBeacon()
Create an advertisement that allows BLE centrals, e.g. smartphones, to connect to this device.
This methods RESETS all the advertisement data fields
Note that you need to define corresponding GATT services with LBLEPeripheral before start advertising your device.
Syntax
Parameters
deviceName: must be shorter than 27 bytes.
serviceUUID: service UUID to be included in advertisement.
Returns
none
Configure an Eddystone URL Note that total length must not exceed 17 bytes.
You can use prefix, suffix, and tail parameters to compress common URL parts to a single byte. e.g. "https://www.mediatek.com" => configAsEddystoneURL(EDDY_HTTPS_WWW, "mediatek", EDDY_DOT_COM) e.g. "https://www.asp.net/learn" => configAsEddystoneURL(EDDY_HTTPS_WWW, "asp", EDDY_DOT_NET_SLASH, "learn")