Bluetooth Low Energy based Firmware Over The Air with Mbed. Mbed part is a external processor of the IoT devices and communicate with a Bluetooth module. The Bluetooth module have to support BLE and implement BLE FOTA profile designed by ours. BLE FOTA profile specification is available from our GIT hub wiki(https://github.com/sevencore/BLEFOTA).
Dependencies: mbed
Fork of mbed_fota by
Bluetooth Low Energy based Firmware Over The Air with Mbed. Mbed part is a external processor of the IoT devices and communicate with a Bluetooth module. The Bluetooth module have to support BLE and implement BLE FOTA profile designed by ours. BLE FOTA profile specification is available from our GIT hub wiki.
Diff: dialog_fota/app_task.cpp
- Revision:
- 6:8dd20294b2aa
- Parent:
- 5:e11b23f9aacc
- Child:
- 8:9eec2c246a85
diff -r e11b23f9aacc -r 8dd20294b2aa dialog_fota/app_task.cpp --- a/dialog_fota/app_task.cpp Mon Jul 13 06:32:05 2015 +0000 +++ b/dialog_fota/app_task.cpp Fri Jul 17 14:04:12 2015 +0000 @@ -2,6 +2,8 @@ #include "app.h" #include "fota_server_task.h" +#define BLE_FOTA_SERVICE 1 + namespace sevencore_fota{ int gapm_adv_report_ind_handler(unsigned short msgid, @@ -21,6 +23,7 @@ unsigned short src_id, BleMsgHandler* BMH) { + uint8_t len = strlen(APP_DIS_SW_REV); if (param->status == CO_ERROR_NO_ERROR) @@ -44,7 +47,6 @@ sizeof(struct diss_set_char_val_req)-(STR_MAX_LEN-APP_DIS_MANUFACTURER_NAME_STR_LEN),&req_name,msg); BMH->BleSendMsg(msg,msg_size); free(msg); - wait(0.5); } @@ -66,9 +68,8 @@ // Send the message BMH->BleSendMsg(msg,msg_size); free(msg); - wait(0.5); } - +#if (BLE_FOTA_SERVICE) // Set Serial Number String value in the DB { uint8_t *msg; @@ -87,9 +88,9 @@ // Send the message BMH->BleSendMsg(msg,msg_size); free(msg); - wait(0.5); } - /* +#endif //(BLE_FOTA_SERVICE) +#if !(BLE_FOTA_SERVICE) // Set System ID value in the DB { uint8_t *msg; @@ -148,14 +149,14 @@ // Send the message BMH->BleSendMsg(msg, msg_size); free(msg); - }*/ + } +#endif //!(BLE_FOTA_SERVICE) } if (app_env.state == APP_IDLE) { char str[30] = "\nfota db create req!!\n"; BMH->HostPcPrint(str); - //app_set_mode(BMH); app_fota_server_db_create(BMH); } @@ -276,9 +277,16 @@ return 0; } -void fota_server_data_flash_ind_handler(BleMsgHandler* BMH) +void fota_server_data_flash_ind_handler(unsigned short msgid, + struct fota_server_data_flash_ind *param, + unsigned short dest_id, + unsigned short src_id, + BleMsgHandler* BMH) { - BMH->ReceiveToSerialTest(); + char version[9]; + memcpy(version,param->version,8); + version[8] = '\0'; + BMH->FirmwareDataReceive(param->code_size,version); } int gapm_device_ready_ind_handler(unsigned short msgid, @@ -349,10 +357,8 @@ app_dis_enable(&device,BMH); app_fota_server_enable(&device,BMH); - wait(0.5); app_connect_confirm(GAP_AUTH_REQ_NO_MITM_NO_BOND,&device,BMH); - - + return 0; }