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.
ext_fota/BleMsgHandler.h@4:60be78a172c2, 2015-06-24 (annotated)
- Committer:
- dudnwjs
- Date:
- Wed Jun 24 08:50:07 2015 +0000
- Revision:
- 4:60be78a172c2
- Parent:
- 3:1e70387e1337
- Child:
- 5:e11b23f9aacc
Add advertising feature;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dudnwjs | 0:a1f6b1ba8a1e | 1 | #ifndef BLEMSGHANDLER_H |
dudnwjs | 0:a1f6b1ba8a1e | 2 | #define BLEMSGHANDLER_H |
dudnwjs | 0:a1f6b1ba8a1e | 3 | |
dudnwjs | 0:a1f6b1ba8a1e | 4 | #include "mbed.h" |
dudnwjs | 0:a1f6b1ba8a1e | 5 | #include "MsgQueue.h" |
dudnwjs | 2:dba344c91bce | 6 | #include "SerialManager.h" |
dudnwjs | 4:60be78a172c2 | 7 | #include "gapc_task.h" |
dudnwjs | 4:60be78a172c2 | 8 | #include "gapm_task.h" |
dudnwjs | 0:a1f6b1ba8a1e | 9 | |
dudnwjs | 0:a1f6b1ba8a1e | 10 | namespace sevencore_fota{ |
dudnwjs | 0:a1f6b1ba8a1e | 11 | |
dudnwjs | 3:1e70387e1337 | 12 | typedef struct { |
dudnwjs | 3:1e70387e1337 | 13 | unsigned short bType; |
dudnwjs | 3:1e70387e1337 | 14 | unsigned short bDstid; |
dudnwjs | 3:1e70387e1337 | 15 | unsigned short bSrcid; |
dudnwjs | 3:1e70387e1337 | 16 | unsigned short bLength; |
dudnwjs | 3:1e70387e1337 | 17 | } ble_hdr; |
dudnwjs | 3:1e70387e1337 | 18 | |
dudnwjs | 1:5cf3a6c969be | 19 | class BleMsgHandler |
dudnwjs | 0:a1f6b1ba8a1e | 20 | { |
dudnwjs | 0:a1f6b1ba8a1e | 21 | public: |
dudnwjs | 1:5cf3a6c969be | 22 | BleMsgHandler(Serial* _device); |
dudnwjs | 1:5cf3a6c969be | 23 | BleMsgHandler(Serial* _device, Serial* _hostpc); |
dudnwjs | 1:5cf3a6c969be | 24 | ~BleMsgHandler(void); |
dudnwjs | 0:a1f6b1ba8a1e | 25 | void PrintTitle(void); |
dudnwjs | 3:1e70387e1337 | 26 | void BleMsgAlloc(unsigned short id,unsigned short dest_id,unsigned short src_id,unsigned short data_len,void *pdata,uint8_t *msg); |
dudnwjs | 3:1e70387e1337 | 27 | int BleSendMsg(uint8_t *msg, unsigned short size); |
dudnwjs | 3:1e70387e1337 | 28 | void BleReceiveMsg(void); |
dudnwjs | 3:1e70387e1337 | 29 | void BleMsgHandle(void); |
dudnwjs | 0:a1f6b1ba8a1e | 30 | |
dudnwjs | 4:60be78a172c2 | 31 | |
dudnwjs | 0:a1f6b1ba8a1e | 32 | private: |
dudnwjs | 4:60be78a172c2 | 33 | void HandleGapmCmpEvt(unsigned short msgid,struct gapm_cmp_evt *param,unsigned short dest_id,unsigned short src_id); |
dudnwjs | 4:60be78a172c2 | 34 | void HandleGapcCmpEvt(unsigned short msgid,struct gapc_cmp_evt *param,unsigned short dest_id,unsigned short src_id); |
dudnwjs | 0:a1f6b1ba8a1e | 35 | bool print_flag; |
dudnwjs | 0:a1f6b1ba8a1e | 36 | Serial* device; |
dudnwjs | 0:a1f6b1ba8a1e | 37 | Serial* hostpc; |
dudnwjs | 2:dba344c91bce | 38 | SerialManager* SerialM; |
dudnwjs | 3:1e70387e1337 | 39 | MsgQueue* MsgQ; |
dudnwjs | 3:1e70387e1337 | 40 | unsigned char recv_msg[512]; |
dudnwjs | 1:5cf3a6c969be | 41 | }; |
dudnwjs | 0:a1f6b1ba8a1e | 42 | |
dudnwjs | 0:a1f6b1ba8a1e | 43 | }//namespace |
dudnwjs | 0:a1f6b1ba8a1e | 44 | |
dudnwjs | 1:5cf3a6c969be | 45 | #endif //BLEMSGHANDLER_H |