ex
Fork of mbed-os-example-mbed5-blinky by
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/shared_buffer.h@47:9e361da97763, 2017-07-18 (annotated)
- Committer:
- TMBOY
- Date:
- Tue Jul 18 16:54:45 2017 +0800
- Revision:
- 47:9e361da97763
?
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| TMBOY | 47:9e361da97763 | 1 | #pragma once |
| TMBOY | 47:9e361da97763 | 2 | #include "rtos.h" |
| TMBOY | 47:9e361da97763 | 3 | |
| TMBOY | 47:9e361da97763 | 4 | class SharedBuffer |
| TMBOY | 47:9e361da97763 | 5 | { |
| TMBOY | 47:9e361da97763 | 6 | public: |
| TMBOY | 47:9e361da97763 | 7 | SharedBuffer(unsigned int size); |
| TMBOY | 47:9e361da97763 | 8 | ~SharedBuffer(); |
| TMBOY | 47:9e361da97763 | 9 | unsigned int read(unsigned char out[], unsigned int size); |
| TMBOY | 47:9e361da97763 | 10 | unsigned int write(const unsigned char in[], unsigned int size); |
| TMBOY | 47:9e361da97763 | 11 | void wait(); |
| TMBOY | 47:9e361da97763 | 12 | private: |
| TMBOY | 47:9e361da97763 | 13 | unsigned int m_nBufferSize; |
| TMBOY | 47:9e361da97763 | 14 | unsigned int m_nWriteOffset; |
| TMBOY | 47:9e361da97763 | 15 | unsigned int m_nDataSize; |
| TMBOY | 47:9e361da97763 | 16 | unsigned char *m_pBuffer; |
| TMBOY | 47:9e361da97763 | 17 | rtos::Semaphore sem_Read; |
| TMBOY | 47:9e361da97763 | 18 | rtos::Semaphore sem_Write; |
| TMBOY | 47:9e361da97763 | 19 | }; |
