Commit 33777c91dc6b7ab89a21b08009ab2aa6d00b33f5
1 parent
0f1eb4c5
Test
Showing
20 changed files
with
25 additions
and
12 deletions
Show diff stats
Network/Makefile
1 | 1 | #include "http.h" |
2 | - | |
2 | +#include <stdlib.h> | |
3 | 3 | |
4 | 4 | void freePage(struct PageWeb** page) |
5 | 5 | { |
... | ... | @@ -76,7 +76,7 @@ void createPage(struct PageWeb** page, struct interface_info* interfaces[20]) |
76 | 76 | } |
77 | 77 | |
78 | 78 | strcat((*page)->html_contents,"</head><body><div class=\"container\"><h2>Interfaces Tangibles</h2><ul class=\"tableau\">"); |
79 | - strcat((*page)->html_contents,"<li class=\"table-entete\"><div class=\"col nom\">Interfaces</div><div class=\"col etat\">Etat</div></li>"); | |
79 | + strcat((*page)->html_contents,"<li class=\"table-entete\"><div class=\"col nom\">Interfaces</div><div class=\"col etat\">Etat</div><div class=\"col commande\">Commande</div></li>"); | |
80 | 80 | |
81 | 81 | int nbr_interfaces=0; |
82 | 82 | |
... | ... | @@ -101,9 +101,22 @@ void createPage(struct PageWeb** page, struct interface_info* interfaces[20]) |
101 | 101 | case(1): |
102 | 102 | strcat((*page)->html_contents,"</div>\n<div class=\"col etat\" style=\"color: green\" data-label=\"Etat\">Mode Eveillé</div>\n"); |
103 | 103 | break; |
104 | + } | |
105 | + if(interfaces[i]->commande>=0) | |
106 | + { | |
107 | + char tmp[10]; | |
108 | + sprintf(tmp, "%d", interfaces[i]->commande); | |
109 | + strcat((*page)->html_contents,"<div class=\"col commande\" data-label=\"Etat\">"); | |
110 | + strcat((*page)->html_contents,tmp); | |
111 | + strcat((*page)->html_contents,"%</div>\n"); | |
112 | + } | |
113 | + else | |
114 | + { | |
115 | + strcat((*page)->html_contents,"<div class=\"col commande\" style=\"color: grey\" data-label=\"Etat\">Inconnu</div>\n"); | |
104 | 116 | } |
105 | 117 | strcat((*page)->html_contents,"</li>"); |
106 | 118 | } |
119 | + | |
107 | 120 | } |
108 | 121 | } |
109 | 122 | ... | ... |
No preview for this file type
No preview for this file type
Threads/threadSocket.c
... | ... | @@ -118,29 +118,24 @@ int interfaceReponse(FILE* sockdial_stream, char packet[BUFF_SIZE], Arg_Thread* |
118 | 118 | return -1; |
119 | 119 | } |
120 | 120 | |
121 | - | |
122 | 121 | strcpy(buffer, "\x60\x00"); // Demande la commande en mémoire |
123 | 122 | |
124 | 123 | fprintf(sockdial_stream, "%s", buffer); // Transmission du message |
125 | 124 | |
126 | - | |
127 | 125 | fgets(packet, BUFF_SIZE, sockdial_stream); // Attente de reception du message |
128 | - | |
129 | - | |
130 | 126 | |
131 | 127 | if( strlen(packet)>=2 && (packet[0]&0xE0)==0x10 ) |
132 | - argument->interfaces[i]->commande = (packet[0]&0x01)*256+packet[1]; | |
128 | + argument->interfaces[i]->commande = (packet[0]&0x1F)*256+packet[1]; | |
133 | 129 | else |
134 | 130 | { |
135 | 131 | argument->interfaces[i]->commande = -1; |
136 | - return -1; // Si le message n'est pas reçu correctement | |
132 | + //return -1; // Si le message n'est pas reçu correctement | |
137 | 133 | } |
138 | 134 | |
139 | 135 | strcpy(buffer, "\xE0\x00"); // Signale la fin de l'interrogation |
140 | 136 | |
141 | - fprintf(sockdial_stream, "%s", buffer); // Transmission du message | |
137 | + fprintf(sockdial_stream, "%s", buffer); // Transmission du message | |
142 | 138 | |
143 | - | |
144 | 139 | pthread_mutex_unlock(&(argument->requete_mutex)); // Libération de la section critique |
145 | 140 | |
146 | 141 | return 0; | ... | ... |
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type