Erick / Mbed 2 deprecated ICE_BLE_TEST

Dependencies:   NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed

Fork of ICE by Erick

Revision:
277:86dbc2483b67
Parent:
267:fdb40bcd9c12
Child:
279:b60379a9eb1a
--- a/src/BLEDataHandler/BLEDataHandler.cpp	Wed Oct 26 18:58:23 2016 +0000
+++ b/src/BLEDataHandler/BLEDataHandler.cpp	Wed Oct 26 19:36:49 2016 +0000
@@ -70,7 +70,7 @@
         event_status = PollBLEEvents();
         if(event_status == true && send_json == true) {
 
-            cJSON * root = cJSON_Parse( recv_str );
+            cJSON * root = cJSON_Parse( recv_str ); // recv_str is used to generate a fake message, Jinu can remove for testing.
             int mType = cJSON_GetObjectItem(root,"mtype")->valueint;
 
             printf("mType=%d, str=%s\r\n",mType, recv_str);
@@ -84,7 +84,6 @@
                         std::string tag      = cJSON_GetObjectItem(item, "tag")->valuestring;
                         RequestedTags.push_back(tag);
                     }
-                    cJSON_Delete(root);
 
                     GetTagReadings( RequestedTags, (char *)tx_array, sizeof(tx_array) );
                     
@@ -97,6 +96,7 @@
                     printf("unknown mtype received\r\n");
                     break;
             }
+            cJSON_Delete(root);
         }
         Thread::wait(100);
     }