Getting BLEDATA

Dependencies:   BLE_API TMP102 mbed nRF51822

Files at this revision

API Documentation at this revision

Comitter:
nakamae
Date:
Thu Jun 02 04:33:20 2016 +0000
Commit message:
finished;

Changed in this revision

BLE_API.lib Show annotated file Show diff for this revision Revisions of this file
TMP102.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.bld 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BLE_API.lib	Thu Jun 02 04:33:20 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/teams/Bluetooth-Low-Energy/code/BLE_API/#66159681aa21
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TMP102.lib	Thu Jun 02 04:33:20 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/chris/code/TMP102/#694792b93731
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jun 02 04:33:20 2016 +0000
@@ -0,0 +1,61 @@
+#include "mbed.h"
+#include "BLE.h"
+#include "HeartRateService.h"
+#include "DeviceInformationService.h"
+
+
+#define NEED_CONSOLE_OUTPUT 1 /* Set this if you need debug messages on the console;
+* it will have an impact on code-size and power consumption. */
+
+#if NEED_CONSOLE_OUTPUT
+Serial  pc(USBTX, USBRX);
+#define DEBUG(...) { pc.printf(__VA_ARGS__); }
+#else
+#define DEBUG(...) /* nothing */
+#endif /* #if NEED_CONSOLE_OUTPUT */
+
+BLE  ble;
+
+
+
+void onScanCallback(const Gap::AdvertisementCallbackParams_t *params)
+{
+    
+    
+
+#if NEED_CONSOLE_OUTPUT
+    DEBUG("onScan() ");
+    DEBUG("RSSI:%d ",params->rssi);
+    DEBUG("Addr:%d ",params->peerAddr);
+    DEBUG("adv peerAddr[%02x %02x %02x %02x %02x %02x]", params->peerAddr[5], params->peerAddr[4], params->peerAddr[3], params->peerAddr[2], params->peerAddr[1],params->peerAddr[0]);
+    
+    
+    DEBUG("Len:%d ",params->advertisingDataLen);
+    DEBUG("Data:");
+    for (int i=0; i< params->advertisingDataLen; i++){
+        DEBUG("%02x,",params->advertisingData[i]);
+    }
+    DEBUG(" \n\r");
+#endif
+
+
+}
+
+const GapScanningParams scanningParams;
+int main(void)
+{
+   
+
+    ble.init();
+    DEBUG("Start\n\r");
+
+    ble.setScanParams(GapScanningParams::SCAN_INTERVAL_MAX,
+                      GapScanningParams::SCAN_WINDOW_MAX,
+                      0);
+
+    ble.startScan(&onScanCallback);
+    // infinite loop
+    while (1) {
+        ble.waitForEvent(); // low power wait for event
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Jun 02 04:33:20 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/6c34061e7c34
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nRF51822.lib	Thu Jun 02 04:33:20 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/teams/Nordic-Semiconductor/code/nRF51822/#f7faad332abc