Example #1
0
 * Jeedom is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Jeedom. If not, see <http://www.gnu.org/licenses/>.
 */
if (!isConnect('admin')) {
    throw new Exception('401 Unauthorized');
}
//if (config::byKey('enableLogging', 'arduidom', 0) == 0) {
//    echo '<div class="alert alert-danger">{{Vous n\'avez pas activé l\'enregistrement de tous les messages : allez dans Générale -> Plugin puis rfxcom et coché la case correspondante}}</div>';
//}
$_AID = init('arduid');
$daemonRunning = arduidom::checkdaemon($_AID);
if ($daemonRunning != 1) {
    throw new Exception(__("Action Impossible : Le démon Arduidom " . $_AID . " ne fonctionne pas !", __FILE__));
}
?>


<pre id='pre_ardulog' style='overflow: auto; height: 95%;width:90%;'></pre>


<script>
    getArduLog(1);

    function getArduLog(_autoUpdate) {
        $.ajax({
            type: 'POST',
Example #2
0
    echo ' class="disabled"';
}
?>
 ><a data-toggle="tab" href="#tab_7">{{Démon <span class="badge">7</span><?php 
if (arduidom::checkdaemon(7) != 1) {
    echo ' (Offline)';
}
?>
}}</a></li>
    <li<?php 
if (arduidom::checkdaemon(8) != 1) {
    echo ' class="disabled"';
}
?>
 ><a data-toggle="tab" href="#tab_8">{{Démon <span class="badge">8</span><?php 
if (arduidom::checkdaemon(8) != 1) {
    echo ' (Offline)';
}
?>
}}</a></li>
</ul>

<div class="tab-content">
    <?php 
for ($i = 1; $i < 9; $i++) {
    ?>
        <div class="tab-pane<?php 
    if ($i == 1) {
        echo " active";
    }
    ?>
Example #3
0
    <li<?php 
    if ($_AID == 1) {
        echo ' class="active"';
    }
    if (arduidom::checkdaemon($_AID) != 1) {
        echo ' class="disabled"';
    }
    ?>
><a data-toggle="tab" href="#tab_<?php 
    echo $_AID;
    ?>
">{{Arduino <?php 
    echo '<span class="badge">' . $_AID . '</span>';
    ?>
 <?php 
    if (arduidom::checkdaemon($_AID) != 1) {
        echo ' (NOK)';
    }
    ?>
}}</a></li>

    <?php 
}
?>
</ul>





Example #4
0
     if (arduidom::checkdaemon($i) == 1) {
         ajax::success();
     } else {
         ajax::error("Le démon " . $i . " n'a pas démarré");
     }
 }
 if (init('action') == 'stopDaemon' . $i) {
     arduidom::stopdaemon($i);
     if (arduidom::checkdaemon($i) == 0) {
         ajax::success();
     } else {
         ajax::error("Le démon " . $i . " ne s'est pas arreté");
     }
 }
 if (init('action') == 'checkDaemon' . $i) {
     if (arduidom::checkdaemon($i) == 1) {
         ajax::success();
     } else {
         ajax::error("Le démon " . $i . " ne fonctionne pas !");
     }
 }
 if (init('action') == 'FlashArduino' . $i) {
     log::add('arduidom', 'info', 'FlashArduino STEP 1: Exec avrdude and wait finish...');
     $chk = arduidom::FlashArduino($i);
     log::add('arduidom', 'info', 'FlashArduino STEP 2: avrdude finished.' . $chk);
     sleep(1);
     log::add('arduidom', 'info', 'FlashArduino STEP 3: Start  Daemon ' . $i);
     $chk = arduidom::startdaemon($i);
     if ($chk == 1) {
         log::add('arduidom', 'info', 'FlashArduino STEP 4: Daemon ' . $i . ' started' . $chk);
         ajax::success("Le démon " . $i . " a correctement démarré apres le televersement de l'arduino !");
Example #5
0
if (!isConnect()) {
    include_file('desktop', '404', 'php');
    die;
}
//$daemonRunning = arduidom::checkdaemon();
$ArduinoQty = config::byKey('ArduinoQty', 'arduidom', 1);
?>
<ul class="nav nav-pills nav-justified" id="tab_arid">
    <?php 
for ($i = 1; $i <= $ArduinoQty; $i++) {
    if ($i == 1) {
        echo '<li class="active">';
    } else {
        echo '<li>';
    }
    echo '<a data-toggle="tab" href="#tab_' . $i . '">{{Arduino ' . $i . ' <span class="label label-' . (arduidom::checkdaemon($i) == 1 ? 'success' : 'danger') . ' ">' . (arduidom::checkdaemon($i) == 1 ? 'OK' : 'NOK') . '</span>' . '}}</a></li>';
}
?>
</ul>

<div class="tab-content" id="arduinotabs">
    <?php 
for ($i = 1; $i <= $ArduinoQty; $i++) {
    ?>
        <div class="tab-pane<?php 
    if ($i == 1) {
        echo " active";
    }
    ?>
" id="tab_<?php 
    echo $i;