Kenji Arai / Mbed 2 deprecated BLE_EddystoneBeacon_w_ACC_TY51822

Dependencies:   BLE_API LIS3DH mbed nRF51822 BMC050 nRF51_LowPwr nRF51_Vdd

Fork of BLE_EddystoneBeacon_Service by Bluetooth Low Energy

Files at this revision

API Documentation at this revision

Comitter:
mbedAustin
Date:
Thu Oct 01 16:28:22 2015 +0000
Parent:
31:bdd03742096a
Child:
33:862e6e0831ea
Commit message:
Updating example to comply with latest API changes

Changed in this revision

BLE_API.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
nRF51822.lib Show annotated file Show diff for this revision Revisions of this file
--- a/BLE_API.lib	Tue Aug 11 18:13:46 2015 +0000
+++ b/BLE_API.lib	Thu Oct 01 16:28:22 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/teams/Bluetooth-Low-Energy/code/BLE_API/#920101117187
+http://mbed.org/teams/Bluetooth-Low-Energy/code/BLE_API/#d494ad3e87bd
--- a/main.cpp	Tue Aug 11 18:13:46 2015 +0000
+++ b/main.cpp	Thu Oct 01 16:28:22 2015 +0000
@@ -1,5 +1,5 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2015 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -15,15 +15,18 @@
  */
 
 #include "mbed.h"
-#include "ble/BLE.h"
+#include "BLE.h"
 #include "ble/services/EddystoneService.h"
 
 BLE ble;
 uint8_t UIDnamespace[] = {0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99,0xAA}; // 10Bytes for Namespace UUID
 uint8_t UIDinstance[]  = {0xbb,0xcc,0xdd,0xee,0xff,0x00}; // 6Bytes for Instance UUID
 char Url[] = "http://www.mbed.org";
-int8_t txPower = -40;
+int8_t radioTxPower = 20;
+int8_t advTxPower = -20;
 uint16_t beaconPeriodus = 1000;
+uint8_t tlmVersion = 0x00;
+
 
 //Callbacks for temperature / battery updates
 Ticker tlmBattery;
@@ -31,24 +34,36 @@
 int battery = 0;
 int temp = 0;
 
-// Add Eddystone service to BLE device, can pass NULL for UID and URL parameters to disable those frames
-EddystoneService eddyBeacon(ble, beaconPeriodus, txPower ,UIDnamespace, UIDinstance, Url, sizeof(Url));
+// Setup Eddystone Service 
+EddystoneService eddyBeacon(ble,beaconPeriodus,radioTxPower);
 
-// Optional Function to update Eddystone beacon TLM frame battery voltage
+
+// Function to update beacon battery voltage
 void tlmBatteryCallback(void){
     eddyBeacon.updateTlmBatteryVoltage(battery++);
 }
 
-// Optional Function to update Eddystone beacon TLM frame temperature
+// Function to update Beacon Temperature
 void tlmTemperatureCallback(void){
     eddyBeacon.updateTlmBeaconTemp(temp++);
 }
 
 int main(void)
 {
-    printf("Starting Example\r\n");
+    printf("Starting Example\r\n"); // To enable low power mode disable all printf's
+
+    // Set Eddystone Frame Data (TLM,UID,URI...etc)
+    eddyBeacon.setTLMFrameData(tlmVersion,5.0);
+    eddyBeacon.setURLFrameData(advTxPower, Url, 2.0);
+    eddyBeacon.setUIDFrameData(advTxPower, UIDnamespace, UIDinstance, 3.0);
+    
+    // Attach functions to modify TLM data
     tlmTemperature.attach(tlmTemperatureCallback,2.0f);
     tlmBattery.attach(tlmBatteryCallback, 1.0f);
+
+    // Start Advertising the eddystone service. 
+    eddyBeacon.start(); 
+    
     printf("Running...\r\n");
     while (true) {
         ble.waitForEvent();
--- a/mbed.bld	Tue Aug 11 18:13:46 2015 +0000
+++ b/mbed.bld	Thu Oct 01 16:28:22 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/bad568076d81
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/4f6c30876dfa
\ No newline at end of file
--- a/nRF51822.lib	Tue Aug 11 18:13:46 2015 +0000
+++ b/nRF51822.lib	Thu Oct 01 16:28:22 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/teams/Nordic-Semiconductor/code/nRF51822/#041752486b03
+http://mbed.org/teams/Nordic-Semiconductor/code/nRF51822/#088f5738bf18