summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/proto
diff options
context:
space:
mode:
authordufourj2006-01-11 16:22:49 +0000
committerdufourj2006-01-11 16:22:49 +0000
commita8e25e107bfd486b945f656d5358b63259799909 (patch)
treeba3221ffb7ba784e0fb81ec67f5aa2dc37984d86 /2005/i/robert/src/proto
parentd4fa4d87eb2040a6da63d5570893218f3dd2dc5c (diff)
Correction des syncs
Diffstat (limited to '2005/i/robert/src/proto')
-rw-r--r--2005/i/robert/src/proto/proto.cc16
-rw-r--r--2005/i/robert/src/proto/proto.hh2
2 files changed, 8 insertions, 10 deletions
diff --git a/2005/i/robert/src/proto/proto.cc b/2005/i/robert/src/proto/proto.cc
index a7ada32..3569a47 100644
--- a/2005/i/robert/src/proto/proto.cc
+++ b/2005/i/robert/src/proto/proto.cc
@@ -56,11 +56,10 @@ Proto::close(void)
bool
Proto::sync(void)
{
- bool reGet;
// Récupération de la frame
- while (reGet = getFrame())
+ while (getFrame())
{
- //log_ ("recv") << "frame" << currentFrame_;
+// log_ ("recv") << "frame" << currentFrame_;
// Si la frame est un aquittement
if(currentFrame_ == frameQueue_.front())
{
@@ -96,7 +95,6 @@ Proto::send (const Frame & frame, bool reliable)
}
else
sendFrame(frame);
- // XXX sync();
}
@@ -197,7 +195,8 @@ bool
Proto::wait (int timeout/*-1*/)
{
// On apelle serial_.wait avec un timeout toujours inf ou égal à proto::timeout_
- return serial_.wait (timeout < timeout_ ? timeout : timeout_);
+ serial_.wait (timeout < timeout_ && timeout != -1 ? timeout : timeout_);
+ return sync ();
}
/// Récupère le File Descriptor
@@ -241,7 +240,6 @@ Proto::getFrame(void)
currentFrame_.command = receivedChar;
revState_ = 2;
}
- // On vérifie que le match n'est pas fini
break;
case 2:
d = hex2digit (receivedChar);
@@ -270,7 +268,7 @@ Proto::getFrame(void)
{
// On renvoie en mettant le compteur à 0, la commande sera
// renvoyer de retour à sync
- //log_("Erreur de reception") << "commande inconnue" << "";
+// log_("Erreur de reception") << "commande inconnue" << "";
tLastSend_ = 0;
revState_ = 0;
return false;
@@ -283,7 +281,7 @@ Proto::getFrame(void)
void
Proto::sendFrame(const Frame & frame)
{
- //log_ ("send") << "frame" << frame;
+// log_ ("send") << "frame" << frame;
// envoyer le bang
serial_.putchar('!');
@@ -292,7 +290,7 @@ Proto::sendFrame(const Frame & frame)
// Envoyer les arguments
for(std::vector<uint8_t>::const_iterator it = frame.args.begin();
- it != frame.args.end(); it++)
+ it != frame.args.end(); ++it)
{
serial_.putchar(digit2hex(*it >> 4));
serial_.putchar(digit2hex(*it & 0x0f));
diff --git a/2005/i/robert/src/proto/proto.hh b/2005/i/robert/src/proto/proto.hh
index 11b1ae3..47ef9a0 100644
--- a/2005/i/robert/src/proto/proto.hh
+++ b/2005/i/robert/src/proto/proto.hh
@@ -55,7 +55,7 @@ class Proto : public NonCopyable
//Date du dernier envoie
int tLastSend_;
//Temps entre les ré-émission
- static const int timeout_ = 500;
+ static const int timeout_ = 100;
/// Frame en cours de réception
Frame currentFrame_;