Advertisement
matthiasbock

Speedport W500V GPIO control - extio.cgi

Aug 26th, 2012
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.54 KB | None | 0 0
  1. #!/bin/sh
  2. #NAME: External I/O
  3. #DESCRIPTION: Control external I/O via the web interface.
  4.  
  5. HOME="../plugin.cgi"
  6. . /webs/cgi-bin/login.cgi
  7.  
  8. if [ "$action" == "3" ]; then
  9.   echo "$stateK1" >/dev/extout0
  10.   echo "$stateK2" >/dev/extout1
  11. fi
  12.  
  13. iK1=`cat /dev/extout0`
  14. iK2=`cat /dev/extout1`
  15. iPC1=`cat /dev/extin0`
  16.  
  17. cat << EOF_HTML
  18. Content-type: text/html
  19. Connection: close
  20.  
  21. <html>
  22. <head>
  23. <script language="JavaScript" src="../../js_fade.txt" type="text/JavaScript"></script>
  24. <script language="JavaScript" src="../../js_menu.txt" type="text/JavaScript"></script>
  25. <link rel="stylesheet" href="../../style.css" type="text/css" />
  26. <!--[if IE]><style type="text/css">@import url(../../ie.css);</style><![endif]-->
  27. <script type="text/JavaScript">
  28. var iK1 = $iK1;
  29. var iK2 = $iK2;
  30. var iPC1 = $iPC1;
  31.  
  32. function chk()
  33. {
  34.   document.xform.stateK1[1 - iK1].checked = true;
  35.   document.xform.stateK2[1 - iK2].checked = true;
  36.   document.xform.statePC1[1 - iPC1].checked = true;
  37. }
  38. </script>
  39. </head>
  40. <body onload="chk();">
  41. <div id="c_border">
  42. <div id="c_pfad">Plugins / External I/O</div>
  43. <div id="c_titel">External I/O</div>
  44. <form id="xform" name="xform" method="post">
  45. <input id="action" type="hidden" name="action" value="0">
  46. <div id="c_std">
  47.   <table border="0" cellpaddig="0" cellspacing="2">
  48.     <tr onmouseover="i_showElem(1);" onmouseout="i_showElem(0);" >
  49.       <td width="120">Relay K1:</td>
  50.       <td width="20"><input id="stateK1" type="radio" name="stateK1" value="1"></td>
  51.       <td width="40">On</td>
  52.       <td width="20"><input id="stateK1" type="radio" name="stateK1" value="0"></td>
  53.       <td width="40">Off</td>
  54.     </tr>
  55.   </table>
  56. </div>
  57. <div id="c_std">
  58.   <table border="0" cellpaddig="0" cellspacing="2">
  59.     <tr onmouseover="i_showElem(2);" onmouseout="i_showElem(0);" >
  60.       <td width="120">Relay K2:</td>
  61.       <td width="20"><input id="stateK2" type="radio" name="stateK2" value="1"></td>
  62.       <td width="40">On</td>
  63.       <td width="20"><input id="stateK2" type="radio" name="stateK2" value="0"></td>
  64.       <td width="40">Off</td>
  65.     </tr>
  66.   </table>
  67. </div>
  68. <div id="c_std">
  69.   <table border="0" cellpaddig="0" cellspacing="2">
  70.     <tr onmouseover="i_showElem(3);" onmouseout="i_showElem(0);" >
  71.       <td width="120">Photocoupler PC1:</td>
  72.       <td width="20"><input id="statePC1" type="radio" name="statePC1" value="1" disabled="disabled"></td>
  73.       <td width="40">On</td>
  74.       <td width="20"><input id="statePC1" type="radio" name="statePC1" value="0" disabled="disabled"></td>
  75.       <td width="40">Off</td>
  76.     </tr>
  77.   </table>
  78. </div>
  79. </form>
  80. <div id="c_leer"></div>
  81. <div id="c_foot"></div>
  82. </div>
  83. <div id="c_verzoeg1"></div>
  84. <div id="c_verzoeg2"></div>
  85. </div>
  86. <div id="t_Frame">
  87. <div id="t_but1" onclick='window.location.href="$HOME";' onmouseover="rahmen(1,1);" onmouseout="rahmen(0,1);">Back&nbsp;&lt;&lt;</div>
  88. <div id="t_but4" onclick="subm(3);" onmouseover="rahmen(1,4);" onmouseout="rahmen(0,4);">Run&nbsp;&nbsp;&lt;&lt;</div>
  89. </div>
  90. <div id="i_Frame">
  91. <div id="i_content">
  92. <h2>External I/O</h2>
  93. <p>Control external I/O.</p>
  94. </div>
  95. <div id="i_content1">
  96. <h2>External I/O</h2>
  97. <p><b>Relay K1</b></p>
  98. <p>Set the state of K1 to On (activated) or Off (inactive).</p>
  99. </div>
  100. <div id="i_content2">
  101. <h2>External I/O</h2>
  102. <p><b>Relay K2</b></p>
  103. <p>Set the state of K2 to On (activated) or Off (inactive).</p>
  104. </div>
  105. <div id="i_content3">
  106. <h2>External I/O</h2>
  107. <p><b>Photocoupler PC1</b></p>
  108. <p>Shows the state of PC1, either On (activated) or Off (inactive).</p>
  109. </div>
  110. </body>
  111. </html>
  112. EOF_HTML
  113.  
  114. a=0
  115.  
  116. # EoF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement