Projet Drone de surveillance du labo TRSE (INGESUP)
Dependencies: mbed PID ADXL345 Camera_LS_Y201 ITG3200 RangeFinder mbos xbee_lib Motor Servo
Service/Buffer_Trame.h@23:7f5681d8d5b5, 2013-04-03 (annotated)
- Committer:
- IngesupMbed01
- Date:
- Wed Apr 03 10:36:21 2013 +0000
- Revision:
- 23:7f5681d8d5b5
- Parent:
- 22:d2adbcc3580d
- Child:
- 26:814d9b08aa68
Buffer Trame fini
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
IngesupMbed01 | 22:d2adbcc3580d | 1 | /* Copyright (c) 2012 - 2013 AUTEUR |
IngesupMbed01 | 22:d2adbcc3580d | 2 | * |
IngesupMbed01 | 22:d2adbcc3580d | 3 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED |
IngesupMbed01 | 22:d2adbcc3580d | 4 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
IngesupMbed01 | 22:d2adbcc3580d | 5 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT |
IngesupMbed01 | 22:d2adbcc3580d | 6 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
IngesupMbed01 | 22:d2adbcc3580d | 7 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
IngesupMbed01 | 22:d2adbcc3580d | 8 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
IngesupMbed01 | 22:d2adbcc3580d | 9 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
IngesupMbed01 | 22:d2adbcc3580d | 10 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
IngesupMbed01 | 22:d2adbcc3580d | 11 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
IngesupMbed01 | 22:d2adbcc3580d | 12 | */ |
IngesupMbed01 | 22:d2adbcc3580d | 13 | |
IngesupMbed01 | 22:d2adbcc3580d | 14 | /* |
IngesupMbed01 | 22:d2adbcc3580d | 15 | * Description : Cette classe contient les fonctionnalités d'un buffer de trame. |
IngesupMbed01 | 22:d2adbcc3580d | 16 | * Input |
IngesupMbed01 | 22:d2adbcc3580d | 17 | * Output |
IngesupMbed01 | 22:d2adbcc3580d | 18 | */ |
IngesupMbed01 | 22:d2adbcc3580d | 19 | |
IngesupMbed01 | 22:d2adbcc3580d | 20 | |
IngesupMbed01 | 22:d2adbcc3580d | 21 | #ifndef BUFFER_TRAME_H |
IngesupMbed01 | 22:d2adbcc3580d | 22 | #define BUFFER_TRAME_H |
IngesupMbed01 | 22:d2adbcc3580d | 23 | |
IngesupMbed01 | 22:d2adbcc3580d | 24 | #include "mbos.h" |
IngesupMbed01 | 22:d2adbcc3580d | 25 | |
IngesupMbed01 | 23:7f5681d8d5b5 | 26 | #define default_size 50 |
IngesupMbed01 | 23:7f5681d8d5b5 | 27 | |
IngesupMbed01 | 22:d2adbcc3580d | 28 | typedef struct { |
IngesupMbed01 | 22:d2adbcc3580d | 29 | char identifier; |
IngesupMbed01 | 22:d2adbcc3580d | 30 | char data [8]; |
IngesupMbed01 | 22:d2adbcc3580d | 31 | }frame; |
IngesupMbed01 | 22:d2adbcc3580d | 32 | |
IngesupMbed01 | 22:d2adbcc3580d | 33 | class C_FrameBuffer { |
IngesupMbed01 | 22:d2adbcc3580d | 34 | |
IngesupMbed01 | 22:d2adbcc3580d | 35 | private : |
IngesupMbed01 | 22:d2adbcc3580d | 36 | /* ATTRIBUTS */ |
IngesupMbed01 | 23:7f5681d8d5b5 | 37 | frame * m_frameBuffer; |
IngesupMbed01 | 23:7f5681d8d5b5 | 38 | unsigned int m_currentReadIndex; |
IngesupMbed01 | 23:7f5681d8d5b5 | 39 | unsigned int m_currentWriteIndex; |
IngesupMbed01 | 23:7f5681d8d5b5 | 40 | unsigned int m_maxSize; |
IngesupMbed01 | 23:7f5681d8d5b5 | 41 | |
IngesupMbed01 | 22:d2adbcc3580d | 42 | public : |
IngesupMbed01 | 22:d2adbcc3580d | 43 | /* CONSTRUCTEUR(S) */ |
IngesupMbed01 | 22:d2adbcc3580d | 44 | C_FrameBuffer(); |
IngesupMbed01 | 23:7f5681d8d5b5 | 45 | C_FrameBuffer(unsigned int size); |
IngesupMbed01 | 22:d2adbcc3580d | 46 | |
IngesupMbed01 | 22:d2adbcc3580d | 47 | /* DESTRUCTEUR */ |
IngesupMbed01 | 22:d2adbcc3580d | 48 | ~C_FrameBuffer(); |
IngesupMbed01 | 22:d2adbcc3580d | 49 | |
IngesupMbed01 | 23:7f5681d8d5b5 | 50 | /* Propriétés */ |
IngesupMbed01 | 23:7f5681d8d5b5 | 51 | void frameBuffer(frame newFrame); |
IngesupMbed01 | 23:7f5681d8d5b5 | 52 | frame frameBuffer(void); |
IngesupMbed01 | 23:7f5681d8d5b5 | 53 | frame frameBuffer(unsigned int index); |
IngesupMbed01 | 23:7f5681d8d5b5 | 54 | unsigned int maxSize(void); |
IngesupMbed01 | 23:7f5681d8d5b5 | 55 | unsigned int currentReadIndex(void); |
IngesupMbed01 | 23:7f5681d8d5b5 | 56 | void currentReadIndex(unsigned int newIndex); |
IngesupMbed01 | 23:7f5681d8d5b5 | 57 | unsigned int currentWriteIndex(void); |
IngesupMbed01 | 23:7f5681d8d5b5 | 58 | void currentWriteIndex(unsigned int newIndex); |
IngesupMbed01 | 22:d2adbcc3580d | 59 | }; |
IngesupMbed01 | 22:d2adbcc3580d | 60 | |
IngesupMbed01 | 22:d2adbcc3580d | 61 | #endif |