Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BLE_API mbed nRF51822 TMP_nrf51
Fork of BLE_Observer by
Revision 6:850f44146c9f, committed 2015-07-15
- Comitter:
- sunsmile2015
- Date:
- Wed Jul 15 02:53:12 2015 +0000
- Parent:
- 5:103717ce54e5
- Child:
- 7:91324daa3bfa
- Commit message:
- publish to my account
Changed in this revision
--- a/BLE_API.lib Sat Jun 20 23:40:04 2015 +0000 +++ b/BLE_API.lib Wed Jul 15 02:53:12 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/teams/Bluetooth-Low-Energy/code/BLE_API/#9f4251b3355c +http://mbed.org/teams/Bluetooth-Low-Energy/code/BLE_API/#9c2edf20ea56
--- a/main.cpp Sat Jun 20 23:40:04 2015 +0000
+++ b/main.cpp Wed Jul 15 02:53:12 2015 +0000
@@ -25,17 +25,22 @@
led1 = !led1; /* Do blinky on LED1 while we're waiting for BLE events */
}
-void advertisementCallback(const Gap::AdvertisementCallbackParams_t *params) {
+void advertisementCallback(const Gap::AdvertisementCallbackParams_t *params)
+{
+ if((params->advertisingData[9] == 0xFE) && (params->advertisingData[10] == 0xFE)) {
+ float tempVal = 0;
+ printf("Adv peerAddr: [%02x %02x %02x %02x %02x %02x] rssi %d, ScanResp: %u, AdvType: %u\r\n",
+ params->peerAddr[5], params->peerAddr[4], params->peerAddr[3], params->peerAddr[2], params->peerAddr[1], params->peerAddr[0],
+ params->rssi, params->isScanResponse, params->type);
+
+ for (unsigned index = 0; index < params->advertisingDataLen; index++) {
+ printf("%02x ", params->advertisingData[index]);
+ }
+
+ memcpy(&tempVal, ¶ms->advertisingData[11], 4); /* temperature value */
+ printf("temp is %f\r\n", tempVal);
- printf("Adv peerAddr: [%02x %02x %02x %02x %02x %02x] rssi %d, ScanResp: %u, AdvType: %u\r\n",
- params->peerAddr[5], params->peerAddr[4], params->peerAddr[3], params->peerAddr[2], params->peerAddr[1], params->peerAddr[0],
- params->rssi, params->isScanResponse, params->type);
-#if DUMP_ADV_DATA
- for (unsigned index = 0; index < params->advertisingDataLen; index++) {
- printf("%02x ", params->advertisingData[index]);
}
- printf("\r\n");
-#endif /* DUMP_ADV_DATA */
}
int main(void)
@@ -46,7 +51,7 @@
ble.init();
- ble.gap().setScanParams(500 /* scan interval */, 200 /* scan window */);
+ ble.gap().setScanParams(1800 /* scan interval */, 1500 /* scan window */);
ble.gap().startScan(advertisementCallback);
while (true) {
--- a/mbed.bld Sat Jun 20 23:40:04 2015 +0000 +++ b/mbed.bld Wed Jul 15 02:53:12 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/7cff1c4259d7 \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/da0ca467f8b5 \ No newline at end of file
--- a/nRF51822.lib Sat Jun 20 23:40:04 2015 +0000 +++ b/nRF51822.lib Wed Jul 15 02:53:12 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/teams/Nordic-Semiconductor/code/nRF51822/#7c68c8d67e1f +http://mbed.org/teams/Nordic-Semiconductor/code/nRF51822/#6c82f06746bb
