BLE fota Lamp Demo
Dependencies: mbed-rtos mbed mbed_fota_fan_control
Fork of mbed_fota_fan_control by
ext_fota/BleMsgHandler.h@5:e11b23f9aacc, 2015-07-13 (annotated)
- Committer:
- dudnwjs
- Date:
- Mon Jul 13 06:32:05 2015 +0000
- Revision:
- 5:e11b23f9aacc
- Parent:
- 4:60be78a172c2
- Child:
- 6:8dd20294b2aa
Fota Service Add complete
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 | 5:e11b23f9aacc | 30 | void HostPcPrint(char *str); |
dudnwjs | 5:e11b23f9aacc | 31 | void ReceiveToSerialTest(void); |
dudnwjs | 0:a1f6b1ba8a1e | 32 | |
dudnwjs | 4:60be78a172c2 | 33 | |
dudnwjs | 0:a1f6b1ba8a1e | 34 | private: |
dudnwjs | 4:60be78a172c2 | 35 | void HandleGapmCmpEvt(unsigned short msgid,struct gapm_cmp_evt *param,unsigned short dest_id,unsigned short src_id); |
dudnwjs | 4:60be78a172c2 | 36 | void HandleGapcCmpEvt(unsigned short msgid,struct gapc_cmp_evt *param,unsigned short dest_id,unsigned short src_id); |
dudnwjs | 0:a1f6b1ba8a1e | 37 | bool print_flag; |
dudnwjs | 0:a1f6b1ba8a1e | 38 | Serial* device; |
dudnwjs | 0:a1f6b1ba8a1e | 39 | Serial* hostpc; |
dudnwjs | 2:dba344c91bce | 40 | SerialManager* SerialM; |
dudnwjs | 3:1e70387e1337 | 41 | MsgQueue* MsgQ; |
dudnwjs | 3:1e70387e1337 | 42 | unsigned char recv_msg[512]; |
dudnwjs | 1:5cf3a6c969be | 43 | }; |
dudnwjs | 0:a1f6b1ba8a1e | 44 | |
dudnwjs | 0:a1f6b1ba8a1e | 45 | }//namespace |
dudnwjs | 0:a1f6b1ba8a1e | 46 | |
dudnwjs | 1:5cf3a6c969be | 47 | #endif //BLEMSGHANDLER_H |