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: BLE/src/ble_msg_handler.cpp
- Revision:
- 284:cc72206ea8e0
- Parent:
- 280:7c1c9274cce6
--- a/BLE/src/ble_msg_handler.cpp Fri Oct 28 16:28:44 2016 +0000 +++ b/BLE/src/ble_msg_handler.cpp Fri Oct 28 18:44:12 2016 +0000 @@ -29,7 +29,7 @@ volatile bool isDeviceConnected; static ble_data_ready_callback_t data_ready_cb; uint8_t json_array[MAX_FILE_SIZE]; -uint8_t count,file_index,file_size; +uint16_t count,file_index,file_size; /***************************************************************************** * Function: BLE data receive callback * Description: Function used to register ble data receive callback @@ -69,21 +69,27 @@ json Array.when it equals 3,ie 60 bytes(assuming that each time we are sening 20 bytes), passing this to callback to main function. - */ - - count++; + */ + + // if(file_receiving_flag ==true) + // { + // count++; /*reassembling packets */ memcpy(&json_array[file_index],&spi_rcv_array[3], (spi_rcv_array[2]-4)); - file_index+= (spi_rcv_array[2]-4); //((spi_rcv_array[2]-4) contains packet length excluding headers + // file_index+= (spi_rcv_array[2]-4); //((spi_rcv_array[2]-4) contains packet length excluding headers - if(count ==3) //added for testing. Need to change this to if(file_index == file_size) - { + // if(count ==3) //added for testing. Need to change this to if(file_index == file_size) + // { /*Passing the entire file to callback function*/ - data_ready_cb(json_array, file_index); + // data_ready_cb(json_array, file_index); + data_ready_cb(json_array, (spi_rcv_array[2]-4)); count= 0; file_index =0; - } + /* Reset the File Parameters */ + file_receiving_flag = false; + // } + // } break; case BLE_DISCONNECTION_EVNT_CMD: @@ -97,7 +103,7 @@ /*extract the json string length from SOF. */ - file_size = spi_rcv_array[3]; + file_size = ((spi_rcv_array[3]<<8)|spi_rcv_array[4]); break; @@ -117,4 +123,4 @@ /******************************************************************************/ /* END OF FILE */ -/******************************************************************************/ +/******************************************************************************/ \ No newline at end of file