BLE iBeacon Scan example for NNN40

Dependencies:   BLE_API BLE_iBeacon_Scan mbed-dev nRF51822

BLE iBeacon Scan example for NNN40

Files at this revision

API Documentation at this revision

Comitter:
marcusC
Date:
Thu Nov 26 06:05:32 2015 +0000
Commit message:
BLE iBeacon Scan example for NNN40

Changed in this revision

BLE_API.lib Show annotated file Show diff for this revision Revisions of this file
BLE_iBeacon_Scan.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-dev.lib 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
diff -r 000000000000 -r 17c37c570285 BLE_API.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BLE_API.lib	Thu Nov 26 06:05:32 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/teams/Bluetooth-Low-Energy/code/BLE_API/#a097e1be76f4
diff -r 000000000000 -r 17c37c570285 BLE_iBeacon_Scan.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BLE_iBeacon_Scan.lib	Thu Nov 26 06:05:32 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/teams/Delta/code/BLE_iBeacon_Scan/#2c8c5bd785f4
diff -r 000000000000 -r 17c37c570285 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Nov 26 06:05:32 2015 +0000
@@ -0,0 +1,42 @@
+#include "mbed.h"
+#include "BLE.h"
+#include "iBeaconScan.h"
+
+Serial pc(TX_PIN_NUMBER, RX_PIN_NUMBER);
+DigitalOut led1(LED1);
+union unionType u;
+
+void AdvertisementReportCallback(const Gap::AdvertisementCallbackParams_t *params)
+{
+  led1 = !led1;
+  uint8_t i;
+  
+  if (memcmp(params->advertisingData,iBeaconPrefix,sizeof(iBeaconPrefix)) != 0)
+    return;
+  
+  memset(u.rawData, 0 , sizeof(u.rawData));
+  memcpy(u.rawData, params->advertisingData,params->advertisingDataLen);
+
+  pc.printf("uuid:");
+  for( i = 0; i < 16; i++)
+    pc.printf("%02x ",u.iBeaconPayload_m.uuid[i]);
+  pc.printf("\r\n");  
+  pc.printf("majorNumber:%02x %02x\r\n",u.iBeaconPayload_m.majorNumber[0], u.iBeaconPayload_m.majorNumber[1]);
+  pc.printf("minorNumber:%02x %02x\r\n",u.iBeaconPayload_m.minorNumber[0], u.iBeaconPayload_m.minorNumber[1]);
+  pc.printf("txPower:%02x\r\n",u.iBeaconPayload_m.txPower);
+}
+
+int main(void)
+{   
+    led1 = 0;
+    pc.baud(115200);
+    pc.printf("Hello\n"); 
+    
+    iBeaconInit();
+    iBeaconStartScan();
+    wait(10);
+    iBeaconStopScan();
+    
+    while(1) { 
+    }
+}
diff -r 000000000000 -r 17c37c570285 mbed-dev.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-dev.lib	Thu Nov 26 06:05:32 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed-dev/#a457b7fe77eb
diff -r 000000000000 -r 17c37c570285 nRF51822.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nRF51822.lib	Thu Nov 26 06:05:32 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/teams/Nordic-Semiconductor/code/nRF51822/#bf85bf7e73d5