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: NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed
Fork of ICE by
Diff: src/BLEDataHandler/BLEDataHandler.cpp
- Revision:
- 279:b60379a9eb1a
- Parent:
- 277:86dbc2483b67
- Child:
- 281:a362a9450b81
--- a/src/BLEDataHandler/BLEDataHandler.cpp Wed Oct 26 19:47:44 2016 +0000 +++ b/src/BLEDataHandler/BLEDataHandler.cpp Wed Oct 26 21:02:04 2016 +0000 @@ -68,6 +68,12 @@ while(1) { event_status = PollBLEEvents(); + if(event_status == true ) { + printf("event_status=true\r\n"); + } + if(event_status == true ) { + printf("send_json=true\r\n"); + } if(event_status == true && send_json == true) { cJSON * root = cJSON_Parse( recv_str ); // recv_str is used to generate a fake message, Jinu can remove for testing. @@ -86,8 +92,8 @@ } GetTagReadings( RequestedTags, (char *)tx_array, sizeof(tx_array) ); - - printf("Sending Reply to APP: %s\r\n",tx_array); + + printf("%s:%d: Sending Reply to APP: %s\r\n",__func__,__LINE__,tx_array); BLE.SendFile(tx_array,strlen((char *)tx_array)); send_json = false; break; @@ -98,6 +104,14 @@ } cJSON_Delete(root); } - Thread::wait(100); + + // This will wait 100ms for a message + osEvent evt = BLEHandlerMailBox.get(100); + if (evt.status == osEventMail) { + BLEHandlerReq_t *mail = (BLEHandlerReq_t*)evt.value.p; + printf("%s:%d: Sending Reply to APP: %s\r\n",__func__,__LINE__,mail->reply); + BLE.SendFile((uint8_t *)mail->reply,strlen((char *)mail->reply)); + BLEHandlerMailBox.free(mail); + } } } \ No newline at end of file