![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Getting BLEDATA
Dependencies: BLE_API TMP102 mbed nRF51822
Revision 0:7d9be099fad2, committed 2016-06-02
- Comitter:
- nakamae
- Date:
- Thu Jun 02 04:33:20 2016 +0000
- Commit message:
- finished;
Changed in this revision
diff -r 000000000000 -r 7d9be099fad2 BLE_API.lib --- /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
diff -r 000000000000 -r 7d9be099fad2 TMP102.lib --- /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
diff -r 000000000000 -r 7d9be099fad2 main.cpp --- /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 + } +}
diff -r 000000000000 -r 7d9be099fad2 mbed.bld --- /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
diff -r 000000000000 -r 7d9be099fad2 nRF51822.lib --- /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