NQ62X BLE_DOORCTL_4CH

Committer:
sog_yang
Date:
Mon Jan 16 14:16:03 2017 +0000
Revision:
0:1eec8720727a
NQ62X BLE DOORCTL 4CH project init

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sog_yang 0:1eec8720727a 1 This example creates and updates a standard Battery Level service containing a single
sog_yang 0:1eec8720727a 2 GATT characteristic.
sog_yang 0:1eec8720727a 3
sog_yang 0:1eec8720727a 4 The [battery service transmits](https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.battery_service.xml) a device's battery level in percentage, with 100% being a fully charged battery and 0% being a fully drained battery.
sog_yang 0:1eec8720727a 5
sog_yang 0:1eec8720727a 6 Although the sample application runs on a BLE device, it doesn't show the device's real battery level (because that changes very slowly and will make for a dull example). Instead, it transmits a fake battery level that starts at 50% (half charged). Every half second, it increments the battery level, going in single increments until reaching 100% (as if the battery is charging). It then drops down to 20% to start incrementing again.
sog_yang 0:1eec8720727a 7
sog_yang 0:1eec8720727a 8 # Running the application
sog_yang 0:1eec8720727a 9
sog_yang 0:1eec8720727a 10 ## Requirements
sog_yang 0:1eec8720727a 11
sog_yang 0:1eec8720727a 12 The sample application can be seen on any BLE scanner on a smartphone. If you don't have a scanner on your phone, please install :
sog_yang 0:1eec8720727a 13
sog_yang 0:1eec8720727a 14 - [nRF Master Control Panel](https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp) for Android.
sog_yang 0:1eec8720727a 15
sog_yang 0:1eec8720727a 16 - [LightBlue](https://itunes.apple.com/gb/app/lightblue-bluetooth-low-energy/id557428110?mt=8) for iPhone.
sog_yang 0:1eec8720727a 17
sog_yang 0:1eec8720727a 18 Hardware requirements are in the [main readme](https://github.com/ARMmbed/mbed-os-example-ble/blob/master/README.md).
sog_yang 0:1eec8720727a 19
sog_yang 0:1eec8720727a 20 ## Building instructions
sog_yang 0:1eec8720727a 21
sog_yang 0:1eec8720727a 22 Building instructions for all samples are in the [main readme](https://github.com/ARMmbed/mbed-os-example-ble/blob/master/README.md).
sog_yang 0:1eec8720727a 23
sog_yang 0:1eec8720727a 24 ## Checking for success
sog_yang 0:1eec8720727a 25
sog_yang 0:1eec8720727a 26 **Note:** Screens captures depicted below show what is expected from this example if the scanner used is *nRF Master Control Panel* version 4.0.5. If you encounter any difficulties consider trying another scanner or another version of nRF Master Control Panel. Alternative scanners may require reference to their manuals.
sog_yang 0:1eec8720727a 27
sog_yang 0:1eec8720727a 28 1. Build the application and install it on your board as explained in the building instructions.
sog_yang 0:1eec8720727a 29 1. Open the BLE scanner on your phone.
sog_yang 0:1eec8720727a 30 1. Start a scan.
sog_yang 0:1eec8720727a 31
sog_yang 0:1eec8720727a 32 ![](img/start_scan.png)
sog_yang 0:1eec8720727a 33
sog_yang 0:1eec8720727a 34 **figure 1** How to start scan using nRF Master Control Panel 4.0.5
sog_yang 0:1eec8720727a 35
sog_yang 0:1eec8720727a 36 1. Find your device; it should be named `BATTERY`.
sog_yang 0:1eec8720727a 37
sog_yang 0:1eec8720727a 38 ![](img/scan_result.png)
sog_yang 0:1eec8720727a 39
sog_yang 0:1eec8720727a 40 **figure 2** Scan results using nRF Master Control Panel 4.0.5
sog_yang 0:1eec8720727a 41
sog_yang 0:1eec8720727a 42 1. Establish a connection with your device.
sog_yang 0:1eec8720727a 43
sog_yang 0:1eec8720727a 44 ![](img/connection.png)
sog_yang 0:1eec8720727a 45
sog_yang 0:1eec8720727a 46 **figure 3** How to establish a connection using Master Control Panel 4.0.5
sog_yang 0:1eec8720727a 47
sog_yang 0:1eec8720727a 48 1. Discover the services and the characteristics on the device. The *Battery service* has the UUID 0x180F and includes the *Battery level* characteristic which has the UUID 0x2A19.
sog_yang 0:1eec8720727a 49
sog_yang 0:1eec8720727a 50 ![](img/discovery.png)
sog_yang 0:1eec8720727a 51
sog_yang 0:1eec8720727a 52 **figure 4** Representation of the Battery service using Master Control Panel 4.0.5
sog_yang 0:1eec8720727a 53
sog_yang 0:1eec8720727a 54 1. Register for the notifications sent by the *Battery level* characteristic.
sog_yang 0:1eec8720727a 55
sog_yang 0:1eec8720727a 56 ![](img/register_to_notifications.png)
sog_yang 0:1eec8720727a 57
sog_yang 0:1eec8720727a 58 **figure 5** How to register to notifications using Master Control Panel 4.0.5
sog_yang 0:1eec8720727a 59
sog_yang 0:1eec8720727a 60
sog_yang 0:1eec8720727a 61 1. You should see the battery level value change every half second. It begins at 50, goes up to 100 (in steps of 1), resets to 20 and so on.
sog_yang 0:1eec8720727a 62
sog_yang 0:1eec8720727a 63 ![](img/notifications.png)
sog_yang 0:1eec8720727a 64
sog_yang 0:1eec8720727a 65 **figure 6** Notifications view using Master Control Panel 4.0.5
sog_yang 0:1eec8720727a 66
sog_yang 0:1eec8720727a 67 If you can see the characteristic, and if its value is incrementing correctly, the application is working properly.
sog_yang 0:1eec8720727a 68