summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/proto/proto.hh
diff options
context:
space:
mode:
authorschodet2005-04-10 20:13:20 +0000
committerschodet2005-04-10 20:13:20 +0000
commit7339bed6bcf4de3a79b6b361559b1f74d3f933a8 (patch)
tree8a612a6897279736548e4e020b068be6549cdf85 /2005/i/robert/src/proto/proto.hh
parent976b5047eef9b56956ef5bcc392c0c2730f4f331 (diff)
Tests ok. Reste les renvois sur erreur.
Diffstat (limited to '2005/i/robert/src/proto/proto.hh')
-rw-r--r--2005/i/robert/src/proto/proto.hh23
1 files changed, 15 insertions, 8 deletions
diff --git a/2005/i/robert/src/proto/proto.hh b/2005/i/robert/src/proto/proto.hh
index 0a2099b..7b249d1 100644
--- a/2005/i/robert/src/proto/proto.hh
+++ b/2005/i/robert/src/proto/proto.hh
@@ -25,15 +25,17 @@
//
// }}}
-#include<queue>
-#include<stdint.h>
#include "utils/non_copyable.hh"
#include "serial/serial.hh"
+#include "log/log.hh"
+
+#include <queue>
+#include <stdint.h>
/// Classe de dialogue avec une carte électronique par le port série.
class Proto : public NonCopyable
{
- public:
+ public:
class Receiver;
/// Packet.
struct Frame
@@ -42,7 +44,8 @@ class Proto : public NonCopyable
std::vector<uint8_t> args;
bool operator==(const Frame& frame);
};
- private:
+ private:
+ Log log_;
Serial serial_;
Receiver &receiver_;
@@ -74,15 +77,15 @@ class Proto : public NonCopyable
/// le faire.
bool sync (void);
/// Envois un packet.
- void send (const Frame &frame, bool fiable = true);
+ void send (const Frame &frame, bool reliable = true);
/// Envois un packet. COMMAND est la commande à envoyer, FORMAT, donne le
/// format et le nombre de paramètres ('b' : 8 bits, 'w' : 16 bits, 'd' :
/// 32 bits, majuscule pour signé).
void send (char command, const char *format = 0, int a0 = 0, int a1 = 0,
- int a2 = 0, int a3 = 0, bool fiable = true);
+ int a2 = 0, int a3 = 0, bool reliable = true);
/// permet d'envoyer un packet robert
- void Proto::send_pas_fiable (char command, const char *format, int a0,
- int a1, int a2, int a3);
+ void Proto::sendUnreliable (char command, const char *format, int a0,
+ int a1, int a2, int a3);
//@{
/// Teste si le packet correspond au format et décode les valeurs. Utilise
/// le même format que send.
@@ -121,4 +124,8 @@ class Proto : public NonCopyable
int &a1, int &a2, int &a3);
};
+/// Affiche une frame.
+std::ostream &
+operator<< (std::ostream &os, const Proto::Frame &f);
+
#endif // proto_hh