prod

Dependencies:   BLE_API mbed nRF51822 X_NUCLEO_IDB0XA1

Fork of BLE_EddystoneBeacon_Service by Bluetooth Low Energy

Revision:
30:6c2db8bf5b17
Parent:
29:dfb7fb5a971b
Child:
31:bdd03742096a
--- a/main.cpp	Fri Jul 24 03:36:45 2015 +0000
+++ b/main.cpp	Fri Jul 24 04:07:34 2015 +0000
@@ -21,12 +21,34 @@
 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[] = "www.mbed.org";
+char Url[] = "http://www.mbed.org";
+int8_t txPower = -18;
+uint16_t beaconPeriodus = 1000;
+
+//Callbacks for temperature / battery updates
+Ticker tlmBattery;
+Ticker tlmTemperature;
+int battery = 0;
+int temp = 0;
+
+// Start the Eddystone beacon here
+EddystoneService eddyBeacon(ble, beaconPeriodus, txPower ,UIDnamespace, UIDinstance, Url, sizeof(Url));
+
+// Function to update beacon battery voltage
+void tlmBatteryCallback(void){
+    eddyBeacon.updateTlmBatteryVoltage(battery++);
+}
+
+// Function to update Beacon Temperature
+void tlmTemperatureCallback(void){
+    eddyBeacon.updateTlmBeaconTemp(temp++);
+}
 
 int main(void)
 {
     printf("Starting Example\r\n");
-    EddystoneService eddyBeacon(ble, 1000, 10,UIDnamespace, UIDinstance, "http://www.mbed.org", sizeof("http://www.mbed.org"));
+    tlmTemperature.attach(tlmTemperatureCallback,2.0f);
+    tlmBattery.attach(tlmBatteryCallback, 1.0f);
     printf("Running...\r\n");
     while (true) {
         ble.waitForEvent();