![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
BLE fota Lamp Demo
Dependencies: mbed-rtos mbed mbed_fota_fan_control
Fork of mbed_fota_fan_control by
ext_fota/MsgQueue.h@13:e714e2971c49, 2015-10-13 (annotated)
- Committer:
- dudnwjs
- Date:
- Tue Oct 13 06:35:19 2015 +0000
- Revision:
- 13:e714e2971c49
- Parent:
- 8:9eec2c246a85
lamp demo;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dudnwjs | 8:9eec2c246a85 | 1 | /** |
dudnwjs | 8:9eec2c246a85 | 2 | * @file MsgQueue.h |
dudnwjs | 8:9eec2c246a85 | 3 | * @brief Ble message queue |
dudnwjs | 8:9eec2c246a85 | 4 | * Copyright 2015 SEVENCORE Co., Ltd. |
dudnwjs | 8:9eec2c246a85 | 5 | * |
dudnwjs | 8:9eec2c246a85 | 6 | * @author HyeongJun Kim |
dudnwjs | 8:9eec2c246a85 | 7 | * @version 1.0.0 |
dudnwjs | 8:9eec2c246a85 | 8 | * @date 2015-08-19 |
dudnwjs | 8:9eec2c246a85 | 9 | */ |
dudnwjs | 8:9eec2c246a85 | 10 | |
dudnwjs | 0:a1f6b1ba8a1e | 11 | #ifndef MSGQUEUE_H |
dudnwjs | 0:a1f6b1ba8a1e | 12 | #define MSGQUEUE_H |
dudnwjs | 8:9eec2c246a85 | 13 | /** |
dudnwjs | 8:9eec2c246a85 | 14 | **************************************************************************************** |
dudnwjs | 8:9eec2c246a85 | 15 | * @addtogroup ext_fota module |
dudnwjs | 8:9eec2c246a85 | 16 | * @brief Ble message Queue Class Header. |
dudnwjs | 8:9eec2c246a85 | 17 | * |
dudnwjs | 8:9eec2c246a85 | 18 | * @{ |
dudnwjs | 8:9eec2c246a85 | 19 | **************************************************************************************** |
dudnwjs | 8:9eec2c246a85 | 20 | */ |
dudnwjs | 0:a1f6b1ba8a1e | 21 | namespace sevencore_fota{ |
dudnwjs | 0:a1f6b1ba8a1e | 22 | |
dudnwjs | 0:a1f6b1ba8a1e | 23 | struct Element |
dudnwjs | 0:a1f6b1ba8a1e | 24 | { |
dudnwjs | 0:a1f6b1ba8a1e | 25 | void *Data; |
dudnwjs | 0:a1f6b1ba8a1e | 26 | struct Element *Next; |
dudnwjs | 0:a1f6b1ba8a1e | 27 | }; |
dudnwjs | 0:a1f6b1ba8a1e | 28 | |
dudnwjs | 1:5cf3a6c969be | 29 | class MsgQueue |
dudnwjs | 0:a1f6b1ba8a1e | 30 | { |
dudnwjs | 0:a1f6b1ba8a1e | 31 | public: |
dudnwjs | 8:9eec2c246a85 | 32 | /** |
dudnwjs | 8:9eec2c246a85 | 33 | **************************************************************************************** |
dudnwjs | 8:9eec2c246a85 | 34 | * @brief Ble message queue constructor |
dudnwjs | 8:9eec2c246a85 | 35 | **************************************************************************************** |
dudnwjs | 8:9eec2c246a85 | 36 | */ |
dudnwjs | 1:5cf3a6c969be | 37 | MsgQueue(int MaxSize = 512); |
dudnwjs | 8:9eec2c246a85 | 38 | /** |
dudnwjs | 8:9eec2c246a85 | 39 | **************************************************************************************** |
dudnwjs | 8:9eec2c246a85 | 40 | * @brief Ble message queue destructor |
dudnwjs | 8:9eec2c246a85 | 41 | **************************************************************************************** |
dudnwjs | 8:9eec2c246a85 | 42 | */ |
dudnwjs | 1:5cf3a6c969be | 43 | ~MsgQueue(void); |
dudnwjs | 8:9eec2c246a85 | 44 | /** |
dudnwjs | 8:9eec2c246a85 | 45 | **************************************************************************************** |
dudnwjs | 8:9eec2c246a85 | 46 | * @brief Add message in queue |
dudnwjs | 8:9eec2c246a85 | 47 | **************************************************************************************** |
dudnwjs | 8:9eec2c246a85 | 48 | */ |
dudnwjs | 0:a1f6b1ba8a1e | 49 | void EnQueue(void *vData); |
dudnwjs | 8:9eec2c246a85 | 50 | /** |
dudnwjs | 8:9eec2c246a85 | 51 | **************************************************************************************** |
dudnwjs | 8:9eec2c246a85 | 52 | * @brief Remove message in queue |
dudnwjs | 8:9eec2c246a85 | 53 | **************************************************************************************** |
dudnwjs | 8:9eec2c246a85 | 54 | */ |
dudnwjs | 0:a1f6b1ba8a1e | 55 | void *DeQueue(void); |
dudnwjs | 8:9eec2c246a85 | 56 | /** |
dudnwjs | 8:9eec2c246a85 | 57 | **************************************************************************************** |
dudnwjs | 8:9eec2c246a85 | 58 | * @brief Return queue element count |
dudnwjs | 8:9eec2c246a85 | 59 | **************************************************************************************** |
dudnwjs | 8:9eec2c246a85 | 60 | */ |
dudnwjs | 0:a1f6b1ba8a1e | 61 | int GetElementCount(void); |
dudnwjs | 8:9eec2c246a85 | 62 | /** |
dudnwjs | 8:9eec2c246a85 | 63 | **************************************************************************************** |
dudnwjs | 8:9eec2c246a85 | 64 | * @brief Boolean that queue is empty |
dudnwjs | 8:9eec2c246a85 | 65 | **************************************************************************************** |
dudnwjs | 8:9eec2c246a85 | 66 | */ |
dudnwjs | 0:a1f6b1ba8a1e | 67 | bool IsEmpty(void); |
dudnwjs | 0:a1f6b1ba8a1e | 68 | |
dudnwjs | 0:a1f6b1ba8a1e | 69 | private: |
dudnwjs | 0:a1f6b1ba8a1e | 70 | Element *Front; |
dudnwjs | 0:a1f6b1ba8a1e | 71 | Element *Rear; |
dudnwjs | 0:a1f6b1ba8a1e | 72 | const int MaxNum; |
dudnwjs | 0:a1f6b1ba8a1e | 73 | int ElemCnt; |
dudnwjs | 0:a1f6b1ba8a1e | 74 | |
dudnwjs | 0:a1f6b1ba8a1e | 75 | }; |
dudnwjs | 0:a1f6b1ba8a1e | 76 | |
dudnwjs | 0:a1f6b1ba8a1e | 77 | }//namespace |
dudnwjs | 0:a1f6b1ba8a1e | 78 | |
dudnwjs | 8:9eec2c246a85 | 79 | /// @} ext_fota module |
dudnwjs | 8:9eec2c246a85 | 80 | |
dudnwjs | 0:a1f6b1ba8a1e | 81 | #endif //MSG_QUEUE_H |
dudnwjs | 0:a1f6b1ba8a1e | 82 |