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: ext_fota/BleMsgHandler.cpp
- Revision:
- 5:e11b23f9aacc
- Parent:
- 4:60be78a172c2
- Child:
- 6:8dd20294b2aa
--- a/ext_fota/BleMsgHandler.cpp Wed Jun 24 08:50:07 2015 +0000 +++ b/ext_fota/BleMsgHandler.cpp Mon Jul 13 06:32:05 2015 +0000 @@ -1,6 +1,7 @@ #include "BleMsgHandler.h" #include "dialog_fota_config.h" #include "diss_task.h" +#include "fota_server_task.h" #include "app_task.h" @@ -34,7 +35,8 @@ void BleMsgHandler::PrintTitle(void) { if( print_flag == 1 ) - hostpc->printf("Sevencore Fota : BleMsg Handler Start\n"); + hostpc->printf("\nSevencore Fota : BleMsg Handler Start\n"); + //SerialM->ReceiveToSerialTest(); } void BleMsgHandler::BleMsgAlloc( unsigned short id, @@ -95,32 +97,68 @@ switch( msg_hdr.bType ) { case GAPM_CMP_EVT: + if( print_flag == 1) + hostpc->printf("==> GAPM_CMP_EVT!!\n"); HandleGapmCmpEvt(msg_hdr.bType,(struct gapm_cmp_evt *)&msg[paramPos],msg_hdr.bDstid,msg_hdr.bSrcid); break; case GAPM_DEVICE_READY_IND: - gapm_device_ready_ind_handler(msg_hdr.bType,(void *)&msg[paramPos],msg_hdr.bDstid,msg_hdr.bSrcid,this); + if( print_flag == 1) + hostpc->printf("==> GAPM_DEVICE_READY_IND!!\n"); + gapm_device_ready_ind_handler(msg_hdr.bType,(struct gap_ready_evt *)&msg[paramPos],msg_hdr.bDstid,msg_hdr.bSrcid,this); break; case GAPM_ADV_REPORT_IND: + if( print_flag == 1) + hostpc->printf("==> GAPM_ADV_REPORT_IND!!\n"); gapm_adv_report_ind_handler(msg_hdr.bType,(struct gapm_adv_report_ind *)&msg[paramPos],msg_hdr.bDstid,msg_hdr.bSrcid); break; case GAPC_CMP_EVT: + if( print_flag == 1) + hostpc->printf("==> GAPC_CMP_EVT!!\n"); HandleGapcCmpEvt(msg_hdr.bType,(struct gapc_cmp_evt *)&msg[paramPos],msg_hdr.bDstid,msg_hdr.bSrcid); break; + case GAPC_CONNECTION_REQ_IND: + if( print_flag == 1) + hostpc->printf("==> GAPC_CONNECTION_REQ_IND!!\n"); + gapc_connection_req_ind_handler(msg_hdr.bType,(struct gapc_connection_req_ind *)&msg[paramPos],msg_hdr.bDstid,msg_hdr.bSrcid,this); + break; + case GAPC_DISCONNECT_IND: + if( print_flag == 1) + hostpc->printf("==> GAPC_DISCONNECT_IND!!\n"); + gapc_disconnect_ind_handler(msg_hdr.bType,(struct gapc_disconnect_ind *)&msg[paramPos],msg_hdr.bDstid,msg_hdr.bSrcid,this); + break; case DISS_CREATE_DB_CFM: + if( print_flag == 1) + hostpc->printf("==> DISS_CREATE_DB_CFM!!\n"); diss_create_db_cfm_handler(msg_hdr.bType,(struct diss_create_db_cfm *)&msg[paramPos],msg_hdr.bDstid,msg_hdr.bSrcid,this); break; case DISS_DISABLE_IND: + if( print_flag == 1) + hostpc->printf("==> DISS_DISABLE_IND!!\n"); break; case DISS_ERROR_IND: if ( print_flag == 1) hostpc->printf("Rcved DISS_ERROR_IND Msg\n"); break; + case FOTA_SERVER_CREATE_DB_CFM: + if( print_flag == 1) + hostpc->printf("==> FOTA_SERVER_CREATE_DB_CFM!!\n"); + fota_server_create_db_cfm_handler(msg_hdr.bType,(struct fota_server_create_db_cfm *)&msg[paramPos],msg_hdr.bDstid,msg_hdr.bSrcid,this); + break; + case FOTA_SERVER_DISABLE_IND: + if( print_flag == 1) + hostpc->printf("==> FOTA_SERVER_DISABLE_IND!!\n"); + break; + case FOTA_SERVER_ERROR_IND: + if ( print_flag == 1) + hostpc->printf("Rcved FOTA_SERVER_ERROR_IND Msg\n"); + fota_server_data_flash_ind_handler(this); + break; default: if( print_flag == 1) hostpc->printf("Massage Type Not Defined ! \n"); break; } -} +}//gapc_disconnect_ind_handler(GAPC_DISCONNECT_IND),(GAPC_CONNECTION_REQ_IND)gapc_connection_req_ind_handler void BleMsgHandler::HandleGapmCmpEvt(unsigned short msgid, struct gapm_cmp_evt *param, @@ -134,6 +172,8 @@ case GAPM_NO_OP:// No operation. break; case GAPM_RESET:// Reset BLE subsystem: LL and HL. + if( print_flag == 1) + hostpc->printf("GAPM_RESET!! Start...\n"); gapm_reset_completion_handler (msgid, (struct gapm_cmp_evt *)param, dest_id, src_id,this); break; case GAPM_CANCEL:// Cancel currently executed operation. @@ -234,6 +274,18 @@ } } +void BleMsgHandler::HostPcPrint(char *str) +{ + if(print_flag == 1) + hostpc->printf("%s",str); +} + +void BleMsgHandler::ReceiveToSerialTest(void) +{ + SerialM->ReceiveToSerialTest(); +} + + }//namespace