BLE EddystoneService example

This example is a fork of the following mbed-os example:

https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-ble-EddystoneService/

Please read the documentation in this page.

Committer:
Vincent Coubard
Date:
Tue Jul 26 14:40:25 2016 +0100
Revision:
0:4c8f8bf32a99
Child:
1:9db4d46bb63f
Update example at tag mbed-os-5.0.1-rc1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Vincent Coubard 0:4c8f8bf32a99 1 Eddystone beacons broadcast a small amount of information, like URLs, to nearby BLE devices.
Vincent Coubard 0:4c8f8bf32a99 2
Vincent Coubard 0:4c8f8bf32a99 3 The Eddystone Beacon sample application runs in two stages:
Vincent Coubard 0:4c8f8bf32a99 4
Vincent Coubard 0:4c8f8bf32a99 5 1. On startup, the Configuration Service (which allows [modification of the beacon](https://github.com/google/eddystone/blob/master/eddystone-url/docs/config-service-spec.md)) runs for a user-defined period (default - 30 seconds).
Vincent Coubard 0:4c8f8bf32a99 6
Vincent Coubard 0:4c8f8bf32a99 7 1. When the Configuration Service period ends, the Eddystone Service broadcasts advertisement packets.
Vincent Coubard 0:4c8f8bf32a99 8
Vincent Coubard 0:4c8f8bf32a99 9
Vincent Coubard 0:4c8f8bf32a99 10
Vincent Coubard 0:4c8f8bf32a99 11 # Running the application
Vincent Coubard 0:4c8f8bf32a99 12
Vincent Coubard 0:4c8f8bf32a99 13 ## Requirements
Vincent Coubard 0:4c8f8bf32a99 14
Vincent Coubard 0:4c8f8bf32a99 15 You should install the *Physical Web* application on your phone:
Vincent Coubard 0:4c8f8bf32a99 16
Vincent Coubard 0:4c8f8bf32a99 17 - [Android version](https://play.google.com/store/apps/details?id=physical_web.org.physicalweb)
Vincent Coubard 0:4c8f8bf32a99 18
Vincent Coubard 0:4c8f8bf32a99 19 - [iOS version](https://itunes.apple.com/us/app/physical-web/id927653608?mt=8)
Vincent Coubard 0:4c8f8bf32a99 20
Vincent Coubard 0:4c8f8bf32a99 21
Vincent Coubard 0:4c8f8bf32a99 22 **Note:** It is also possible to use a regular scanner to interract with your Eddystone beacon but it requires
Vincent Coubard 0:4c8f8bf32a99 23 knowledge about BLE and Eddystone beacon specification out of the scope of this document.
Vincent Coubard 0:4c8f8bf32a99 24
Vincent Coubard 0:4c8f8bf32a99 25
Vincent Coubard 0:4c8f8bf32a99 26 Hardware requirements are in the [main readme](https://github.com/ARMmbed/mbed-os-example-ble/blob/master/README.md).
Vincent Coubard 0:4c8f8bf32a99 27
Vincent Coubard 0:4c8f8bf32a99 28 ## Building instructions
Vincent Coubard 0:4c8f8bf32a99 29
Vincent Coubard 0:4c8f8bf32a99 30 Building instructions for all samples are in the [main readme](https://github.com/ARMmbed/mbed-os-example-ble/blob/master/README.md).
Vincent Coubard 0:4c8f8bf32a99 31
Vincent Coubard 0:4c8f8bf32a99 32 ### Working with nRF51-based 16K targets
Vincent Coubard 0:4c8f8bf32a99 33
Vincent Coubard 0:4c8f8bf32a99 34 Because of memory constraints, you can't use the SoftDevice 130 (S130) to build for nRF51-based 16K targets. If you are using these targets, then before building:
Vincent Coubard 0:4c8f8bf32a99 35
Vincent Coubard 0:4c8f8bf32a99 36 1. Open the ``config.json`` file in this sample.
Vincent Coubard 0:4c8f8bf32a99 37 1. Change ``soft device`` to ``S110``.
Vincent Coubard 0:4c8f8bf32a99 38 1. Save.
Vincent Coubard 0:4c8f8bf32a99 39
Vincent Coubard 0:4c8f8bf32a99 40 You can now build for nRF51-based 16K targets.
Vincent Coubard 0:4c8f8bf32a99 41
Vincent Coubard 0:4c8f8bf32a99 42 ## Setting up the beacon
Vincent Coubard 0:4c8f8bf32a99 43
Vincent Coubard 0:4c8f8bf32a99 44 By default, the beacon directs to the url ``http://mbed.org``. You can change this to your own URL in two ways:
Vincent Coubard 0:4c8f8bf32a99 45
Vincent Coubard 0:4c8f8bf32a99 46 1. Manually edit the code in ``main.cpp`` in your copy of the sample.
Vincent Coubard 0:4c8f8bf32a99 47
Vincent Coubard 0:4c8f8bf32a99 48 1. Build and run the application's default code as explained in the building instructions. When the beacon starts up, the Configuration Service runs for 30 seconds (this is the default value; you can change it in ``main.cpp``). While the Configuration Service runs, you can use a BLE scanner on your phone to edit the values the service presents.
Vincent Coubard 0:4c8f8bf32a99 49
Vincent Coubard 0:4c8f8bf32a99 50 ## Checking for success
Vincent Coubard 0:4c8f8bf32a99 51
Vincent Coubard 0:4c8f8bf32a99 52 1. Build the application and install it on your board as explained in the building instructions.
Vincent Coubard 0:4c8f8bf32a99 53
Vincent Coubard 0:4c8f8bf32a99 54 1. Open the *Physical Web* application on your phone. It will start to search for nearby beacons.
Vincent Coubard 0:4c8f8bf32a99 55
Vincent Coubard 0:4c8f8bf32a99 56 ![](img/app_start.png)
Vincent Coubard 0:4c8f8bf32a99 57
Vincent Coubard 0:4c8f8bf32a99 58 **figure 1** Start of the *Physical Web* application version 0.1.856 on Android
Vincent Coubard 0:4c8f8bf32a99 59
Vincent Coubard 0:4c8f8bf32a99 60 1. When the beacon starts up, the Configuration Service runs for 30 seconds.
Vincent Coubard 0:4c8f8bf32a99 61 During this time it is possible to change the URL advertised by the beacon.
Vincent Coubard 0:4c8f8bf32a99 62 It is also important to note that during these 30 seconds, your device will not advertise any URL.
Vincent Coubard 0:4c8f8bf32a99 63
Vincent Coubard 0:4c8f8bf32a99 64 ![](img/open_configuration.png)
Vincent Coubard 0:4c8f8bf32a99 65
Vincent Coubard 0:4c8f8bf32a99 66 **figure 2** How to open the beacon configuration view using the *Physical Web* application version 0.1.856 on Android
Vincent Coubard 0:4c8f8bf32a99 67
Vincent Coubard 0:4c8f8bf32a99 68
Vincent Coubard 0:4c8f8bf32a99 69 1. Edit the URL advertised by your beacon.
Vincent Coubard 0:4c8f8bf32a99 70
Vincent Coubard 0:4c8f8bf32a99 71 ![](img/edit_url.png)
Vincent Coubard 0:4c8f8bf32a99 72
Vincent Coubard 0:4c8f8bf32a99 73 **figure 3** How to edit the URL advertised by your beacon using the *Physical Web* application version 0.1.856 on Android
Vincent Coubard 0:4c8f8bf32a99 74
Vincent Coubard 0:4c8f8bf32a99 75
Vincent Coubard 0:4c8f8bf32a99 76 1. Save the URL which will be advertised by your beacon.
Vincent Coubard 0:4c8f8bf32a99 77
Vincent Coubard 0:4c8f8bf32a99 78 ![](img/save_url.png)
Vincent Coubard 0:4c8f8bf32a99 79
Vincent Coubard 0:4c8f8bf32a99 80 **figure 4** How to save your beacon configuration and start advertising URL using the *Physical Web* application version 0.1.856 on Android.
Vincent Coubard 0:4c8f8bf32a99 81
Vincent Coubard 0:4c8f8bf32a99 82
Vincent Coubard 0:4c8f8bf32a99 83 1. Find your device; it should advertise the URL you have set.
Vincent Coubard 0:4c8f8bf32a99 84
Vincent Coubard 0:4c8f8bf32a99 85 ![](img/result.png)
Vincent Coubard 0:4c8f8bf32a99 86
Vincent Coubard 0:4c8f8bf32a99 87 **figure 5** Display of URL advertised by your beacon using the *Physical Web* application version 0.1.856 on Android.
Vincent Coubard 0:4c8f8bf32a99 88
Vincent Coubard 0:4c8f8bf32a99 89
Vincent Coubard 0:4c8f8bf32a99 90 **Note:** You can use the [Eddystone Observer](https://github.com/ARMmbed/mbed-os-example-ble/tree/master/BLE_EddystoneObserver) sample instead of a phone application.