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 SerialManager.h Source File

SerialManager.h

Go to the documentation of this file.
00001 /**
00002  * @file SerialManager.h
00003  * @brief Serial Communication Management 
00004  * Copyright 2015 SEVENCORE Co., Ltd.
00005  *
00006  * @author HyeongJun Kim 
00007  * @version 1.0.0  
00008  * @date 2015-08-19
00009 */
00010 #ifndef SERIALMANAGER_H
00011 #define SERIALMANAGER_H
00012 
00013 #include "mbed.h"
00014 /**
00015  ****************************************************************************************
00016  * @addtogroup ext_fota module
00017  * @brief Serial Manager Class Header.
00018  *
00019  * @{
00020  ****************************************************************************************
00021  */
00022 namespace sevencore_fota{
00023     
00024 class SerialManager
00025 {
00026 public:
00027     /**
00028      ****************************************************************************************
00029      * @brief Serial Manager constructor only connected Device
00030      ****************************************************************************************
00031      */ 
00032     SerialManager(Serial *_device);
00033     /**
00034      ****************************************************************************************
00035      * @brief Serial Manager constructor with connected Device & HostPC
00036      ****************************************************************************************
00037      */
00038     SerialManager(Serial *_device,Serial *_hostpc);
00039     /**
00040      ****************************************************************************************
00041      * @brief Serial Manager destructor
00042      ****************************************************************************************
00043      */
00044     ~SerialManager(void);
00045     /**
00046      ****************************************************************************************
00047      * @brief Send ble message to serial port
00048      ****************************************************************************************
00049      */
00050     int SendToSerial(uint8_t *data,unsigned short size);
00051     /**
00052      ****************************************************************************************
00053      * @brief Receive ble message from serial port
00054      ****************************************************************************************
00055      */
00056     int ReceiveToSerial(unsigned char *receive_msg);
00057     /**
00058      ****************************************************************************************
00059      * @brief Receive data for size
00060      ****************************************************************************************
00061      */
00062     void DataReceive(uint8_t *databuf, unsigned short size);
00063     /**
00064      ****************************************************************************************
00065      * @brief Receive data test function
00066      ****************************************************************************************
00067      */
00068     void ReceiveToSerialTest(void);  
00069       
00070 private:
00071     /**
00072      ****************************************************************************************
00073      * @brief Serial Manager Start title print function.
00074      ****************************************************************************************
00075      */
00076     void PrintSerialManager(void);
00077     
00078     bool print_flag;
00079     Serial *device;
00080     Serial *hostpc;
00081     uint8_t FE_MSG_PACKET_TYPE;
00082     int MAX_PACKET_LENGTH;
00083     unsigned char bReceiveState;
00084     unsigned short wDataLength;
00085     unsigned short wReceivePos;
00086     unsigned char bHdrBytesRead;
00087     unsigned char bReceiveElementArr[512];
00088 
00089 };
00090 
00091 }//namespace
00092 
00093 /// @} ext_fota module
00094 #endif//SERIALMANAGER_H