change webserver

This commit is contained in:
Flavien Haas 2018-06-14 17:51:36 +02:00
parent c4f4043007
commit 17ff81c11d
5 changed files with 181 additions and 186 deletions

View File

@ -1,64 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>fadeIn demo</title>
<style>
p {
text-align:center;
}
div {
margin:auto;
font-size: 36px;
text-align: center;
color: yellow;
background: red;
display: none;
}
span {
display: none;
}
</style>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<div>
<span><div style='text-align:left;display:inline-block;min-width:340px;'>
<div style='text-align:center;'>
<h1>Passerelle LoRa</h1>
</div>
<div>
<h2>[Température actuelle]</h2>
</div>
<div>
<p>
Nombre d'échantillons envoyés = %, Echec d'envoi : %
</p>
</div>
<div id='l1' name='l1'></div>
<!--<table style='width:100%'>
<tr>
<button onclick='la('?o=1');'>Informations</button>
</tr>
<tr>
<button onclick='alea()'>rafraichir</button>
</tr>
<tr>
<button onclick='la('?o=1');'>Redémarrer</button>
</tr>
</table>-->
</div></span>
</div>
<script>
$(document).ready(function() {
$( "div" ).fadeIn( 3000, function() {
$( "span" ).fadeIn( 100 );
});
return false;
});
</script>
</body>
</html>

112
WebServer/index.htm Normal file
View File

@ -0,0 +1,112 @@
<!DOCTYPE html>
<html lang='fr' class=''>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width,initial-scale=1,user-scalable=no'/>
<meta http-equiv='refresh' content='1' />
<title>Passerelle LoRa</title>
<style>
div,fieldset,input,select
{
padding:5px;
font-size:1em;
}
input
{
width:100%;
box-sizing:border-box;
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
}
select
{
width:100%;
}
textarea
{
resize:none;
width:98%;
height:318px;
padding:5px;
overflow:auto;
}
body
{
text-align:center;
font-family:verdana;
background-color: #bcd5ff;
}
td
{
padding:0px;
}
button
{
border:0;
border-radius:0.3rem;
background-color:#1fa3ec;
color:#fff;
line-height:2.4rem;
font-size:1.2rem;
width:100%;
-webkit-transition-duration:0.4s;
transition-duration:0.4s;
}
button:hover
{
background-color:#006cba;
}
.p
{
float:left;
text-align:left;
}
.q
{
float:right;
text-align:right;
}
</style>
</head>
<body onload='alea()'>
<script>
function alea() {
var x = document.getElementById('demo')x.innerHTML = Math.floor((Math.random() * 10) + 1);
}
</script>
<div style='text-align:left;display:inline-block;min-width:340px;'>
<div style='text-align:center;'>
<h1>Passerelle LoRa</h1>
</div>
<div>
<h2>[Température actuelle]</h2>
</div>
<div>
<p>
Nombre d'échantillons envoyés = %, Echec d'envoi : %
</p>
</div>
<div id='l1' name='l1'></div>
<table style='width:100%'>
<tr>
<button onclick='la('?o=1');'>Informations</button>
</tr>
<tr>
<button onclick='alea()'>rafraichir</button>
</tr>
<tr>
<button onclick='la('?o=1');'>Redémarrer</button>
</tr>
</table>
</div>
</body>
</html>

View File

@ -1,121 +1,64 @@
<!DOCTYPE html>
<html lang='fr' class=''>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width,initial-scale=1,user-scalable=no'/>
<!--<meta http-equiv='refresh' content='1' />-->
<title>Passerelle LoRa</title>
<style>
div,fieldset,input,select
{
padding:5px;
font-size:1em;
}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Passerelle LoRa</title>
<style>
p {
text-align:center;
}
div {
margin:auto;
font-size: 36px;
text-align: center;
color: black;
background: white;
display: none;
}
span {
display: none;
}
</style>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
input
{
width:100%;
box-sizing:border-box;
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
}
<div>
<span><div style='text-align:left;display:inline-block;min-width:340px;'>
<div style='text-align:center;'>
<h1>Passerelle LoRa</h1>
</div>
<div>
<h2>[Température actuelle]</h2>
</div>
<div>
<p>
Nombre d'échantillons envoyés = %, Echec d'envoi : %
</p>
</div>
<div id='l1' name='l1'></div>
<!--<table style='width:100%'>
<tr>
<button onclick='la('?o=1');'>Informations</button>
</tr>
<tr>
<button onclick='alea()'>rafraichir</button>
</tr>
<tr>
<button onclick='la('?o=1');'>Redémarrer</button>
</tr>
</table>-->
</div></span>
</div>
select
{
width:100%;
}
<script>
$(document).ready(function() {
$( "div" ).fadeIn( 2000, function() {
$( "span" ).fadeIn( 100 );
});
return false;
});
</script>
textarea
{
resize:none;
width:98%;
height:318px;
padding:5px;
overflow:auto;
}
body
{
text-align:center;
font-family:verdana;
background-color: #bcd5ff;
}
td
{
padding:0px;
}
button
{
border:0;
border-radius:0.3rem;
background-color:#1fa3ec;
color:#fff;
line-height:2.4rem;
font-size:1.2rem;
width:100%;
-webkit-transition-duration:0.4s;
transition-duration:0.4s;
}
button:hover
{
background-color:#006cba;
}
.p
{
float:left;
text-align:left;
}
.q
{
float:right;
text-align:right;
}
</style>
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
</head>
<body onload=mafonction()>
<!--<script>
function alea() {
var x = document.getElementById('demo')x.innerHTML = Math.floor((Math.random() * 10) + 1);
}
</script>-->
<div style='text-align:left;display:inline-block;min-width:340px;'>
<div style='text-align:center;'>
<h1>Passerelle LoRa</h1>
</div>
<div>
<h2>[Température actuelle]</h2>
</div>
<div>
<p>
Nombre d'échantillons envoyés = %, Echec d'envoi : %
</p>
</div>
<div id='l1' name='l1'></div>
<!--<table style='width:100%'>
<tr>
<button onclick='la('?o=1');'>Informations</button>
</tr>
<tr>
<button onclick='alea()'>rafraichir</button>
</tr>
<tr>
<button onclick='la('?o=1');'>Redémarrer</button>
</tr>
</table>-->
</div>
<script type="text/javascript">
function mafonction(){
$(document.body).fadeIn(6000);
}
</script>
</body>
</body>
</html>

View File

@ -12,7 +12,7 @@ void setup() {
SerialUSB.begin(9600);
SerialUSB.println("LoRa Sender");
thisLoRa.begin();
protocol.codeFrame(0x0B,0x00,0x0000,0x0001,0x0000,0x0000,0x0000);
protocol.codeFrame(0x0A,0x00,0x0000,0x0001,0x0000,0x0000,0x0000);
}
void loop()

View File

@ -15,6 +15,10 @@ CProtocol12Bytes protocol; // create object to
File webFile; // variable for the file containing the webpage
//String postData;
//String tsarray;
//String oldpostData;
byte mac[] = {0xFA, 0xE3, 0x40, 0xEF, 0xFF, 0xFD}; // set the mac address
//IPAddress ip(192, 1, 1, 150); // set the IP address for the ethernet shield, overwise the librairy use DHCP
@ -43,11 +47,11 @@ void setup(){
return; // init failed
}
SerialUSB.println("SUCCESS - SD card initialized.");
if (!SD.exists("index.htm")) { // check for index.htm file
SerialUSB.println("ERROR - Can't find index.htm file!");
if (!SD.exists("index.html")) { // check for index.html file
SerialUSB.println("ERROR - Can't find index.html file!");
return; // can't find index file
}
SerialUSB.println("SUCCESS - Found index.htm file.");
SerialUSB.println("SUCCESS - Found index.html file.");
}// end of setup
void loop() {
@ -117,7 +121,7 @@ void loop() {
serverGateway.println("Connection: close");
serverGateway.println();
// send web page
webFile = SD.open("index.htm"); // open web page file
webFile = SD.open("index.html"); // open web page file
if (webFile) { // if the webfile exist
while(webFile.available()) { // the webfile is avaible
serverGateway.write(webFile.read()); // send webfile to client