erratic/packet.h
1
25#ifndef _PACKET_H
26#define _PACKET_H
27
28#include <string.h>
29#include <libplayercore/playercore.h>
30//#include <stdint.h>
31
32#define PACKET_LEN 256
33
34enum receive_result_e {
35 success = 0,
36 failure = 1,
37 timeout = 2
38};
39
40
42{
43 public:
44 unsigned char packet[PACKET_LEN];
45 unsigned char size;
46
47 uint16_t CalcChkSum();
48
49 void Print();
50 void PrintHex();
51 int Build( unsigned char *data, unsigned char datasize );
52 int Send( int fd );
53 int Receive( int fd, uint16_t wait = 30 );
54 bool Check();
55
56 bool operator!= ( ErraticPacket p ) {
57 if ( size != p.size) return(true);
58
59 if ( memcmp( packet, p.packet, size ) != 0 ) return (true);
60
61 return(false);
62 }
63};
64
65#endif
Definition erratic/packet.h:42
void Print()
Copyright (C) 2006 Videre Design Copyright (C) 2000 Brian Gerkey, Kasper Stoy, Richard Vaughan,...
Definition erratic/packet.cc:39