Written by: John Murray
Eddystone is probably the most famous lighthouse in the British Isles, built on a small and very dangerous rock 13 miles south west of Plymouth, it has been protecting shipping and sailors since 1698.
It’s fitting then that Google chose “Eddystone” as the name of its recently published Eddystone Beacon Specification as an alternative to the older and more established Apple, iBeacon specification.
Having blogged extensively and written a variety of resources for developers such as code samples and Cordova Plugins allowing BlackBerry 10 and other platforms to interact with beacons it seemed to me that it should be relatively simple to demonstrate that BlackBerry 10 was also capable of supporting Eddystone Beacons in applications.
This is the story of this challenge. If you want to skip forward the code sample that demonstrates how to use Eddystone in BlackBerry 10 applications can be found here; it’s an extension of an earlier code sample: WheresMyBeacon, that I wrote.
What is Eddystone Anyway?
I’m not going to repeat the details of the specification, which you can find here; rather let’s, first compare Eddystone with the Apple iBeacon.
An Apple iBeacon frame is carried in a standard Bluetooth Low Energy Advertising frame. In particular it’s embedded in the Manufacturer’s Field, and specifically it’s contained in the Apple proprietary Manufacturing Data itself. It contains 4 elements: a unique identifier in the form of a UUID and two integer fields (Major and Minor numbers) and an indication of the calibrated transmitted power measured in dBm at 1m from the iBeacon. The power measurement allows you to estimate distances since you know the measured power received in the receiving device.
On BlackBerry 10 and Android you can directly detect these advertising frames and have your application act upon them. On iOS direct access to the specific iBeacon form of frame is forbidden and all aspects of iBeacon detection are handled through the Location APIs.
Eddystone uses the same Bluetooth Low Energy Advertising frame as iBeacon; however, rather than use the Manufacturer’s Field it embeds its payload in a standard Service Description field using an Eddystone service UUID that has the 16-bit value of 0xFEAA. Rather than simply advertising a single form of field, as iBeacon does, it transmits a sequence of three message types:
- A UID message – this is similar to an iBeacon in that it contains two fields used to uniquely identify the beacon:
- Namespace: A 10 byte field
- Instance Id: A 6 byte field
- A URL message – this is an encoding of a standard URL like, say: http://www.blackberry.com
- A TLM message – this contains telemetry data about the beacon with information like its temperature and battery voltage.
There seems to be no requirement to transmit all three types. TLM messages seem to be always transmitted but fairly infrequently whilst you may choose to transmit only UID or URL messages, or perhaps both depending on the application.
The URL message is a useful extension over iBeacon allowing a beacon to advertise a URL that can be detected and linked to. The TLM message is useful to determine when the battery needs replacing.
Getting My Hands on a Real Eddystone Beacon
The next step in any investigation like this is to acquire some hardware; namely an Eddystone Beacon. Luckily I’ve got a number of Estimote beacons lying around and these nice people at Estimote had just published a new set of firmware for their beacons that would upgrade them to be Eddystone-capable! Nice!
The upgrade over the air was quite simple to perform and I soon had an Eddystone Beacon advertising quite happily – here’s what I saw for the UID type message:
It all looked good as per the specification and it was quite easy to parse this data in the BlackBerry 10 application.
I did the same thing for the URL and TLM frames and modified the application’s UI to display the content in a simple manner.
Here’s a screenshot from the application of the Eddystone Beacon UID frame. You can see the
Namespace and Instance Id fields as well as the calibrated power reported in dBm and the path loss in dB, which can be mapped to distance.
Here’s a screenshot from the application of the Eddystone Beacon URL frame. You can see I’ve programmed the beacon with the URL http://www.blackberry.com. Notice that this frame also reports the calibrated power reported in dBm and the path loss in dB, which can be mapped to distance.
Here’s a screenshot from the application of the Eddystone Beacon TLM frame. I’ve broken out the battery voltage that shows a healthy 3.15 Volts and the beacon temperature that is running quite cool at 28.5 C. I haven’t displayed the various other fields and leave that as an exercise for the reader.
One of Google’s objectives for Eddystone was that it:
- Works well with Android and iOS Bluetooth developer APIs
I think I’ve successfully demonstrated that it works well with BlackBerry 10 Bluetooth developer APIs as well!
I’ve released v2.2.0 of the WheresMyBeacon application containing the features described in this article and so you can download, review and reuse the full source code – you can find the URL in the “Resources” section below. I hope this has been interesting and will help set you on your way developing real-world event driven Bluetooth applications for Blackberry 10.
Please feel free to contact me, @jcmrim, via Twitter if you need any help on anything Bluetooth Smart.
Other links you may find useful:
BlackBerry Bluetooth LE Developer Resource Index Page
John Murray – @jcmrim