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@36:1bbd2fb7d2c8, 2014-03-19 (annotated)
- Committer:
- Gaetan
- Date:
- Wed Mar 19 11:01:10 2014 +0000
- Revision:
- 36:1bbd2fb7d2c8
- Parent:
- 30:119e060b45b3
Checksum correct pour l'envoi de n'importe quel message Mavlink. Reste ? g?rer la reception de messages
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 | 30:119e060b45b3 | 29 | char systemIdentifier; |
IngesupMbed01 | 30:119e060b45b3 | 30 | char moduleIdentifier; |
IngesupMbed01 | 30:119e060b45b3 | 31 | char messageIdentifier; |
IngesupMbed01 | 30:119e060b45b3 | 32 | char data [12]; |
IngesupMbed01 | 22:d2adbcc3580d | 33 | }frame; |
IngesupMbed01 | 22:d2adbcc3580d | 34 | |
IngesupMbed01 | 22:d2adbcc3580d | 35 | class C_FrameBuffer { |
IngesupMbed01 | 22:d2adbcc3580d | 36 | |
IngesupMbed01 | 22:d2adbcc3580d | 37 | private : |
IngesupMbed01 | 22:d2adbcc3580d | 38 | /* ATTRIBUTS */ |
IngesupMbed01 | 23:7f5681d8d5b5 | 39 | frame * m_frameBuffer; |
IngesupMbed01 | 23:7f5681d8d5b5 | 40 | unsigned int m_currentReadIndex; |
IngesupMbed01 | 23:7f5681d8d5b5 | 41 | unsigned int m_currentWriteIndex; |
IngesupMbed01 | 26:814d9b08aa68 | 42 | unsigned int m_numberMessage; |
IngesupMbed01 | 23:7f5681d8d5b5 | 43 | unsigned int m_maxSize; |
IngesupMbed01 | 23:7f5681d8d5b5 | 44 | |
IngesupMbed01 | 22:d2adbcc3580d | 45 | public : |
IngesupMbed01 | 22:d2adbcc3580d | 46 | /* CONSTRUCTEUR(S) */ |
IngesupMbed01 | 22:d2adbcc3580d | 47 | C_FrameBuffer(); |
IngesupMbed01 | 23:7f5681d8d5b5 | 48 | C_FrameBuffer(unsigned int size); |
IngesupMbed01 | 22:d2adbcc3580d | 49 | |
IngesupMbed01 | 22:d2adbcc3580d | 50 | /* DESTRUCTEUR */ |
IngesupMbed01 | 22:d2adbcc3580d | 51 | ~C_FrameBuffer(); |
IngesupMbed01 | 22:d2adbcc3580d | 52 | |
IngesupMbed01 | 23:7f5681d8d5b5 | 53 | /* Propriétés */ |
IngesupMbed01 | 23:7f5681d8d5b5 | 54 | void frameBuffer(frame newFrame); |
IngesupMbed01 | 23:7f5681d8d5b5 | 55 | frame frameBuffer(void); |
IngesupMbed01 | 23:7f5681d8d5b5 | 56 | unsigned int maxSize(void); |
IngesupMbed01 | 23:7f5681d8d5b5 | 57 | unsigned int currentReadIndex(void); |
IngesupMbed01 | 23:7f5681d8d5b5 | 58 | unsigned int currentWriteIndex(void); |
IngesupMbed01 | 26:814d9b08aa68 | 59 | unsigned int numberMessage(void); |
IngesupMbed01 | 22:d2adbcc3580d | 60 | }; |
IngesupMbed01 | 22:d2adbcc3580d | 61 | |
IngesupMbed01 | 22:d2adbcc3580d | 62 | #endif |