summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/proto/proto.hh
diff options
context:
space:
mode:
authorhaller2005-04-03 15:41:05 +0000
committerhaller2005-04-03 15:41:05 +0000
commit3e437f57e9bac0a4b9de8b556be0538e69fb200b (patch)
treec6d55c240806848bc9fd5e3013d09715d1a8b3e0 /2005/i/robert/src/proto/proto.hh
parent758187cf08f95b343756fcd803f9be05928802f3 (diff)
Ajout du fichier proto.cc
Modification de proto.hh:Ajout de fonctions et de variables privées
Diffstat (limited to '2005/i/robert/src/proto/proto.hh')
-rw-r--r--2005/i/robert/src/proto/proto.hh25
1 files changed, 25 insertions, 0 deletions
diff --git a/2005/i/robert/src/proto/proto.hh b/2005/i/robert/src/proto/proto.hh
index bea12ef..6c304c1 100644
--- a/2005/i/robert/src/proto/proto.hh
+++ b/2005/i/robert/src/proto/proto.hh
@@ -34,9 +34,20 @@ class Proto : public NonCopyable
struct Frame;
Serial serial_;
Receiver &receiver_;
+
/// File d'attente des messages à aquiter.
typedef std::queue<Frame> FrameQueue;
FrameQueue frameQueue_;
+ int tLastSend_; //Date du dernier envoie
+
+ /// Frame en cours de réception
+ Frame currentFrame_;
+ int revState_ = 0;
+ // Etat de la réception de la frame
+ // 0 - Rien reçu
+ // 1 - Bang reçu
+ // 2 - Commande reçu
+
public:
/// Constructeur.
Proto (Receiver &receiver);
@@ -81,6 +92,20 @@ class Proto : public NonCopyable
std::vector<uint8_t> args;
};
private:
+ /// Récupère les infos de l'AVR pour construire une frame
+ bool getFrame(void);
+ /// Envoie la frame dans l'AVR
+ void sendFrame(const Frame & frame);
+ /// Remplie une frame avec un argument
+ void newArgFrame(Frame & frame, char format, int arg);
+ /// Renvoie la taille necessaire du vecteur args pour un format donné
+ int ArgsFrameSize(const char *format,int nbArg = 0);
+ /// Renvoie la taille necessaire du vecteur args pour 1 argument
+ int ArgSize(char format);
+ /// Vérifie le format de la frame
+ bool verifyFrame(Frame &frame, const char *format, int nbArg);
+ /// Décode un argument
+ int decodeArg(const Frame & frame, const char *format, int numArg);
};
#endif // proto_hh