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.
BleMsgHandler.h
00001 /** 00002 * @file BleMsgHandler.h 00003 * @brief Ble message handler ( Ble message is communication mathod between Mbed and DA14583 ) 00004 * Copyright 2015 SEVENCORE Co., Ltd. 00005 * 00006 * @author HyeongJun Kim 00007 * @version 1.0.0 00008 * @date 2015-08-17 00009 */ 00010 00011 #ifndef BLEMSGHANDLER_H 00012 #define BLEMSGHANDLER_H 00013 00014 /** 00015 **************************************************************************************** 00016 * @addtogroup ext_fota module 00017 * @brief Ble message Handler Class Header. 00018 * 00019 * @{ 00020 **************************************************************************************** 00021 */ 00022 00023 #include "mbed.h" 00024 #include "MsgQueue.h" 00025 #include "SerialManager.h" 00026 #include "gapc_task.h" 00027 #include "gapm_task.h" 00028 00029 namespace sevencore_fota{ 00030 00031 #define FIRMWARE_DATA_FRAGMENT_SIZE 1024 00032 00033 typedef struct { 00034 unsigned short bType; 00035 unsigned short bDstid; 00036 unsigned short bSrcid; 00037 unsigned short bLength; 00038 } ble_hdr; 00039 00040 class BleMsgHandler 00041 { 00042 public: 00043 /** 00044 **************************************************************************************** 00045 * @brief Ble message handler constructor only connected Device 00046 **************************************************************************************** 00047 */ 00048 BleMsgHandler(Serial* _device); 00049 /** 00050 **************************************************************************************** 00051 * @brief Ble message handler constructor with connected Device & HostPC 00052 **************************************************************************************** 00053 */ 00054 BleMsgHandler(Serial* _device, Serial* _hostpc); 00055 /** 00056 **************************************************************************************** 00057 * @brief Ble message handler destructor 00058 **************************************************************************************** 00059 */ 00060 ~BleMsgHandler(void); 00061 /** 00062 **************************************************************************************** 00063 * @brief Ble message handler Start title print function 00064 **************************************************************************************** 00065 */ 00066 void PrintTitle(void); 00067 /** 00068 **************************************************************************************** 00069 * @brief Create ble message 00070 **************************************************************************************** 00071 */ 00072 void BleMsgAlloc(unsigned short id,unsigned short dest_id,unsigned short src_id,unsigned short data_len,void *pdata,uint8_t *msg); 00073 /** 00074 **************************************************************************************** 00075 * @brief Send ble message to device 00076 **************************************************************************************** 00077 */ 00078 int BleSendMsg(uint8_t *msg, unsigned short size); 00079 /** 00080 **************************************************************************************** 00081 * @brief Receive ble message from device 00082 **************************************************************************************** 00083 */ 00084 void BleReceiveMsg(void); 00085 /** 00086 **************************************************************************************** 00087 * @brief Get message from MsgQueue and Execute corresponding function 00088 **************************************************************************************** 00089 */ 00090 void BleMsgHandle(void); 00091 /** 00092 **************************************************************************************** 00093 * @brief Debugging message output to hostpc 00094 **************************************************************************************** 00095 */ 00096 void HostPcPrint(char *str); 00097 /** 00098 **************************************************************************************** 00099 * @brief Receive test method 00100 **************************************************************************************** 00101 */ 00102 void ReceiveToSerialTest(void); 00103 /** 00104 **************************************************************************************** 00105 * @brief Receive and Store Da14583 flash data 00106 **************************************************************************************** 00107 */ 00108 void FirmwareDataReceive(unsigned short code_size, char *version); 00109 00110 00111 00112 private: 00113 /** 00114 **************************************************************************************** 00115 * @brief GAPM Command Event Handler 00116 **************************************************************************************** 00117 */ 00118 void HandleGapmCmpEvt(unsigned short msgid,struct gapm_cmp_evt *param,unsigned short dest_id,unsigned short src_id); 00119 /** 00120 **************************************************************************************** 00121 * @brief GAPC Command Event Handler 00122 **************************************************************************************** 00123 */ 00124 void HandleGapcCmpEvt(unsigned short msgid,struct gapc_cmp_evt *param,unsigned short dest_id,unsigned short src_id); 00125 00126 00127 private: 00128 bool print_flag; 00129 Serial* device; 00130 Serial* hostpc; 00131 SerialManager* SerialM; 00132 MsgQueue* MsgQ; 00133 unsigned char recv_msg[512]; 00134 FILE *fp; 00135 }; 00136 00137 }//namespace 00138 00139 /// @} ext_fota module 00140 #endif //BLEMSGHANDLER_H
Generated on Tue Jul 12 2022 21:40:44 by
