Adding iBeacon Data

Author Gravatar Image KEVIN TOWNSEND
In the 'bluez-5.11' folder that we previously created, we can start entering the mandatory iBeacon data and advertising it using hcitool, which we built when compiling Bluez.

1. Check for your USB Module

This should give you a list of devices on your system:
Copy Code
tools/hciconfig
If everything is properly configure you will see your Bluetooth 4.0 USB Module like this:

2. Enable the USB Device

Next you can enable the device with the following commands, turning off device scanning since this can cause problems when advertising:
Copy Code
sudo tools/hciconfig hciO up
sudo tools/hciconfig hci0 leadv
sudo tools/hciconfig hci0 noscan
Then run the hciconfig tool again and you should see that the device is marked as UP and RUNNING:
Copy Code
tools/hciconfig

3. Enter the iBeacon Advertising Data

The last thing to do is to enter the iBeacon advertising data, which we can do with the following command (which should all be on one line):
Copy Code
sudo tools/hcitool -i hci0 cmd 0x08 0x0008 1E 02 01 1A 1A 
FF 4C 00 02 15 E2 0A 39 F4 73 F5 4B C4 A1 2F 17 D1 AD 07 A9 61 00 00 00 00 C8 00
FF identifies the start of the Manufacturer Specific Data, 4C 00 is Apple's company ID (0x004C), and then you can see the reset of the iBeacon payload until C8.

Results on a Bluetooth Debugger

Just to show that this actually works, you can see the results using a Bluetooth Low Energy sniffer below:
And here is the raw advertising frame from a different sniffer:
Last updated on 2014-04-25 at 12.16.02 AM Published on 2013-12-04 at 05.56.46 PM