BLE fota Lamp Demo
Dependencies: mbed-rtos mbed mbed_fota_fan_control
Fork of mbed_fota_fan_control by
ext_fota/BleMsgHandler.h@3:1e70387e1337, 2015-06-23 (annotated)
- Committer:
- dudnwjs
- Date:
- Tue Jun 23 06:32:40 2015 +0000
- Revision:
- 3:1e70387e1337
- Parent:
- 2:dba344c91bce
- Child:
- 4:60be78a172c2
Add feature : Msg Sender, Msg Receiver (using Serial);
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 | 0:a1f6b1ba8a1e | 7 | |
dudnwjs | 0:a1f6b1ba8a1e | 8 | namespace sevencore_fota{ |
dudnwjs | 0:a1f6b1ba8a1e | 9 | |
dudnwjs | 3:1e70387e1337 | 10 | typedef struct { |
dudnwjs | 3:1e70387e1337 | 11 | unsigned short bType; |
dudnwjs | 3:1e70387e1337 | 12 | unsigned short bDstid; |
dudnwjs | 3:1e70387e1337 | 13 | unsigned short bSrcid; |
dudnwjs | 3:1e70387e1337 | 14 | unsigned short bLength; |
dudnwjs | 3:1e70387e1337 | 15 | } ble_hdr; |
dudnwjs | 3:1e70387e1337 | 16 | |
dudnwjs | 1:5cf3a6c969be | 17 | class BleMsgHandler |
dudnwjs | 0:a1f6b1ba8a1e | 18 | { |
dudnwjs | 0:a1f6b1ba8a1e | 19 | public: |
dudnwjs | 1:5cf3a6c969be | 20 | BleMsgHandler(Serial* _device); |
dudnwjs | 1:5cf3a6c969be | 21 | BleMsgHandler(Serial* _device, Serial* _hostpc); |
dudnwjs | 1:5cf3a6c969be | 22 | ~BleMsgHandler(void); |
dudnwjs | 0:a1f6b1ba8a1e | 23 | void PrintTitle(void); |
dudnwjs | 3:1e70387e1337 | 24 | 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 | 25 | int BleSendMsg(uint8_t *msg, unsigned short size); |
dudnwjs | 3:1e70387e1337 | 26 | void BleReceiveMsg(void); |
dudnwjs | 3:1e70387e1337 | 27 | void BleMsgHandle(void); |
dudnwjs | 0:a1f6b1ba8a1e | 28 | |
dudnwjs | 0:a1f6b1ba8a1e | 29 | private: |
dudnwjs | 0:a1f6b1ba8a1e | 30 | bool print_flag; |
dudnwjs | 0:a1f6b1ba8a1e | 31 | Serial* device; |
dudnwjs | 0:a1f6b1ba8a1e | 32 | Serial* hostpc; |
dudnwjs | 2:dba344c91bce | 33 | SerialManager* SerialM; |
dudnwjs | 3:1e70387e1337 | 34 | MsgQueue* MsgQ; |
dudnwjs | 3:1e70387e1337 | 35 | unsigned char recv_msg[512]; |
dudnwjs | 1:5cf3a6c969be | 36 | }; |
dudnwjs | 0:a1f6b1ba8a1e | 37 | |
dudnwjs | 0:a1f6b1ba8a1e | 38 | }//namespace |
dudnwjs | 0:a1f6b1ba8a1e | 39 | |
dudnwjs | 1:5cf3a6c969be | 40 | #endif //BLEMSGHANDLER_H |