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_main.cpp
- Revision:
- 284:cc72206ea8e0
- Parent:
- 265:0fb72c26ae68
--- a/BLE/src/ble_main.cpp Fri Oct 28 16:28:44 2016 +0000 +++ b/BLE/src/ble_main.cpp Fri Oct 28 18:44:12 2016 +0000 @@ -29,7 +29,8 @@ /******************************************************************************/ BLE_INIT BLE_INIT; extern volatile bool isDeviceConnected; - +uint8_t temp_buf[30]; +uint8_t dummy_bytes; /******************************************************************************* * Function: ConfigureBLEDevice() * Description: Initialise and configure BLE @@ -107,7 +108,7 @@ packet[3] =0x45; packet[4] =0x4f; packet[5] =0x46; - memset(&packet[6], 0x45, 17); + memset(&packet[6], 0x40, 17); packet[23]=BLE_EOT_CMD; WriteSpiData(packet,24); } @@ -126,20 +127,23 @@ uint8_t num_writes,rem_bytes,start_index =0; // GetFileName(); //TODO /*added for testing purpose.Need to be removed*/ + num_writes = ((len)/MAX_PAYLOAD_BYTES); + rem_bytes =((len)%MAX_PAYLOAD_BYTES); + uint8_t file_name[20]; file_name[0] =0x53; file_name[1] =0x4f; file_name[2] =0x46; - memset(&file_name[3],0x5a,17); + file_name[3] = rem_bytes; + memset(&file_name[4],0x40,17); /*TODO SOF consist of information about packets.Now sending a string for testing with mobile app */ SendSOF(file_name,16); - - num_writes = ((len)/MAX_PAYLOAD_BYTES); - rem_bytes =((len)%MAX_PAYLOAD_BYTES); + SendSOF(file_name,16); + for(int i=0;i<(num_writes);i++) { @@ -148,13 +152,17 @@ } if(rem_bytes) { - BLE_INIT.SendBleData(&json_file[start_index], rem_bytes); + dummy_bytes = 20-rem_bytes; + // BLE_INIT.SendBleData(&json_file[start_index], rem_bytes); + memcpy(temp_buf,&json_file[start_index],rem_bytes); + memset(&temp_buf[rem_bytes],0x40,dummy_bytes); + BLE_INIT.SendBleData(temp_buf, MAX_PAYLOAD_BYTES); } /*TODO EOF indication that packets transfer compleated. This information can be passed in SOF. */ - // SendEOF(); + SendEOF(); }