Player
Frontpage
Contents
User
Installation
Quick start
Supported devices
Tutorials
Utilities
Client libraries
FAQ
Help
Developer
Architecture
libplayercore
interfaces
libplayerdrivers
drivers
libplayercommon
libplayerutils
libplayersd
libplayertcp
libplayerxdr
TODO
Online
Homepage
Download
Project
Bugs
Help
server
drivers
mixed
erratic
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
34
enum
receive_result_e {
35
success = 0,
36
failure = 1,
37
timeout = 2
38
};
39
40
41
class
ErraticPacket
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
Last updated 12 September 2005 21:38:45