summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/proto/proto.cc
diff options
context:
space:
mode:
Diffstat (limited to '2005/i/robert/src/proto/proto.cc')
-rw-r--r--2005/i/robert/src/proto/proto.cc16
1 files changed, 7 insertions, 9 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));