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:
mbed_official
Date:
Thu Jul 28 23:14:36 2016 +0100
Revision:
1:9db4d46bb63f
Parent:
0:4c8f8bf32a99
Child:
2:9ee673e0b86a
Merge branch 'master' of https://github.com/ARMmbed/mbed-os-example-ble


Commit copied from ./src/github.com/ARMmbed/mbed-os-example-ble

Who changed what in which revision?

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