Bibliotheques TP RT  1.0
Bibliotheque de support pour TP/RT
monitor.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 dimercur
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
26 #ifndef _MONITOR_H_
27 #define _MONITOR_H_
28 
29 #include <sys/types.h>
30 #include <sys/socket.h>
31 #include <netinet/in.h>
32 #include <arpa/inet.h>
33 #include <unistd.h>
34 #include <signal.h>
35 #include <stdlib.h>
36 #include <stdio.h>
37 #include <string.h>
38 #include "image.h"
39 #include "definitions.h"
40 
41 #define HEADER_STM_IMAGE "IMG" // Envoi d'une image
42 #define HEADER_STM_BAT "BAT" // Envoi de l'état de la batterie
43 #define HEADER_STM_POS "POS" // Envoi de la position
44 #define HEADER_STM_NO_ACK "NAK" // Acquittement d'un échec
45 #define HEADER_STM_ACK "ACK" // Acquittement d'un succès
46 #define HEADER_STM_MES "MSG" // Message textuel
47 #define HEADER_STM_LOST_DMB "LCD" // Perte de la communication avec le robot
48 
49 #define HEADER_MTS_MSG "MSG" // Message directe pour Console Dumber
50 #define HEADER_MTS_DMB_ORDER "DMB" // Message d'ordre pour le robot
51 #define HEADER_MTS_COM_DMB "COM" // Message de gestion de la communication avec le robot
52 #define HEADER_MTS_CAMERA "CAM" // Message de gestion de la camera
53 #define HEADER_MTS_STOP "STO" // Message d'arrêt du system
54 
55 #define INVALID_SOCKET -1
56 #define SOCKET_ERROR -1
57 
58 #define DEFAULT_PORT 8080
59 #define DEFAULT_PARITY 0
60 
61 #define DETECT_ARENA (1)
62 #define CHECK_ARENA (2)
63 #define NO_ARENA (3)
64 
65 #define DEFAULT_NODEJS_PATH "/usr/bin/nodejs"
66 #define DEFAULT_INTERFACE_FILE "./interface.js"
67 
68 #define closesocket(param) close(param)
69 
70 typedef int SOCKET;
71 typedef struct sockaddr_in SOCKADDR_IN;
72 typedef struct sockaddr SOCKADDR;
73 
74 typedef struct {
75  char header[4];
76  char data[100];
78 
91 int send_message_to_monitor(const char* typeMessage, const void * data = NULL);
92 
105 int receive_message_from_monitor(char *typeMessage, char *data);
106 
107 
108 #endif // _MONITOR_H_
int send_message_to_monitor(const char *typeMessage, const void *data=NULL)
Envoi d&#39;un message vers l&#39;interface graphique.
int SOCKET
Definition: monitor.h:70
struct sockaddr SOCKADDR
Definition: monitor.h:72
Functions for image treatment.
int receive_message_from_monitor(char *typeMessage, char *data)
Réception d&#39;un message. La fonction est bloquante et retourne par référence le type de message reçu (...
Various constants used in destjil project.
struct sockaddr_in SOCKADDR_IN
Definition: monitor.h:71