HoT with iBeacon

Dependencies:   microbit-iBeacon

Fork of BTW_Eddystone_Solution1 by Ken Ogami

Beacon Hands-on-Training solution code using Eddystone URL and iBeacon formats.

Libraries microbit-iBeacon -> microbit-dal-iBeacon

Includes classes for Eddystone and iBeacon. Eddystone only supports URL and UID formats, not TLM.

Revision:
11:6505399afe76
Parent:
10:0b4b38de17b3
Child:
12:3c732fa25692
--- a/main.cpp	Mon Oct 16 22:25:57 2017 +0000
+++ b/main.cpp	Tue Oct 17 21:11:43 2017 +0000
@@ -4,6 +4,7 @@
 
 Serial pcCom(USBTX, USBRX);
 
+// TODO: global data and functions
 char URL[] = "https://www.bluetooth.com";
 
 // lvl : Pwr@ 1m : Pwr@ 0m
@@ -24,8 +25,8 @@
 BLE_BEACON_TYPE beacon_type = BEACON_TYPE_EDDYSTONE; // BEACON_TYPE_EDDYSTONE, BEACON_TYPE_IBEACON, BEACON_TYPE_NONE
 // proximity UUID MSB first
 const uint8_t  iBeaconProximityUUIDraw[] = {
-    0xa1, 0xe6, 0xdf, 0x48, 0xaf, 0x6b, 0x11, 0xe7, 0xab, 0xc4, 0xce, 0xc2, 0x78, 0xb6, 0xb5, 0x0a
-};
+    0x01, 0xD9, 0xC8, 0x00, 0x45, 0xF3, 0x40, 0x24, 0x93, 0xB0, 0xB0, 0xCD, 0x4A, 0x50, 0x2A, 0xF7
+}; // 01D9C800-45F3-4024-93B0-B0CD4A502AF7 use this UUID including spaces in mobile application
 const UUID iBeaconProximityUUID(iBeaconProximityUUIDraw);
 const int16_t iBeaconMajor = 1234;
 const int16_t iBeaconMinor = 5678;
@@ -74,6 +75,7 @@
 void onButtonB(MicroBitEvent)
 {
     // toggle advertising type
+    stopAdvertising();
     switch(beacon_type)
     {
         case BEACON_TYPE_EDDYSTONE:
@@ -95,7 +97,8 @@
 int main()
 {
     pcCom.printf("mBit Beacon.\n\r");
-    
+
+    // TODO: main processing code    
     // Initialize the micro:bit runtime.
     uBit.init();