
Send continuous stream to mobile
Fork of pdiot-ble-notify-array by
Revision 1:cd85f873e10d, committed 2016-07-28
- Comitter:
- mbed_official
- Date:
- Thu Jul 28 23:14:28 2016 +0100
- Parent:
- 0:3fe9d5124576
- Child:
- 2:2be0a2820d3d
- Commit message:
- Merge branch 'master' of https://github.com/ARMmbed/mbed-os-example-ble
Commit copied from ./src/github.com/ARMmbed/mbed-os-example-ble
Changed in this revision
--- a/.mbed Tue Jul 26 14:37:15 2016 +0100 +++ b/.mbed Thu Jul 28 23:14:28 2016 +0100 @@ -1,1 +1,1 @@ -ROOT=. +ROOT=.
--- a/.mbedignore Tue Jul 26 14:37:15 2016 +0100 +++ b/.mbedignore Thu Jul 28 23:14:28 2016 +0100 @@ -1,4 +1,4 @@ -mbed-os/features/net/* -mbed-os/uvisor-mbed-lib/* -mbed-os/frameworks/* -mbed-os/features/mbedtls/* +mbed-os/features/net/* +mbed-os/uvisor-mbed-lib/* +mbed-os/frameworks/* +mbed-os/features/mbedtls/*
--- a/mbed-events.lib Tue Jul 26 14:37:15 2016 +0100 +++ b/mbed-events.lib Thu Jul 28 23:14:28 2016 +0100 @@ -1,1 +1,1 @@ -https://github.com/ARMmbed/mbed-events.git#c621d7f80bb282ab1814e727f9c4f81a8538bf6f +https://github.com/ARMmbed/mbed-events.git#6be60bf880c11a0beafcc2064bf467f8d897529a
--- a/mbed-os.lib Tue Jul 26 14:37:15 2016 +0100 +++ b/mbed-os.lib Thu Jul 28 23:14:28 2016 +0100 @@ -1,1 +1,1 @@ -https://github.com/mbedmicro/mbed#5fea6e69ec1aec4c56852f2e959002dc815eb480 +https://github.com/mbedmicro/mbed#36468c9acbfeabb717d2cc7d2a7ea7d17df1ac09
--- a/mbed_app.json Tue Jul 26 14:37:15 2016 +0100 +++ b/mbed_app.json Thu Jul 28 23:14:28 2016 +0100 @@ -1,13 +1,13 @@ -{ - "target_overrides": { - "K64F": { - "target.features_add": ["BLE"], - "target.extra_labels_add": ["ST_BLUENRG"], - "target.macros_add": ["IDB0XA1_D13_PATCH"] - }, - "NUCLEO_F401RE": { - "target.features_add": ["BLE"], - "target.extra_labels_add": ["ST_BLUENRG"] - } - } -} +{ + "target_overrides": { + "K64F": { + "target.features_add": ["BLE"], + "target.extra_labels_add": ["ST_BLUENRG"], + "target.macros_add": ["IDB0XA1_D13_PATCH"] + }, + "NUCLEO_F401RE": { + "target.features_add": ["BLE"], + "target.extra_labels_add": ["ST_BLUENRG"] + } + } +}
--- a/module.json Tue Jul 26 14:37:15 2016 +0100 +++ b/module.json Thu Jul 28 23:14:28 2016 +0100 @@ -1,15 +1,15 @@ -{ - "name": "ble-button", - "version": "0.0.1", - "description": "The *input service template* demonstrates the use of a simple input (boolean values) from a read-only characteristic.", - "licenses": [ - { - "url": "https://spdx.org/licenses/Apache-2.0", - "type": "Apache-2.0" - } - ], - "bin": "./source", - "dependencies": { - "ble": "^2.0.0" - } -} +{ + "name": "ble-button", + "version": "0.0.1", + "description": "The *input service template* demonstrates the use of a simple input (boolean values) from a read-only characteristic.", + "licenses": [ + { + "url": "https://spdx.org/licenses/Apache-2.0", + "type": "Apache-2.0" + } + ], + "bin": "./source", + "dependencies": { + "ble": "^2.0.0" + } +}
--- a/readme.md Tue Jul 26 14:37:15 2016 +0100 +++ b/readme.md Thu Jul 28 23:14:28 2016 +0100 @@ -1,79 +1,79 @@ -BLE_Button is a BLE service template. It handles a read-only characteristic with a simple input (boolean values). The input's source is the button on the board itself - the characteristic's value changes when the button is pressed or released. - -The template covers: - -1. Setting up advertising and connection modes. - -1. Creating an input characteristic: read-only, boolean, with notifications. - -1. Constructing a service class and adding it to the BLE stack. - -1. Assigning UUIDs to the service and its characteristic. - -1. Pushing notifications when the characteristic's value changes. - -# Running the application - -## Requirements - -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 : - -- [nRF Master Control Panel](https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp) for Android. - -- [LightBlue](https://itunes.apple.com/gb/app/lightblue-bluetooth-low-energy/id557428110?mt=8) for iPhone. - -Hardware requirements are in the [main readme](https://github.com/ARMmbed/mbed-os-example-ble/blob/master/README.md). - -## Building instructions - -Building instructions for all samples are in the [main readme](https://github.com/ARMmbed/mbed-os-example-ble/blob/master/README.md). - -## Checking for success - -**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. - -1. Build the application and install it on your board as explained in the building instructions. -1. Open the BLE scanner on your phone. -1. Start a scan. - -  - - **figure 1** How to start scan using nRF Master Control Panel 4.0.5 - -1. Find your device; it should appear with the name `Button` in the scanner. - -  - - **figure 2** Scan results using nRF Master Control Panel 4.0.5 - -1. Establish a connection with the device. - -  - - **figure 3** How to establish a connection using Master Control Panel 4.0.5 - -1. Discover the services and the characteristics on the device. The *Button service* has the UUID `0xA000` and includes the *Button state characteristic* which has the UUID `0xA001`. Depending on your scanner, non standard 16-bit UUID's can be displayed as 128-bit UUID's. If it is the case the following format will be used: `0000XXXX-0000-1000-8000-00805F9B34FB` where `XXXX` is the hexadecimal representation of the 16-bit UUID value. - -  - - **figure 4** Representation of the Button service using Master Control Panel 4.0.5 - -1. Register for the notifications sent by the button state characteristic then the scanner will automatically receive a notification containing the new state of the button every time the state of the button changes. - -  - - **figure 5** How to register to notifications using Master Control Panel 4.0.5 - - -1. Pressing Button 1 on your board updates the state of the button and sends a notification to the scanner. The new state of the button characteristic value should be equal to 0x01. - -  - - **figure 6** Notification of button pressed using Master Control Panel 4.0.5 - -1. Releasing Button 1 on your board updates the state of the button and sends a notification to the scanner. The new state of the button characteristic value should be equal to 0x00. - -  - - **figure 7** Notification of button depressed using Master Control Panel 4.0.5 - +BLE_Button is a BLE service template. It handles a read-only characteristic with a simple input (boolean values). The input's source is the button on the board itself - the characteristic's value changes when the button is pressed or released. + +The template covers: + +1. Setting up advertising and connection modes. + +1. Creating an input characteristic: read-only, boolean, with notifications. + +1. Constructing a service class and adding it to the BLE stack. + +1. Assigning UUIDs to the service and its characteristic. + +1. Pushing notifications when the characteristic's value changes. + +# Running the application + +## Requirements + +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 : + +- [nRF Master Control Panel](https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp) for Android. + +- [LightBlue](https://itunes.apple.com/gb/app/lightblue-bluetooth-low-energy/id557428110?mt=8) for iPhone. + +Hardware requirements are in the [main readme](https://github.com/ARMmbed/mbed-os-example-ble/blob/master/README.md). + +## Building instructions + +Building instructions for all samples are in the [main readme](https://github.com/ARMmbed/mbed-os-example-ble/blob/master/README.md). + +## Checking for success + +**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. + +1. Build the application and install it on your board as explained in the building instructions. +1. Open the BLE scanner on your phone. +1. Start a scan. + +  + + **figure 1** How to start scan using nRF Master Control Panel 4.0.5 + +1. Find your device; it should appear with the name `Button` in the scanner. + +  + + **figure 2** Scan results using nRF Master Control Panel 4.0.5 + +1. Establish a connection with the device. + +  + + **figure 3** How to establish a connection using Master Control Panel 4.0.5 + +1. Discover the services and the characteristics on the device. The *Button service* has the UUID `0xA000` and includes the *Button state characteristic* which has the UUID `0xA001`. Depending on your scanner, non standard 16-bit UUID's can be displayed as 128-bit UUID's. If it is the case the following format will be used: `0000XXXX-0000-1000-8000-00805F9B34FB` where `XXXX` is the hexadecimal representation of the 16-bit UUID value. + +  + + **figure 4** Representation of the Button service using Master Control Panel 4.0.5 + +1. Register for the notifications sent by the button state characteristic then the scanner will automatically receive a notification containing the new state of the button every time the state of the button changes. + +  + + **figure 5** How to register to notifications using Master Control Panel 4.0.5 + + +1. Pressing Button 1 on your board updates the state of the button and sends a notification to the scanner. The new state of the button characteristic value should be equal to 0x01. + +  + + **figure 6** Notification of button pressed using Master Control Panel 4.0.5 + +1. Releasing Button 1 on your board updates the state of the button and sends a notification to the scanner. The new state of the button characteristic value should be equal to 0x00. + +  + + **figure 7** Notification of button depressed using Master Control Panel 4.0.5 +
--- a/shields/TARGET_ST_BLUENRG.lib Tue Jul 26 14:37:15 2016 +0100 +++ b/shields/TARGET_ST_BLUENRG.lib Thu Jul 28 23:14:28 2016 +0100 @@ -1,1 +1,1 @@ -https://github.com/ARMmbed/ble-x-nucleo-idb0xa1#947ff7cf03846721ec9970f16d373390cbf71f39 +https://github.com/ARMmbed/ble-x-nucleo-idb0xa1#6781fbb835912132d7fed0d78606c7090ae03959
--- a/source/main.cpp Tue Jul 26 14:37:15 2016 +0100 +++ b/source/main.cpp Thu Jul 28 23:14:28 2016 +0100 @@ -97,7 +97,7 @@ int main() { - eventQueue.post_every(blinkCallback, 500); + eventQueue.post_every(500, blinkCallback); BLE &ble = BLE::Instance(); ble.onEventsToProcess(scheduleBleEventsProcessing);