Commit c00f0c15f86b112f4b85cdc2c3752f16cfd4394d
1 parent
7622b5db
MAJ
Showing
7 changed files
with
18 additions
and
5 deletions
Show diff stats
@@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
1 | +172.26.145.111 |
Ansible/inventaire-rasp.ini
@@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
1 | +172.26.145.111 |
Ansible/roles/arduino/tasks/main.yml
site/accesBase.php
@@ -352,4 +352,14 @@ | @@ -352,4 +352,14 @@ | ||
352 | return False; | 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,7 +23,7 @@ session_start(); | ||
23 | if(add($_POST['nom'], $_POST['type'], $_POST['raspberry'], $_POST['unite'], $_POST['version'])) | 23 | if(add($_POST['nom'], $_POST['type'], $_POST['raspberry'], $_POST['unite'], $_POST['version'])) |
24 | { | 24 | { |
25 | $arduino_simple = "[Arduino_init]\r\n"; | 25 | $arduino_simple = "[Arduino_init]\r\n"; |
26 | - $arduino_spi = "[Arduino_spi_init]\r\n"; | 26 | + $arduino_spi = "[Arduino_init]\r\n"; |
27 | $nucleo = "[Nucleo_init]\r\n"; | 27 | $nucleo = "[Nucleo_init]\r\n"; |
28 | 28 | ||
29 | $setup = getSetup($_POST['raspberry']); | 29 | $setup = getSetup($_POST['raspberry']); |
@@ -40,7 +40,8 @@ session_start(); | @@ -40,7 +40,8 @@ session_start(); | ||
40 | { | 40 | { |
41 | $ini = $nucleo; | 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 | file_put_contents('upload/inventaire.ini', $ini); | 45 | file_put_contents('upload/inventaire.ini', $ini); |
45 | setup($_POST['raspberry']); | 46 | setup($_POST['raspberry']); |
46 | exec("super cmd.sh"); | 47 | exec("super cmd.sh"); |
site/reception.php
@@ -7,7 +7,7 @@ if(isset($_POST['sensor'])) | @@ -7,7 +7,7 @@ if(isset($_POST['sensor'])) | ||
7 | { | 7 | { |
8 | $ini = ""; | 8 | $ini = ""; |
9 | $arduino_simple = "[Arduino]\r\n"; | 9 | $arduino_simple = "[Arduino]\r\n"; |
10 | - $arduino_spi = "[Arduino_spi]\r\n"; | 10 | + $arduino_spi = "[Arduino]\r\n"; |
11 | $nucleo = "[Nucleo]\r\n"; | 11 | $nucleo = "[Nucleo]\r\n"; |
12 | 12 | ||
13 | $a_simple = false; | 13 | $a_simple = false; |
site/upload/inventaire.ini