www-thermferm/webcam-ng.php

Mon, 25 Mar 2024 17:14:56 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Mon, 25 Mar 2024 17:14:56 +0100
changeset 650
0b215e4b814e
parent 618
3732b701fde5
permissions
-rw-r--r--

Brought the retry attempts to read the DHT11 sensors to the main devices loop. The actual read function is now very simple. Called every 30 seconds when all is well, or 2 seconds if something is wrong.

<?php
/*****************************************************************************
 * Copyright (C) 2022
 *   
 * Michiel Broek <mbroek at mbse dot eu>
 *
 * This file is part of ThermFerm
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2, or (at your option) any
 * later version.
 *
 * ThermFerm 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 ThermFerm; see the file COPYING.  If not, write to the Free
 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
 *****************************************************************************/

/*
 * Look for the style names in the jqwidgets/styles directory.
 */
$my_style = 'ui-darkness';
if (file_exists('/srv/http/streamer')) {
    shell_exec('/srv/http/streamer start');
} else if (file_exists('/var/www/streamer')) {
    shell_exec('/var/www/streamer start');
} else {
    exit;
}
sleep(1);
?>

<!DOCTYPE html>
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title>ThermFerm - Web Camera</title>
  <link type="text/css" href="css/webcam-ng.css" rel="stylesheet" media="all" />
  <link type="text/css" href="jqwidgets/styles/jqx.base.css" rel="stylesheet" />
  <link type="text/css" href="jqwidgets/styles/jqx.<?php echo $my_style; ?>.css" rel="stylesheet" />
  <meta name="viewport" content="width=device-width, initial-scale=1 maximum-scale=1 minimum-scale=1" />
  <script>
        var theme = "<?php echo $my_style; ?>";
  </script>
  <script src="js/jquery-2.1.1.min.js"></script>
  <script src="jqwidgets/jqxcore.js"></script>
  <script src="jqwidgets/jqxwindow.js"></script>
  <script src="jqwidgets/jqxbuttons.js"></script>
  <script src="js/webcam-ng.js"></script>
 </head>
 <body class="default">
  <div id="jqxWidget">
   <div id="content">

    <div id="camera_display">
     <div id="streamwrap" class="xform-p">
      <img id="streamimage" class="xform" src="<?php echo "http://".$_SERVER['SERVER_NAME'].":8090/?action=stream"; ?>" />
     </div>
    </div>

    <div id="camera_controls">
     <table style="width: 100%; padding: 7px;">
      <tr>
       <td>
        <input style="float: left; margin-left: 0px;" type="button" id="rotate" />
        <input style="float: left; margin-left: 5px;" type="button" id="mirror" />
        <input style="float: left; margin-left: 5px;" type="button" id="flip" />
       </td>
      </tr>
      <tr>
       <td>
        <div id="camera_panel_buttons">
         <input style="margin-top: 250px; margin-left: 18px;" type="button" id="Close" value="Sluiten" />
        </div>
       </td>
      </tr>
     </table>
    </div>
   </div>
  </div> <!-- jqxWidget -->
 </body>
</html>

mercurial