UpdatedDecryp

Dependencies:   BahlDecrypModified CyaSSL mbed nRF51822

Fork of Decryptulator by Mobius IoT

Revision:
6:850f44146c9f
Parent:
5:103717ce54e5
Child:
7:91324daa3bfa
diff -r 103717ce54e5 -r 850f44146c9f main.cpp
--- 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, &params->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) {