Geo beacon for VF.

Dependencies:   MMA8452 aconno_bsp adc52832_common

Revision:
33:449fcc43b287
Parent:
32:61d2328ec1a7
Child:
34:9856c51ec646
--- a/main.cpp	Fri Nov 24 15:02:50 2017 +0000
+++ b/main.cpp	Mon Nov 27 15:24:13 2017 +0000
@@ -16,11 +16,11 @@
 #include "nrf52_digital.h"
 #include "acn_nrf52_pwm.h"
 
-#define DEBUG               (0)
+#define DEBUG               (1)
 #define DEBUG_ACC           (0)
 #define DEBUG_PRINT_UART    (0)
 #define DEBUG_MAC           (0)
-#define DEBUG_CONNECTION    (0)
+#define DEBUG_CONNECTION    (1)
 #define DEBUG_WAKEUP_BUZZER (0)
 
 #define USE_ACC             (0)
@@ -37,7 +37,7 @@
 
 /* Static constants for the BLE example */
 #define MAX_BLE_PACKET_SIZE (31)
-#define MSD_SIZE            (18)
+#define MSD_SIZE            (16)
 #define MSD_ID              (0xFF)
 
 #define BUZZ_TIME_S         (1)     /* Buzz time in s */
@@ -58,7 +58,7 @@
   uint16_t appleID;
   uint8_t  secondID;
   uint8_t  DataSize;
-  uint8_t  UUID[18];
+  uint8_t  UUID[10];    // was 18
   uint8_t  major;
   uint8_t  minor;
   int8_t   RSSI;
@@ -82,7 +82,9 @@
 uint8_t txPower = 4;
 uint8_t sleepFlag = true;
 uint8_t tempSleepTime = SLEEP_TIME_S;
-uint8_t msd[MSD_SIZE] = {0x59, 0x00, 0xE1, 0x61, 0x35, 0xBA, 0xC0, 0xEC, 0x47, 0x2A, 0x98, 0x00, 0xAF, 0x18, 0x43, 0xFF, 0x05, 0x00};
+//uint8_t msd[MSD_SIZE] = {0x59, 0x00, 0xE1, 0x61, 0x35, 0xBA, 0xC0, 0xEC, 0x47, 0x2A, 0x98, 0x00, 0xAF, 0x18, 0x43, 0xFF, 0x05, 0x00};
+uint8_t msd[MSD_SIZE] = {0xE1, 0x61, 0x35, 0xBA, 0xC0, 0xEC, 0x47, 0x2A, 0x98, 0x00, 0xAF, 0x18, 0x43, 0xFF, 0x05, 0x00};
+uint8_t tempUUID[2] = {0x00, 0x59};
 uint8_t startBuzz[2] = {0xBA, 0xBE};
 uint8_t stopBuzz[2] = {0xDE, 0xAD};
 uint8_t myMacAddress[6] = {};   
@@ -276,8 +278,9 @@
     /*
      *  iBeacon
      */
-    ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::LE_GENERAL_DISCOVERABLE | GapAdvertisingData::BREDR_NOT_SUPPORTED);
-    ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::MANUFACTURER_SPECIFIC_DATA, (uint8_t*)&ibeaconMSD, sizeof(ibeaconMSD));
+    //ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::LE_GENERAL_DISCOVERABLE | GapAdvertisingData::BREDR_NOT_SUPPORTED);
+    //ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::MANUFACTURER_SPECIFIC_DATA, (uint8_t*)&ibeaconMSD, 2);
+    ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::INCOMPLETE_LIST_128BIT_SERVICE_IDS  , (uint8_t*)msd, MSD_SIZE);
     
     ble.gap().setAdvertisingInterval(ADV_INTERVAL);  // --> Has to be at least 100ms!
 }
@@ -287,8 +290,13 @@
         /*
          *  iBeacon
          */
-        ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::LE_GENERAL_DISCOVERABLE | GapAdvertisingData::BREDR_NOT_SUPPORTED);
-        ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::MANUFACTURER_SPECIFIC_DATA, (uint8_t*)&ibeaconMSD, sizeof(ibeaconMSD));
+        //ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::LE_GENERAL_DISCOVERABLE | GapAdvertisingData::BREDR_NOT_SUPPORTED);
+        //ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::MANUFACTURER_SPECIFIC_DATA, (uint8_t*)&ibeaconMSD, sizeof(ibeaconMSD));
+        //ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::INCOMPLETE_LIST_128BIT_SERVICE_IDS  , (uint8_t*)msd, MSD_SIZE);
+        //ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::LE_GENERAL_DISCOVERABLE | GapAdvertisingData::BREDR_NOT_SUPPORTED);
+        //ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::MANUFACTURER_SPECIFIC_DATA, (uint8_t*)&ibeaconMSD, 2);
+        ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::INCOMPLETE_LIST_128BIT_SERVICE_IDS  , (uint8_t*)msd, MSD_SIZE);
+        
     }
     else{
         ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::MANUFACTURER_SPECIFIC_DATA, (uint8_t *)msd, MSD_SIZE);