A beacon is a Bluetooth Low Energy device including some information in its advertising data.
Working with beacons requires code to read the beacons and some setup to ensure you read only the right beacons, especially as more and more are appearing! This article mainly focuses on the latter and what you should be aware of before you deploy your beacons.
Programming for iBeacons & AltBeacons
While you can code to work with beacons via a number of languages, RAD Studio XE8 has introduces a new multi-platform component for working with beacons – as covered in this post from Sarina DuPont – this is very cool making it super easy to have both Android and iOS and Mac applications running from common code. However this is out of the scope of this post.
I will however point you to the sample projects shipped with RAD Studio XE8 using both Delphi and C++ in the following samples folder which can be opened directly using the shortcut to the samples in the IDE.
There is also great detail about what beacons are in DocWiki
<Samples>\<language>\Mobile Samples\Device Sensors and Services\Bluetooth\Beacons
Getting started with Beacon Hardware
So what do I need to know about beacons?
Firstly, beacons are typically following 2 standards for broadcasting over Bluetooth 4.
- iBeacons from Apple (and requires a license if you want to create physical beacons yourself)
- AltBeacons which is an open standard
Using these standards you can pick up data to identify a specific beacon and how far it is away. The 4 key bits of information to manage this are
- Major ID
- Minor ID
Using the new Beacons component you can define which type of beacon(s) you want to scan for using the UUID as a filter, and optionally Major and Minor ID – and this brings us onto the importance of the UUID
By default the UUID is set based on the beacon manufacturer. If you are going to use beacons in a real world application then you will probably want to update the UUID to a unique ID that you will be scanning for. This way you can limit any other beacons that are deployed.
Beacon Major and Minor
Beacon Major and Minor ID’s are used to identify the specific location you want to indicate with the Beacon. Hence its important that you update the UUID so you read only the correct beacons to check for the location you are at.
An example would be using the major to identify a retail store and a minor to a specific area in the retail store.
Programming the Beacon
There are a number of beacon manufacturers out there, and its typically easy to re-program your beacon to have that unique UUID and then set the Major and Minor ID’s.
Once such beacon is the RadBeacon from Radius Networks
Radius Networks provide a useful Beacon config application that you can download for free (once you register)
The default pin for editing the beacons is 0000.
Requirements for the Config App
For the software requirements visit the Beacon config application home page. In short, Bluetooth 4 is a minimum and Mac (10.9+) or recent iOS / Android releases.
Securing your Beacons….
Before you deploy your beacons, you may want to secure your beacon from tampering.
It is suggested by Radius networks that you lock your beacon before its put into a live environment. Locking a beacon prevents any further editing over bluetooth, so you need to be sure of your config before you do this.
A little less radical is updating the pin code for editing the beacon, however this is easily cracked so really only ideal for short term setup.
More about what the different options on the config application do are available here: http://www.radiusnetworks.com/ibeacon/radbeacon/mac/2-0-0/help.html