Projet S5 Info / Mbed 2 deprecated Projet-xbee-mbed_fixe

Dependencies:   mbed

Fork of APP4 by S5info_H14

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers coordinateur.hpp Source File

coordinateur.hpp

00001 #ifndef COORDINATEUR_HPP
00002 #define COORDINATEUR_HPP
00003 
00004 #include <string>
00005 #include "trame.hpp"
00006 
00007 using namespace std;
00008 
00009 /* Description de la classe Coordinateur
00010 *
00011 *  La classe Coordinateur configure le coordinateur, reçoit les trames du routeurs et envoie les informations à un site web
00012 *
00013 */ 
00014 class Coordinateur
00015 {
00016 public:
00017     // Enum pour la machine d'état qui reconstruit les trames reçues
00018     enum Etat { Start, Length, Length2, Data };
00019 
00020     // Constructeur
00021     Coordinateur(PinName _tx, PinName _rx);
00022     // Destructeur
00023     ~Coordinateur();
00024     
00025     // Set le réseau du coordinateur
00026     void setPanID(string _pan);
00027     // Attend de recevoir les trames
00028     void getBytes();
00029     
00030 private:
00031     // Machine à état qui reçoit les trames
00032     void etatTrame(char c);
00033     
00034     Trame trame;
00035     Serial xbee;
00036     Etat etat;
00037     char length[2];
00038     int length_int;
00039     int counter;
00040     char *data;
00041 };
00042 
00043 #endif