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 KIM HyoengJun

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

Go to the documentation of this file.
00001 /**
00002  * @file main.cpp
00003  * @brief interface configuration & main loop start
00004  * Copyright 2015 SEVENCORE Co., Ltd.
00005  *
00006  * @author HyeongJun Kim 
00007  * @version 1.0.0  
00008  * @since 2015-08-17
00009 */
00010 
00011 
00012 #include "mbed.h"
00013 #include "BleMsgHandler.h"
00014 #include "app.h"
00015 
00016 Serial hostpc(USBTX,USBRX);
00017 Serial device(p13,p14);
00018 LocalFileSystem local("local");               // Create the local filesystem
00019 DigitalOut myled(LED1);
00020 DigitalOut myled2(LED2);
00021 DigitalOut myled3(LED3);
00022 DigitalOut myled4(LED4);
00023 
00024 using namespace sevencore_fota;
00025 
00026 void led_setting_one(void){
00027     myled = 1;
00028     myled2 = 1;
00029     myled3 = 1;
00030     myled4 = 1;
00031 }
00032 
00033 void led_setting_zero(void){
00034     myled = 0;
00035     myled2 = 0;
00036     myled3 = 0;
00037     myled4 = 0;
00038 }
00039 
00040 int main() {
00041     wait(0.5);
00042     myled = 1;
00043     wait(0.5);
00044     myled = 0;
00045     wait(0.5);
00046     myled = 1;
00047     wait(0.5);
00048     myled = 0;
00049     wait(0.5);
00050     led_setting_one(); 
00051     wait(0.5);
00052     hostpc.baud(9600);
00053     wait(0.5);
00054     device.baud(115200);
00055     device.set_flow_control(device.RTSCTS,P2_7,p12);
00056     wait(0.5);
00057     
00058     BleMsgHandler myfota(&device,&hostpc);   
00059     
00060     myfota.PrintTitle();
00061     app_rst_gap(&myfota);
00062     
00063     for(int i = 0; i < 200; i++) {
00064         myfota.BleReceiveMsg();
00065         myfota.BleMsgHandle();
00066     }
00067     
00068     while(1) {
00069         myled = 1;
00070         wait(0.5);
00071         myled = 0;
00072         wait(0.5);
00073     }
00074     
00075 }