Commit c00f0c15f86b112f4b85cdc2c3752f16cfd4394d
1 parent
7622b5db
MAJ
Showing
7 changed files
with
18 additions
and
5 deletions
Show diff stats
... | ... | @@ -0,0 +1 @@ |
1 | +172.26.145.111 | ... | ... |
Ansible/inventaire-rasp.ini
... | ... | @@ -0,0 +1 @@ |
1 | +172.26.145.111 | ... | ... |
Ansible/roles/arduino/tasks/main.yml
site/accesBase.php
... | ... | @@ -352,4 +352,14 @@ |
352 | 352 | return False; |
353 | 353 | } |
354 | 354 | } |
355 | + | |
356 | + function getNumero($nom) | |
357 | + { | |
358 | + $db = connexion(); | |
359 | + $query = "SELECT numero FROM capteurs WHERE nom = '$nom'"; | |
360 | + $result = pg_query($db, $query) or die("La requ te a echou : ".pg_last_error()); | |
361 | + $tab = pg_fetch_assoc($result); | |
362 | + deconnexion($db); | |
363 | + return $tab['numero']; | |
364 | + } | |
355 | 365 | ?> | ... | ... |
site/add.php
... | ... | @@ -23,7 +23,7 @@ session_start(); |
23 | 23 | if(add($_POST['nom'], $_POST['type'], $_POST['raspberry'], $_POST['unite'], $_POST['version'])) |
24 | 24 | { |
25 | 25 | $arduino_simple = "[Arduino_init]\r\n"; |
26 | - $arduino_spi = "[Arduino_spi_init]\r\n"; | |
26 | + $arduino_spi = "[Arduino_init]\r\n"; | |
27 | 27 | $nucleo = "[Nucleo_init]\r\n"; |
28 | 28 | |
29 | 29 | $setup = getSetup($_POST['raspberry']); |
... | ... | @@ -40,7 +40,8 @@ session_start(); |
40 | 40 | { |
41 | 41 | $ini = $nucleo; |
42 | 42 | } |
43 | - $ini = $ini.$_POST['raspberry']." capteur=".$_POST['numero']."-".$_POST['version']." setup=".$setup."\n"; | |
43 | + $numero = getNumero($_POST['nom']); | |
44 | + $ini = $ini.$_POST['raspberry']." capteur=".$numero."-".$_POST['version']." setup=".$setup."\n"; | |
44 | 45 | file_put_contents('upload/inventaire.ini', $ini); |
45 | 46 | setup($_POST['raspberry']); |
46 | 47 | exec("super cmd.sh"); | ... | ... |
site/reception.php
site/upload/inventaire.ini