High level Bluetooth Low Energy API and radio abstraction layer

Dependencies:   nRF51822

Dependents:   LinkNode_LIS3DH

Fork of BLE_API by Bluetooth Low Energy

Revision:
5:7635f81a8e09
Parent:
3:46de446e82ed
Child:
6:425638944835
--- a/main.cpp	Thu Dec 12 02:20:54 2013 +0000
+++ b/main.cpp	Thu Dec 12 02:43:22 2013 +0000
@@ -29,12 +29,31 @@
 GattCharacteristic thermInterval ( 0x2A21, 2, 2, BLE_GATT_CHAR_PROPERTIES_READ );
 
 /* Notify   = device (server) sends data when it changes */
-/* Indicate = device (server) sends data when it changes and client confirms reception */ 
- 
+/* Indicate = device (server) sends data when it changes and client confirms reception */
+
+/* GAP Advertising Example (iBeacon) */
+GapAdvertisingParams advParams ( GapAdvertisingParams::NON_CONNECTABLE );
+GapAdvertisingData   advData;
+
+uint8_t iBeaconPayload[25] = { 0x4C, 0x00, 0x02, 0x15, 0xE2, 0x0A, 0x39, 0xF4, 0x73, 0xF5, 0x4B, 0xC4, 0xA1, 0x2F, 0x17, 0xD1, 0xAD, 0x07, 0xA9, 0x61, 0x00, 0x00, 0x00, 0x00, 0xC8 };
+
+void startBeacon(void)
+{
+    /* iBeacon includes the FLAG and MSD fields */
+    advData.addFlags(GapAdvertisingData::BREDR_NOT_SUPPORTED);
+    advData.addData(GapAdvertisingData::MANUFACTURER_SPECIFIC_DATA, iBeaconPayload, 25);
+    
+    wait(2);
+    radio.reset();
+    radio.setAdvertising(advParams, advData);
+    radio.start();
+}
+
 int main()
 {
     wait(2);
-    radio.test();
+    // radio.test();
+    startBeacon();
     while(1);
 
     /* Add the battery level characteristic to the battery service          */