-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.hh
64 lines (51 loc) · 1.55 KB
/
common.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <string>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sstream>
#include <vector>
#include <sys/wait.h>
#include <atomic>
#include <filesystem>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netdb.h>
#include <fcntl.h>
#include <pthread.h>
#include <errno.h>
#include "tinyxml2.cpp"
#include "robot.cpp"
const int PORT = 4242;
const int MAXDATASIZE = 256; //numero de bytes que se pueden recibir
const int HEADER_LEN = sizeof(unsigned short)*3;
const int MAXROBOTS = 4;
const char IP_SERVER[] = "192.168.2.2";
/*//direcciones IP del servidor y de los distintos robots
const char arduino1[] ="192.168.2.5";
const char arduino2[] ="192.168.2.6";
const char arduino3[] ="192.168.2.7";
const char arduino4[] ="192.168.2.8";
const char arduino5[] ="192.168.2.9";
*/
struct appdata{
unsigned short id; //identificador
unsigned short op; //codigo de operacion
unsigned short len; /* longitud de datos */
char data [MAXDATASIZE-HEADER_LEN];//datos
//nota¡ actualizar char data a string o puntero para que sea mas versatil.
};
//operacion error
#define OP_ERROR 0xFFFF
//operaciones requeridas por central
#define OP_SALUDO 0x0001
#define OP_MOVE_WHEEL 0x0002
#define OP_STOP_WHEEL 0x0003
//operaciones cliente
#define OP_MESSAGE_RECIVE 0x0004
//saludo esta en ambas
struct appdata *operation_recv;//message received of operation
struct appdata operation_send;