updated length test in writeLockState and fixed last of the compile issues

Committer:
roywant
Date:
Mon Sep 19 00:59:11 2016 +0000
Revision:
0:ed0152b5c495
Initial commit

Who changed what in which revision?

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