Commit c00f0c15f86b112f4b85cdc2c3752f16cfd4394d

Authored by root
1 parent 7622b5db

MAJ

Ansible/MainTask.retry 0 → 100644
... ... @@ -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
1 1 ---
2   -- name: "envoyer du fichier binaire.c"
  2 +- name: "envoyer du fichier main.c"
3 3 copy:
4 4 src: ../../../../site/upload/main.c
5 5 dest: /home/pi/capteur{{capteur}}/main.c
... ...
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
... ... @@ -7,7 +7,7 @@ if(isset($_POST['sensor']))
7 7 {
8 8 $ini = "";
9 9 $arduino_simple = "[Arduino]\r\n";
10   - $arduino_spi = "[Arduino_spi]\r\n";
  10 + $arduino_spi = "[Arduino]\r\n";
11 11 $nucleo = "[Nucleo]\r\n";
12 12  
13 13 $a_simple = false;
... ...
site/upload/inventaire.ini
1 1 [Arduino]
2   -172.26.145.113 capteur=1-0
  2 +172.26.145.111 capteur=2-0
3 3  
... ...