Commit e9db206189a43f8d75763692743e461492bc1aa2
1 parent
180f54e5
Ajout de fonctionnalites sur le site
-Il est désormais possible de changer le groupe d'utilisateur -Le code du programme sur la Raspberry a été légèrement modifié pour être plus propre
Showing
12 changed files
with
116 additions
and
144 deletions
Show diff stats
PFE06/src/main/java/com/PFE/ServerManager/MainController.java
@@ -121,6 +121,7 @@ public class MainController { | @@ -121,6 +121,7 @@ public class MainController { | ||
121 | modelAndView.addObject("succeed", succeed); | 121 | modelAndView.addObject("succeed", succeed); |
122 | System.out.println("all teams : " + teamRepository.findAll()); | 122 | System.out.println("all teams : " + teamRepository.findAll()); |
123 | modelAndView.addObject("allTeams", teamRepository.findAll()); | 123 | modelAndView.addObject("allTeams", teamRepository.findAll()); |
124 | + modelAndView.addObject("allCustomers", customerRepository.findAll()); | ||
124 | modelAndView.setViewName("registration"); | 125 | modelAndView.setViewName("registration"); |
125 | return modelAndView; | 126 | return modelAndView; |
126 | } | 127 | } |
@@ -130,26 +131,11 @@ public class MainController { | @@ -130,26 +131,11 @@ public class MainController { | ||
130 | return "denied"; | 131 | return "denied"; |
131 | } | 132 | } |
132 | 133 | ||
133 | - @PostMapping(path="/addTeam") | ||
134 | - public String addNewTeam(@RequestParam String teamName){ | ||
135 | - | ||
136 | - if(teamRepository.findByTeam(teamName) != null) { | ||
137 | - return "redirect:/registration?message=Le groupe&succeed=-1"; | ||
138 | - } | ||
139 | - else { | ||
140 | - Team t = new Team(); | ||
141 | - t.setTeam(teamName); | ||
142 | - t.setTeamId((int)(teamRepository.count()+1)); | ||
143 | - teamRepository.save(t); | ||
144 | - return "redirect:/registration?message=Le groupe&succeed=1"; | ||
145 | - } | ||
146 | - } | ||
147 | - | ||
148 | @PostMapping(path="/addUser") | 134 | @PostMapping(path="/addUser") |
149 | public String addNewUser(@RequestParam String email, @RequestParam String password, @RequestParam String role, @RequestParam String team) { | 135 | public String addNewUser(@RequestParam String email, @RequestParam String password, @RequestParam String role, @RequestParam String team) { |
150 | 136 | ||
151 | if(customerRepository.findByEmail(email) != null) { | 137 | if(customerRepository.findByEmail(email) != null) { |
152 | - return "redirect:/registration?message=L'utilisateur&succeed=-1"; | 138 | + return "redirect:/registration?message=L'utilisateur existe+d%C3%A9j%C3%A0&succeed=-1"; |
153 | } | 139 | } |
154 | else { | 140 | else { |
155 | Customer n = new Customer(); | 141 | Customer n = new Customer(); |
@@ -164,9 +150,43 @@ public class MainController { | @@ -164,9 +150,43 @@ public class MainController { | ||
164 | Team temp = teamRepository.findByTeam(team); | 150 | Team temp = teamRepository.findByTeam(team); |
165 | temp.addCustomer(n); | 151 | temp.addCustomer(n); |
166 | teamRepository.save(temp); | 152 | teamRepository.save(temp); |
167 | - return "redirect:/registration?message=L'utilisateur&succeed=1"; | 153 | + return "redirect:/registration?message=L'utilisateur a+%C3%A9t%C3%A9+ajout%C3%A9&succeed=1"; |
168 | } | 154 | } |
155 | + } | ||
169 | 156 | ||
157 | + @PostMapping(path="/addTeam") | ||
158 | + public String addNewTeam(@RequestParam String teamName){ | ||
159 | + | ||
160 | + if(teamRepository.findByTeam(teamName) != null) { | ||
161 | + return "redirect:/registration?message=Le groupe existe+d%C3%A9j%C3%A0&succeed=-1"; | ||
162 | + } | ||
163 | + else { | ||
164 | + Team t = new Team(); | ||
165 | + t.setTeam(teamName); | ||
166 | + t.setTeamId((int)(teamRepository.count()+1)); | ||
167 | + teamRepository.save(t); | ||
168 | + return "redirect:/registration?message=Le groupe a+%C3%A9t%C3%A9+ajout%C3%A9&succeed=1"; | ||
169 | + } | ||
170 | + } | ||
171 | + | ||
172 | + @PostMapping(path="/changeCustomerTeam") | ||
173 | + public String addCustomerTeam(@RequestParam String teamName, @RequestParam String customerName){ | ||
174 | + Team newTeam = teamRepository.findByTeam(teamName); | ||
175 | + Customer customer = customerRepository.findByEmail(customerName); | ||
176 | + Team oldTeam = teamRepository.findByCustomersContaining(customer); | ||
177 | + if( newTeam == null || customer == null) { | ||
178 | + return "redirect:/registration?message=le+groupe+ou+l%27utilisateur+n%27existe+plus&succeed=-1"; | ||
179 | + } | ||
180 | + else if(oldTeam == newTeam){ | ||
181 | + return "redirect:/registration?message=l%27utilisateur+appartient+d%C3%A9j%C3%A0+%C3%A0+ce+groupe&succeed=-1"; | ||
182 | + } | ||
183 | + else { | ||
184 | + newTeam.addCustomer(customer); | ||
185 | + oldTeam.removeCustomer(customer); | ||
186 | + teamRepository.save(newTeam); | ||
187 | + teamRepository.save(oldTeam); | ||
188 | + return "redirect:/registration?message=le+groupe+de+l%27utilisateur+a+bien+%C3%A9t%C3%A9+chang%C3%A9&succeed=1"; | ||
189 | + } | ||
170 | } | 190 | } |
171 | 191 | ||
172 | @RequestMapping(value = "/file", method = RequestMethod.POST) | 192 | @RequestMapping(value = "/file", method = RequestMethod.POST) |
PFE06/src/main/java/com/PFE/ServerManager/Team.java
@@ -52,6 +52,11 @@ public class Team { | @@ -52,6 +52,11 @@ public class Team { | ||
52 | } | 52 | } |
53 | this.customers.add(customer); | 53 | this.customers.add(customer); |
54 | } | 54 | } |
55 | + public void removeCustomer(Customer customer){ | ||
56 | + if(customers != null){ | ||
57 | + customers.remove(customer); | ||
58 | + } | ||
59 | + } | ||
55 | 60 | ||
56 | public void setUpdates(Set<Update> updates) { | 61 | public void setUpdates(Set<Update> updates) { |
57 | this.updates = updates; | 62 | this.updates = updates; |
PFE06/src/main/resources/templates/registration.html
@@ -41,17 +41,17 @@ | @@ -41,17 +41,17 @@ | ||
41 | 41 | ||
42 | <div th:if="${succeed == 1}"> | 42 | <div th:if="${succeed == 1}"> |
43 | <div class="alert alert-success" style="margin-top:50px" role="alert"> | 43 | <div class="alert alert-success" style="margin-top:50px" role="alert"> |
44 | - <span th:utext="${message + ' a été ajouté'}"></span> | 44 | + <span th:utext="${message}"></span> |
45 | </div> | 45 | </div> |
46 | </div> | 46 | </div> |
47 | 47 | ||
48 | <div th:if="${succeed == -1}"> | 48 | <div th:if="${succeed == -1}"> |
49 | <div class="alert alert-danger" style="margin-top:50px" role="alert"> | 49 | <div class="alert alert-danger" style="margin-top:50px" role="alert"> |
50 | - <span th:utext="${message + ' existe déjà'}"></span> | 50 | + <span th:utext="${message}"></span> |
51 | </div> | 51 | </div> |
52 | </div> | 52 | </div> |
53 | 53 | ||
54 | - <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Formulaire d'ajout d'un utilisateur</h1> | 54 | + <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Ajouter un utilisateur</h1> |
55 | <div class="login-form"> | 55 | <div class="login-form"> |
56 | <form id="Login" th:action="@{/addUser}" method="POST"> | 56 | <form id="Login" th:action="@{/addUser}" method="POST"> |
57 | <div class="form-team"> | 57 | <div class="form-team"> |
@@ -80,7 +80,7 @@ | @@ -80,7 +80,7 @@ | ||
80 | </form> | 80 | </form> |
81 | </div> | 81 | </div> |
82 | 82 | ||
83 | - <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Formulaire d'ajout d'un groupe de travail</h1> | 83 | + <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Ajouter un groupe de travail</h1> |
84 | <div class="login-form"> | 84 | <div class="login-form"> |
85 | <form id="addTeam" th:action="@{/addTeam}" method="POST"> | 85 | <form id="addTeam" th:action="@{/addTeam}" method="POST"> |
86 | <div class="form-team"> | 86 | <div class="form-team"> |
@@ -90,6 +90,26 @@ | @@ -90,6 +90,26 @@ | ||
90 | <button @click.prevent="registration" type="submit" class="btn btn-primary">Ajouter</button> | 90 | <button @click.prevent="registration" type="submit" class="btn btn-primary">Ajouter</button> |
91 | </form> | 91 | </form> |
92 | </div> | 92 | </div> |
93 | + | ||
94 | + <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Changer le groupe d'un utilisateur</h1> | ||
95 | + <div class="login-form"> | ||
96 | + <form id="addTeam" th:action="@{/changeCustomerTeam}" method="POST"> | ||
97 | + <div class="form-group"> | ||
98 | + <label for="sel2">Selectionnez un utilisateur</label> | ||
99 | + <select class="form-control" id="sel2" name="customerName" required> | ||
100 | + <option name="customerName" th:each="customer : ${allCustomers}" th:value="${customer.getEmail()}" th:utext="${customer.getEmail()}"/> | ||
101 | + </select> | ||
102 | + </div> | ||
103 | + <div class="form-group"> | ||
104 | + <label for="sel2">Selectionnez un groupe de travail</label> | ||
105 | + <select class="form-control" id="sel2" name="teamName" required> | ||
106 | + <option name="teamName" th:each="team : ${allTeams}" th:value="${team.getTeam()}" th:utext="${team.getTeam()}"/> | ||
107 | + </select> | ||
108 | + </div> | ||
109 | + <br/> | ||
110 | + <button @click.prevent="registration" type="submit" class="btn btn-primary">Changer</button> | ||
111 | + </form> | ||
112 | + </div> | ||
93 | </div> | 113 | </div> |
94 | 114 | ||
95 | <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> | 115 | <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> |
Raspberry/config_experimentation.txt
Raspberry/data deleted
No preview for this file type
Raspberry/data.c deleted
@@ -1,85 +0,0 @@ | @@ -1,85 +0,0 @@ | ||
1 | -#include <stdio.h> | ||
2 | -#include <stdlib.h> | ||
3 | -#include <unistd.h> | ||
4 | -#include <termios.h> | ||
5 | -#include <string.h> | ||
6 | -#include <sys/stat.h> | ||
7 | -#include <fcntl.h> | ||
8 | -#include <stropts.h> | ||
9 | - | ||
10 | -int pt; | ||
11 | -struct termios tty, old; /* Create the structure */ | ||
12 | - | ||
13 | -void reset_tty(){ | ||
14 | - tcsetattr(pt, TCSANOW, &old); | ||
15 | - close(pt); | ||
16 | -} | ||
17 | - | ||
18 | -int main(){ | ||
19 | - int r=-1; | ||
20 | - char * device = "/dev/ttyS3"; | ||
21 | - pt = open(device, O_RDWR | O_NOCTTY | O_SYNC); | ||
22 | - if(pt == -1){ | ||
23 | - perror("open"); | ||
24 | - exit(-1); | ||
25 | - } | ||
26 | - printf("open : %d\n",pt); | ||
27 | - ioctl(pt, I_SRDOPT, RMSGD); | ||
28 | - tcgetattr(pt, &old); | ||
29 | - atexit(reset_tty); | ||
30 | - | ||
31 | - tcgetattr(pt, &tty); // Get the current attributes of the Serial port | ||
32 | - | ||
33 | - //cfmakeraw(&tty); | ||
34 | - tty.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON | IXOFF); | ||
35 | - printf("iflag = %x\n",tty.c_iflag); | ||
36 | - tty.c_oflag &= ~(OPOST); | ||
37 | - printf("oflag = %x\n",tty.c_oflag); | ||
38 | - tty.c_cflag |= (CS8); | ||
39 | - tty.c_cflag &= ~(CSIZE|PARENB); | ||
40 | - printf("cflag = %x\n",tty.c_cflag); | ||
41 | - tty.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); | ||
42 | - printf("lflag = %x\n",tty.c_lflag); | ||
43 | - | ||
44 | - tty.c_cc[VMIN] = 7; | ||
45 | - tty.c_cc[VTIME] = 0; | ||
46 | - cfsetispeed(&tty,B9600); // Setting the Baud rate | ||
47 | - cfsetospeed(&tty,B9600); | ||
48 | - | ||
49 | - /*Peut-être inutile si on est en liaison série et pas en USB : le TCSAFLUSH devrait suffir*/ | ||
50 | - sleep(1); | ||
51 | - | ||
52 | - if(tcflush(pt, TCIFLUSH)==-1){ | ||
53 | - perror("tcflush"); | ||
54 | - exit(-1); | ||
55 | - } | ||
56 | - | ||
57 | - if(tcsetattr(pt, TCSANOW, &tty)==-1){ | ||
58 | - perror("tcsetattr"); | ||
59 | - } | ||
60 | - | ||
61 | - int i = 0; | ||
62 | - char end[20]; | ||
63 | - | ||
64 | - if(cfgetispeed(&tty)!=B9600) | ||
65 | - { | ||
66 | - perror("cfgetispeed"); | ||
67 | - exit(-1); | ||
68 | - } | ||
69 | - | ||
70 | - int count = 0; | ||
71 | - char line[20]; | ||
72 | - memset(line,0,sizeof(line)); | ||
73 | - | ||
74 | - while(count<14){ | ||
75 | - r = read(pt ,line,1); | ||
76 | - printf("c = %c (characters read : %d)\n",line[0],r); | ||
77 | - //printf("l = %c\n",line[0]); | ||
78 | - count++; | ||
79 | - memset(line,0,sizeof(line)); | ||
80 | - printf("\n"); | ||
81 | - } | ||
82 | - | ||
83 | - //close(pt); | ||
84 | - return 0; | ||
85 | -} | ||
86 | \ No newline at end of file | 0 | \ No newline at end of file |
Raspberry/data.cpp deleted
Raspberry/listener
No preview for this file type
Raspberry/listener.c
@@ -55,7 +55,7 @@ void save_data(int pt, char* sensor){ | @@ -55,7 +55,7 @@ void save_data(int pt, char* sensor){ | ||
55 | strcat(base, sensor); | 55 | strcat(base, sensor); |
56 | strcat(base, ".txt"); | 56 | strcat(base, ".txt"); |
57 | file = fopen(base,"w"); | 57 | file = fopen(base,"w"); |
58 | - printf("base = %s\n",base); | 58 | + //printf("base = %s\n",base); |
59 | if(file==NULL){ | 59 | if(file==NULL){ |
60 | perror("fopen"); | 60 | perror("fopen"); |
61 | exit(-1); | 61 | exit(-1); |
@@ -66,8 +66,10 @@ void save_data(int pt, char* sensor){ | @@ -66,8 +66,10 @@ void save_data(int pt, char* sensor){ | ||
66 | memset(line,0,sizeof(line)); | 66 | memset(line,0,sizeof(line)); |
67 | while(1){ | 67 | while(1){ |
68 | int r = read(pt ,line,1); | 68 | int r = read(pt ,line,1); |
69 | - printf("c = %c (characters read : %d)\n\n", line[0], r); | ||
70 | - r = fprintf(file, "%c",line[0]); | 69 | + if(r>=0){ |
70 | + printf("sensor : %s - c = %c (characters read : %d)\n\n", sensor, line[0], r); | ||
71 | + r = fprintf(file, "%c",line[0]); | ||
72 | + } | ||
71 | fflush(file); | 73 | fflush(file); |
72 | memset(line,0,sizeof(line)); | 74 | memset(line,0,sizeof(line)); |
73 | count++; | 75 | count++; |
@@ -85,32 +87,35 @@ void reset_serial(int pt){ | @@ -85,32 +87,35 @@ void reset_serial(int pt){ | ||
85 | printf("end reset_serial\n"); | 87 | printf("end reset_serial\n"); |
86 | } | 88 | } |
87 | 89 | ||
88 | -void * set_serial(void * sensorAndPort2){ | ||
89 | - char *device = ((SensorAndPort *)sensorAndPort2)->port; | 90 | +int set_serial(SensorAndPort* sensorAndPort){ |
91 | + char *device = sensorAndPort->port; | ||
90 | printf("device : %s\n",device); | 92 | printf("device : %s\n",device); |
91 | - //char * device = (char *)deviceV; | ||
92 | int pt = open(device, O_RDWR | O_NOCTTY | O_SYNC); // retourne une erreur si le terminal n'est connecté à rien (pas de STM32 ni de Arduino dans notre cas) | 93 | int pt = open(device, O_RDWR | O_NOCTTY | O_SYNC); // retourne une erreur si le terminal n'est connecté à rien (pas de STM32 ni de Arduino dans notre cas) |
93 | if(pt == -1){ | 94 | if(pt == -1){ |
94 | - create_error_file(((SensorAndPort *)sensorAndPort2)->sensor, "impossible de se connecter au port série, veuillez vérifier le microprocesseur et la raspberry"); | 95 | + create_error_file(sensorAndPort->sensor, "impossible de se connecter au port série, veuillez vérifier le microprocesseur et la raspberry"); |
95 | perror("in set_serial(...) - open"); | 96 | perror("in set_serial(...) - open"); |
96 | pthread_exit(NULL); | 97 | pthread_exit(NULL); |
97 | } | 98 | } |
98 | - ioctl(pt, I_SRDOPT, RMSGD); | ||
99 | - //fcntl(pt, F_SETFL, 0); | 99 | + //ioctl(pt, I_SRDOPT, RMSGD); |
100 | tcgetattr(pt, &old); | 100 | tcgetattr(pt, &old); |
101 | - tcgetattr(pt, &tty); // Get the current attributes of the Serial port | ||
102 | - // cfmakeraw(&tty); | ||
103 | - tty.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON | IXOFF); | ||
104 | - tty.c_oflag &= ~(OPOST); | ||
105 | - tty.c_cflag |= (CS8); | ||
106 | - tty.c_cflag &= ~(CSIZE|PARENB); | ||
107 | - tty.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); | ||
108 | - tty.c_cc[VMIN] = 1; | ||
109 | - tty.c_cc[VTIME] = 0; | 101 | + tcgetattr(pt, &tty); |
102 | + //////////////////////////////////////////////////////////////////////////////////////// | ||
103 | + // Sur les Raspberry le code du read() est bien bloquant comme prévu mais par sur linux Ubuntun. | ||
104 | + // Donc sur les Raspberry, il est nécessaire de mettre un VTIME et de mettre VMIN = 0 | ||
105 | + // car le timer commence lorsque le premier caractère est détécté : | ||
106 | + // Si aucun caractère n'arrive le timer ne commence jamais et le read bloque à l'infini | ||
107 | + //////////////////////////////////////////////////////////////////////////////////////// | ||
110 | cfsetispeed(&tty,B9600); | 108 | cfsetispeed(&tty,B9600); |
111 | cfsetospeed(&tty,B9600); | 109 | cfsetospeed(&tty,B9600); |
112 | 110 | ||
113 | - sleep(1); | 111 | + tty.c_cc[VMIN] = 1; |
112 | + tty.c_cc[VTIME] = 10; | ||
113 | + | ||
114 | + tty.c_cflag |= CLOCAL; | ||
115 | + tty.c_cflag |= CREAD; | ||
116 | + cfmakeraw(&tty); | ||
117 | + | ||
118 | + sleep(1); // nécessaire pour que le flush soit fait | ||
114 | if(tcflush(pt, TCIFLUSH)==-1){ | 119 | if(tcflush(pt, TCIFLUSH)==-1){ |
115 | perror("in set_serial(...) - tcflush"); | 120 | perror("in set_serial(...) - tcflush"); |
116 | pthread_exit(NULL); | 121 | pthread_exit(NULL); |
@@ -124,8 +129,12 @@ void * set_serial(void * sensorAndPort2){ | @@ -124,8 +129,12 @@ void * set_serial(void * sensorAndPort2){ | ||
124 | perror("in set_serial(...) - cfgetispeed"); | 129 | perror("in set_serial(...) - cfgetispeed"); |
125 | pthread_exit(NULL); | 130 | pthread_exit(NULL); |
126 | } | 131 | } |
132 | + return pt; | ||
133 | +} | ||
127 | 134 | ||
128 | - save_data(pt, ((SensorAndPort *)sensorAndPort2)->sensor); | 135 | +void * start(void * sensorAndPort){ |
136 | + int pt = set_serial((SensorAndPort *) sensorAndPort); | ||
137 | + save_data(pt, ((SensorAndPort *)sensorAndPort)->sensor); | ||
129 | reset_serial(pt); | 138 | reset_serial(pt); |
130 | pthread_exit(NULL); | 139 | pthread_exit(NULL); |
131 | } | 140 | } |
@@ -168,17 +177,27 @@ void get_ports_to_read(char list_sensors[MAX_SENSORS][30], char list_serial_port | @@ -168,17 +177,27 @@ void get_ports_to_read(char list_sensors[MAX_SENSORS][30], char list_serial_port | ||
168 | } | 177 | } |
169 | 178 | ||
170 | 179 | ||
171 | -int main(){ | 180 | +int main(int argc, char *argv[]){ |
181 | + char * config_experimentation = "config_experimentation.txt"; | ||
182 | + char * config_raspberry = "config_raspberry.txt"; | ||
183 | + if(argc>1){ | ||
184 | + printf("fichier contenant la liste des capteurs de l'experimentation : %s\n",argv[1]); | ||
185 | + char * config_experimentation = argv[1]; | ||
186 | + } | ||
187 | + if(argc>2){ | ||
188 | + printf("fichier contenant la correspondance de tous les capteurs avec leur liaison série : %s\n",argv[2]); | ||
189 | + char * config_raspberry = argv[2]; | ||
190 | + } | ||
172 | SensorAndPort sensorAndPort[MAX_SENSORS]; | 191 | SensorAndPort sensorAndPort[MAX_SENSORS]; |
173 | - | 192 | + |
174 | char device[MAX_SENSORS][12]; | 193 | char device[MAX_SENSORS][12]; |
175 | pthread_t threads[MAX_SENSORS]; | 194 | pthread_t threads[MAX_SENSORS]; |
176 | 195 | ||
177 | char list_sensors[MAX_SENSORS][30], list_serial_port[MAX_SENSORS][30], sensors_ports[MAX_SENSORS][30]; | 196 | char list_sensors[MAX_SENSORS][30], list_serial_port[MAX_SENSORS][30], sensors_ports[MAX_SENSORS][30]; |
178 | int i=0, count_sensors=0, count_serial_port=0; | 197 | int i=0, count_sensors=0, count_serial_port=0; |
179 | - count_sensors = read_file_by_line(list_sensors, "config_experimentation.txt"); | 198 | + count_sensors = read_file_by_line(list_sensors, config_experimentation); |
180 | printf("numbers of sensors = %d\n",count_sensors); | 199 | printf("numbers of sensors = %d\n",count_sensors); |
181 | - count_serial_port = read_file_by_line(list_serial_port, "config_raspberry.txt"); | 200 | + count_serial_port = read_file_by_line(list_serial_port, config_raspberry); |
182 | get_ports_to_read(list_sensors,list_serial_port,count_sensors, count_serial_port, sensors_ports); | 201 | get_ports_to_read(list_sensors,list_serial_port,count_sensors, count_serial_port, sensors_ports); |
183 | 202 | ||
184 | action.sa_handler=sig_handler; | 203 | action.sa_handler=sig_handler; |
@@ -187,10 +206,14 @@ int main(){ | @@ -187,10 +206,14 @@ int main(){ | ||
187 | for(i=0;i<count_sensors;i++){ | 206 | for(i=0;i<count_sensors;i++){ |
188 | strcpy(sensorAndPort[i].sensor,list_sensors[i]); | 207 | strcpy(sensorAndPort[i].sensor,list_sensors[i]); |
189 | strcpy(sensorAndPort[i].port,sensors_ports[i]); | 208 | strcpy(sensorAndPort[i].port,sensors_ports[i]); |
190 | - pthread_create(&(threads[i]), NULL, set_serial, (void *)(&(sensorAndPort[i]))); | 209 | + pthread_create(&(threads[i]), NULL, start, (void *)(&(sensorAndPort[i]))); |
191 | } | 210 | } |
192 | for(i=0;i<count_sensors;i++){ | 211 | for(i=0;i<count_sensors;i++){ |
193 | pthread_join(threads[i],NULL); | 212 | pthread_join(threads[i],NULL); |
194 | } | 213 | } |
195 | return 0; | 214 | return 0; |
196 | -} | ||
197 | \ No newline at end of file | 215 | \ No newline at end of file |
216 | +} | ||
217 | + | ||
218 | +//169.254.24.80 | ||
219 | + | ||
220 | +//169.254.25.26 | ||
198 | \ No newline at end of file | 221 | \ No newline at end of file |
Raspberry/res/result_exp_mouvement_2.txt deleted
Raspberry/res/result_exp_temperature_1.txt deleted
Raspberry/res/result_exp_wrong_file.txt deleted