Skip to content

Commit 802191f

Browse files
committed
Merge pull request ARMmbed#27 from andresag01/master
Fix BLE_Beacon demo and modify readme
2 parents 923e9d0 + c5567fd commit 802191f

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

BLE_Beacon/source/main.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@
1414
* limitations under the License.
1515
*/
1616

17-
#include "mbed.h"
17+
#include "mbed-drivers/mbed.h"
1818
#include "ble/BLE.h"
1919
#include "ble/services/iBeacon.h"
2020

21-
BLE ble;
21+
static iBeacon* ibeaconPtr;
2222

2323
/**
2424
* This function is called when the ble initialization process has failled
2525
*/
2626
void onBleInitError(BLE &ble, ble_error_t error)
2727
{
28-
// Initialization error handling should go here
28+
/* Initialization error handling should go here */
2929
}
3030

3131
/**
@@ -37,12 +37,12 @@ void bleInitComplete(BLE::InitializationCompleteCallbackContext *params)
3737
ble_error_t error = params->error;
3838

3939
if (error != BLE_ERROR_NONE) {
40-
// in case of error, forward the error handling to onBleInitError
40+
/* In case of error, forward the error handling to onBleInitError */
4141
onBleInitError(ble, error);
4242
return;
4343
}
4444

45-
// ensure that it is the default instance of BLE
45+
/* Ensure that it is the default instance of BLE */
4646
if(ble.getInstanceID() != BLE::DEFAULT_INSTANCE) {
4747
return;
4848
}
@@ -55,18 +55,19 @@ void bleInitComplete(BLE::InitializationCompleteCallbackContext *params)
5555
*
5656
* Note: please remember to calibrate your beacons TX Power for more accurate results.
5757
*/
58-
const uint8_t uuid[] = {0xE2, 0x0A, 0x39, 0xF4, 0x73, 0xF5, 0x4B, 0xC4,
59-
0xA1, 0x2F, 0x17, 0xD1, 0xAD, 0x07, 0xA9, 0x61};
58+
static const uint8_t uuid[] = {0xE2, 0x0A, 0x39, 0xF4, 0x73, 0xF5, 0x4B, 0xC4,
59+
0xA1, 0x2F, 0x17, 0xD1, 0xAD, 0x07, 0xA9, 0x61};
6060
uint16_t majorNumber = 1122;
6161
uint16_t minorNumber = 3344;
6262
uint16_t txPower = 0xC8;
63-
iBeacon ibeacon(ble, uuid, majorNumber, minorNumber, txPower);
63+
ibeaconPtr = new iBeacon(ble, uuid, majorNumber, minorNumber, txPower);
6464

6565
ble.gap().setAdvertisingInterval(1000); /* 1000ms. */
6666
ble.gap().startAdvertising();
6767
}
6868

69-
void app_start(int argc, char *argv[])
69+
void app_start(int, char**)
7070
{
71+
BLE &ble = BLE::Instance();
7172
ble.init(bleInitComplete);
7273
}

BLE_EddystoneService/module.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "ble-eddystonebeaconexperimental",
2+
"name": "ble-eddystoneservice",
33
"version": "0.0.1",
44
"description": "This example demonstrates how to set up and initialize a Eddystone Beacon.",
55
"licenses": [

BLE_EddystoneService/readme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ and reset the device.
5353
If your target has very tight memory constraints, you can modify the `config.json`
5454
to suit your needs. For instance, by changing the SoftDevice from S130 to S110.
5555

56+
*NOTE:* This demo is known to fail if you are building the application for nRF51-based
57+
16K targets using the SoftDevice 130 (S130). This is because the program runs out of memory.
58+
To fix this problem, before you build the software open the `config.json` and change the
59+
“softdevice” to “S110”.
60+
5661
Checking for Success
5762
====================
5863

0 commit comments

Comments
 (0)