Polytech school project. RICM4 students, see http://air.imag.fr/index.php/Projets-2016-2017-Station_de_pompage_connect%C3%A9e for more information
Fork of SX1276PingPong by
trame.h@16:1643ac8ba29f, 2017-04-01 (annotated)
- Committer:
- chevamax
- Date:
- Sat Apr 01 12:14:27 2017 +0000
- Revision:
- 16:1643ac8ba29f
Version finale
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chevamax | 16:1643ac8ba29f | 1 | #ifndef __TRAME_H |
chevamax | 16:1643ac8ba29f | 2 | #define __TRAME_H |
chevamax | 16:1643ac8ba29f | 3 | |
chevamax | 16:1643ac8ba29f | 4 | #include "mbed.h" |
chevamax | 16:1643ac8ba29f | 5 | #define TAILLE_TRAME_DATA 5 //octets 3+1 for null char |
chevamax | 16:1643ac8ba29f | 6 | |
chevamax | 16:1643ac8ba29f | 7 | /** |
chevamax | 16:1643ac8ba29f | 8 | * Represente une trame de donnée |
chevamax | 16:1643ac8ba29f | 9 | **/ |
chevamax | 16:1643ac8ba29f | 10 | class TrameData { |
chevamax | 16:1643ac8ba29f | 11 | private: |
chevamax | 16:1643ac8ba29f | 12 | char idEmetteur; // 1 octet |
chevamax | 16:1643ac8ba29f | 13 | char idStation; //1 octet |
chevamax | 16:1643ac8ba29f | 14 | char etatPompe; //1 bit |
chevamax | 16:1643ac8ba29f | 15 | char nombreNiveau; //5 bits |
chevamax | 16:1643ac8ba29f | 16 | char niveauCuve; //5 bits |
chevamax | 16:1643ac8ba29f | 17 | char niveauBatterie; //4bits |
chevamax | 16:1643ac8ba29f | 18 | char trame[TAILLE_TRAME_DATA]; |
chevamax | 16:1643ac8ba29f | 19 | |
chevamax | 16:1643ac8ba29f | 20 | public: |
chevamax | 16:1643ac8ba29f | 21 | //Creer un objet trame a partir de parametres |
chevamax | 16:1643ac8ba29f | 22 | TrameData(char idE, char idS, int nbNiveau, char etatP, char niveau, char batterie); |
chevamax | 16:1643ac8ba29f | 23 | |
chevamax | 16:1643ac8ba29f | 24 | //Creer un objet trame a partir d'un tableau de caracteres (ici le buffer) |
chevamax | 16:1643ac8ba29f | 25 | TrameData(char* Buff); |
chevamax | 16:1643ac8ba29f | 26 | |
chevamax | 16:1643ac8ba29f | 27 | //Retourne un tableau de char représentant la trame en binaire |
chevamax | 16:1643ac8ba29f | 28 | char* creerTrame(); |
chevamax | 16:1643ac8ba29f | 29 | |
chevamax | 16:1643ac8ba29f | 30 | //Mise a jour des differents champs |
chevamax | 16:1643ac8ba29f | 31 | void mettreAJourEtatPompe(char etatP); |
chevamax | 16:1643ac8ba29f | 32 | void mettreAJourNiveauCuve(char niveau); |
chevamax | 16:1643ac8ba29f | 33 | void mettreAJourNiveauBatterie(char niveau); |
chevamax | 16:1643ac8ba29f | 34 | |
chevamax | 16:1643ac8ba29f | 35 | //Getter |
chevamax | 16:1643ac8ba29f | 36 | char getIdEmetteur(); |
chevamax | 16:1643ac8ba29f | 37 | char getIdStation(); |
chevamax | 16:1643ac8ba29f | 38 | }; |
chevamax | 16:1643ac8ba29f | 39 | |
chevamax | 16:1643ac8ba29f | 40 | #endif // __TRAME_H |