web interface wifi scan implemented
This commit is contained in:
parent
13c7f5d1db
commit
eabed85bf4
|
|
@ -1,138 +1,200 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="res/styles.css">
|
||||
<link rel="stylesheet" href="res/iconsfont.css">
|
||||
<script src="res/main.js"></script>
|
||||
<script src="res/res.js"></script>
|
||||
<title>~name~</title>
|
||||
</head>
|
||||
<body>
|
||||
<script>PageSurround();</script>
|
||||
<!--========== CONTENTS ==========-->
|
||||
<main>
|
||||
<section>
|
||||
<div class="ml">
|
||||
|
||||
<div class="mlp ~hide_eth~">
|
||||
<div class="mlpc">
|
||||
<form name="eth" method="post">
|
||||
<div class="mlhdr">ETHERNET</div>
|
||||
<table class='cntr'><tr>
|
||||
<script>PrintCheckBox('Включить ETHERNET','ethen','~ethen~','configIPBoxes()');
|
||||
PrintCheckBox('Включить DHCP','dhcp','~ecbdh~','configIPBoxes()');
|
||||
PrintIPInput('IP Станции:','ipa','~eip~');
|
||||
PrintIPInput('Маска подсети:','mas','~emsk~');
|
||||
PrintIPInput(' Адрес шлюза:','gte','~egate~');
|
||||
PrintIPInput('DNS1:','dns1','~edns~');
|
||||
PrintIPInput('DNS2:','dns2','~bkedns~');
|
||||
PrintIPInput('DNS3:','dns3','~fledns~');
|
||||
PrintMACInput('MAC:','mac','~emacadr~');</script>
|
||||
<tr><td></td></tr></table><br/>
|
||||
<script>PrintSaveFail('~status_fail~');
|
||||
PrintSaveBtn('eth'); PrintApplyBtn('eth');</script>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mlp ~hide_lora~">
|
||||
<div class="mlpc">
|
||||
<div class="mlhdr">LORAWAN</div>
|
||||
<form name="gprs" method="post">
|
||||
<table class='cntr'>
|
||||
<table>
|
||||
<script>
|
||||
PrintCheckBox('Включить LoRaWAN','lren','~lren~',null);
|
||||
PrintHexInput('ID устройства:','lrdvid','~lrdvid~',16,16);
|
||||
PrintHexInput('ID приложения:','lrapid','~lrapid~',16,16);</script>
|
||||
</table>
|
||||
<table><tr><td align="center">Ключ приложения:</td></tr>
|
||||
<tr><td align="center"><input type="text" size="40" name='lrapkey' value="~lrapkey~" title="64 символа A-H,a-h,0-9" pattern="^[0-9a-hA-H]{32}$"/></td></tr>
|
||||
</table>
|
||||
<script>PrintSaveFail('~status_fail~');
|
||||
PrintSaveBtn('lora'); PrintApplyBtn('lora');</script>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mlp ~hide_wifi~">
|
||||
<div class="mlpc">
|
||||
<form name="wifi" method="post">
|
||||
<div class="mlhdr">WiFi</div>
|
||||
<table class='cntr'>
|
||||
<tr><td class='rl'>Включить WiFi</td><td><input type="checkbox" name="wifien" value="1" ~wfen~/></td></tr>
|
||||
<tr><td class='rl'>Режим WiFi:</td><td><input name="netm" type="radio" value="2" onclick="configIPBoxes()" ~cln~>Клиент(CLN)</input></br>
|
||||
<input name="netm" type="radio" value="1" onclick="configIPBoxes()" ~apn~>Точка доступа(AP)</input></td></tr>
|
||||
<script>PrintTextInput('Имя WiFi сети(AP):','wfiap','~ssidap~',3,31);
|
||||
PrintTextInput('Ключ WiFi сети(AP):','wfpap','~wkeyap~',8,31);
|
||||
PrintIPInput('IP адрес(AP):','ipaap','~ipap~');
|
||||
PrintTextInput('Имя WiFi сети(CLN):','wfi','~ssid~',3,31);
|
||||
PrintTextInput('Ключ WiFi сети(CLN):','wfp','~wkey~',8,31);
|
||||
PrintCheckBox('Включить DHCP','dhcp','~cbdh~','configIPBoxes()');
|
||||
PrintIPInput('IP адрес(CLN):','ipa','~ip~');
|
||||
PrintIPInput('Маска подсети(CLN):','mas','~msk~');
|
||||
PrintIPInput('Адрес шлюза(CLN):','gte','~gate~');
|
||||
PrintIPInput('DNS1:','dns','~dns~');
|
||||
PrintIPInput('DNS2:','dns2','~dns2~');
|
||||
PrintIPInput('DNS3:','dns3','~dns3~');
|
||||
PrintMACInput('MAC(CLN):','mac','~macadr~');
|
||||
PrintMACInput('MAC(AP):','mac2','~apmacadr~');</script>
|
||||
<tr><td></td></tr></table><br/>
|
||||
|
||||
<script>PrintSaveFail('~status_fail~');
|
||||
PrintSaveBtn('wifi'); PrintApplyBtn('wifi');</script>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mlp ~hide_gprs~">
|
||||
<div class="mlpc">
|
||||
<div class="mlhdr">GPRS</div>
|
||||
<form name="gprs" method="post">
|
||||
<table class='cntr'>
|
||||
<script>
|
||||
PrintCheckBox('Включить GSM','gsmen','~gsmen~',null);
|
||||
PrintLabel('Модуль:','~gsmmod~');
|
||||
PrintLabel('Оператор:','~gsmopr~');
|
||||
PrintLabel('IMEI:','~gimei~');
|
||||
PrintLabel('IMSI:','~gimsi~');
|
||||
PrintLabel('IP адрес:','~gsmip~');
|
||||
PrintLabel('Маска подсети:','~gsmmsk~');
|
||||
PrintLabel('Адрес шлюза:','~gsmgate~');
|
||||
PrintLabel('DNS1:','~gsmdns~');
|
||||
PrintLabel('DNS2:','~bkgsmdns~');
|
||||
PrintLabel('DNS3:','~flgsmdns~');
|
||||
PrintSep();
|
||||
</script>
|
||||
</table>
|
||||
<script>PrintSaveFail('~status_fail~');
|
||||
PrintSaveBtn('gprs'); PrintApplyBtn('gprs');</script>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mlp ~hide_wifiscan~">
|
||||
<div class="mlpc">
|
||||
<div class="mlhdr">WiFiSCAN</div>
|
||||
<form name="wifiscan" method="post">
|
||||
<table class='cntr'>
|
||||
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="res/styles.css">
|
||||
<link rel="stylesheet" href="res/iconsfont.css">
|
||||
<script src="res/main.js"></script>
|
||||
<script src="res/res.js"></script>
|
||||
<title>~name~</title>
|
||||
</head>
|
||||
<body>
|
||||
<script>PageSurround();</script>
|
||||
<!--========== CONTENTS ==========-->
|
||||
<main>
|
||||
<section>
|
||||
<div class="ml">
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
<script>
|
||||
<div class="mlp ~hide_eth~">
|
||||
<div class="mlpc">
|
||||
<form name="eth" method="post">
|
||||
<div class="mlhdr">ETHERNET</div>
|
||||
<table class='cntr'>
|
||||
<tr>
|
||||
<script>PrintCheckBox('Включить ETHERNET','ethen','~ethen~','configIPBoxes()');
|
||||
PrintCheckBox('Включить DHCP','dhcp','~ecbdh~','configIPBoxes()');
|
||||
PrintIPInput('IP Станции:','ipa','~eip~');
|
||||
PrintIPInput('Маска подсети:','mas','~emsk~');
|
||||
PrintIPInput(' Адрес шлюза:','gte','~egate~');
|
||||
PrintIPInput('DNS1:','dns1','~edns~');
|
||||
PrintIPInput('DNS2:','dns2','~bkedns~');
|
||||
PrintIPInput('DNS3:','dns3','~fledns~');
|
||||
PrintMACInput('MAC:','mac','~emacadr~');</script>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
<script>PrintSaveFail('~status_fail~');
|
||||
PrintSaveBtn('eth'); PrintApplyBtn('eth');</script>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mlp ~hide_lora~">
|
||||
<div class="mlpc">
|
||||
<div class="mlhdr">LORAWAN</div>
|
||||
<form name="gprs" method="post">
|
||||
<table class='cntr'>
|
||||
<table>
|
||||
<script>
|
||||
PrintCheckBox('Включить LoRaWAN','lren','~lren~',null);
|
||||
PrintHexInput('ID устройства:','lrdvid','~lrdvid~',16,16);
|
||||
PrintHexInput('ID приложения:','lrapid','~lrapid~',16,16);</script>
|
||||
</table>
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center">Ключ приложения:</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><input type="text" size="40"
|
||||
name='lrapkey' value="~lrapkey~"
|
||||
title="64 символа A-H,a-h,0-9" pattern="^[0-9a-hA-H]{32}$" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
<script>PrintSaveFail('~status_fail~');
|
||||
PrintSaveBtn('lora'); PrintApplyBtn('lora');</script>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mlp ~hide_wifi~">
|
||||
<div class="mlpc">
|
||||
<form name="wifi" method="post">
|
||||
<div class="mlhdr">WiFi</div>
|
||||
<table class='cntr'>
|
||||
<tr>
|
||||
<td class='rl'>Включить WiFi</td>
|
||||
<td><input type="checkbox" name="wifien" value="1" ~wfen~/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='rl'>Режим WiFi:</td>
|
||||
<td><input name="netm" type="radio" value="2"
|
||||
onclick="configIPBoxes()"~cln~>Клиент(CLN)</input></br> <input
|
||||
name="netm" type="radio" value="1"
|
||||
onclick="configIPBoxes()"~apn~>Точка доступа(AP)</input></td>
|
||||
</tr>
|
||||
<script>PrintTextInput('Имя WiFi сети(AP):','wfiap','~ssidap~',3,31);
|
||||
PrintTextInput('Ключ WiFi сети(AP):','wfpap','~wkeyap~',8,31);
|
||||
PrintIPInput('IP адрес(AP):','ipaap','~ipap~');
|
||||
PrintTextInput('Имя WiFi сети(CLN):','wfi','~ssid~',3,31);
|
||||
PrintTextInput('Ключ WiFi сети(CLN):','wfp','~wkey~',8,31);
|
||||
PrintCheckBox('Включить DHCP','dhcp','~cbdh~','configIPBoxes()');
|
||||
PrintIPInput('IP адрес(CLN):','ipa','~ip~');
|
||||
PrintIPInput('Маска подсети(CLN):','mas','~msk~');
|
||||
PrintIPInput('Адрес шлюза(CLN):','gte','~gate~');
|
||||
PrintIPInput('DNS1:','dns','~dns~');
|
||||
PrintIPInput('DNS2:','dns2','~dns2~');
|
||||
PrintIPInput('DNS3:','dns3','~dns3~');
|
||||
PrintMACInput('MAC(CLN):','mac','~macadr~');
|
||||
PrintMACInput('MAC(AP):','mac2','~apmacadr~');</script>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
|
||||
<script>PrintSaveFail('~status_fail~');
|
||||
PrintSaveBtn('wifi'); PrintApplyBtn('wifi');</script>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mlp ~hide_gprs~">
|
||||
<div class="mlpc">
|
||||
<div class="mlhdr">GPRS</div>
|
||||
<form name="gprs" method="post">
|
||||
<table class='cntr'>
|
||||
<script>
|
||||
PrintCheckBox('Включить GSM','gsmen','~gsmen~',null);
|
||||
PrintLabel('Модуль:','~gsmmod~');
|
||||
PrintLabel('Оператор:','~gsmopr~');
|
||||
PrintLabel('IMEI:','~gimei~');
|
||||
PrintLabel('IMSI:','~gimsi~');
|
||||
PrintLabel('IP адрес:','~gsmip~');
|
||||
PrintLabel('Маска подсети:','~gsmmsk~');
|
||||
PrintLabel('Адрес шлюза:','~gsmgate~');
|
||||
PrintLabel('DNS1:','~gsmdns~');
|
||||
PrintLabel('DNS2:','~bkgsmdns~');
|
||||
PrintLabel('DNS3:','~flgsmdns~');
|
||||
PrintSep();
|
||||
</script>
|
||||
</table>
|
||||
<script>PrintSaveFail('~status_fail~');
|
||||
PrintSaveBtn('gprs'); PrintApplyBtn('gprs');</script>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mlp ~hide_wifiscan~">
|
||||
<div class="mlpc">
|
||||
<div class="mlhdr">WiFiSCAN</div>
|
||||
<form name="wifiscan" method="post">
|
||||
<table class='cntr'>
|
||||
<tr>
|
||||
<td><button type="button" class='btn' name='upd'
|
||||
onclick="StartScan()">Scan WiFi</button></td>
|
||||
<td><progress id="pbar" class="scanbar" value="0"
|
||||
max="100"></progress></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class='cntr' id="nets"></table>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
<script>
|
||||
var array;
|
||||
function Connect(n)
|
||||
{
|
||||
alert("Connect to network "+array[n].ssid);
|
||||
}
|
||||
function PrintNetworks(data)
|
||||
{
|
||||
document.getElementById("nets").innerHTML = data;
|
||||
array = JSON.parse(data);
|
||||
var i=0;
|
||||
var out = "<tr><td>CHANNEL</td><td>SSID</td><td>RSSI</td></tr>";
|
||||
for (i=0; i<array.length; ++i)
|
||||
{
|
||||
if(array[i].ssid != "")
|
||||
{
|
||||
out += "<tr><td>"+array[i].ch+"</td><td>"+array[i].ssid+"</td><td>"+array[i].rssi+" dBm</td>";
|
||||
out += "<td><button type=\"button\" class ='btn' onclick=\"Connect("+i+")\">Connect</button></tr>";
|
||||
}
|
||||
}
|
||||
document.getElementById("nets").innerHTML = out;
|
||||
}
|
||||
async function StartScan(){
|
||||
PostData('wifisc=prs', 'adapters.html',false ,false, false);
|
||||
console.log('start wifi scan');
|
||||
b = document.getElementById("pbar");
|
||||
b.value = 0;
|
||||
b.style.visibility = "visible";
|
||||
for (i = 0; i<=100; ++i){
|
||||
await new Promise(resolve => setTimeout(resolve, 50));
|
||||
b.value = i;
|
||||
}
|
||||
b.style.visibility = "hidden";
|
||||
console.log('stop wifi scan');
|
||||
GetDataFile("/api/wifiscan.json", function(data){PrintNetworks(data);});
|
||||
}
|
||||
showMenu('header-toggle','navbar');
|
||||
</script>
|
||||
</body>
|
||||
</body>
|
||||
</html>
|
||||
22
HTML/api/wifiscan.json
Normal file
22
HTML/api/wifiscan.json
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
[
|
||||
~wifisc(0)~,
|
||||
~wifisc(1)~,
|
||||
~wifisc(2)~,
|
||||
~wifisc(3)~,
|
||||
~wifisc(4)~,
|
||||
~wifisc(5)~,
|
||||
~wifisc(6)~,
|
||||
~wifisc(7)~,
|
||||
~wifisc(8)~,
|
||||
~wifisc(9)~,
|
||||
~wifisc(10)~,
|
||||
~wifisc(11)~,
|
||||
~wifisc(12)~,
|
||||
~wifisc(13)~,
|
||||
~wifisc(14)~,
|
||||
~wifisc(15)~,
|
||||
~wifisc(16)~,
|
||||
~wifisc(17)~,
|
||||
~wifisc(18)~,
|
||||
~wifisc(19)~
|
||||
]
|
||||
|
|
@ -10,6 +10,7 @@ api/set3.json
|
|||
api/stat.json
|
||||
api/status.json
|
||||
api/tmr.json
|
||||
api/wifiscan.json
|
||||
favicon.ico
|
||||
index.html
|
||||
info.html
|
||||
|
|
|
|||
|
|
@ -370,6 +370,13 @@ input[type="radio"] { margin-top: -1px; vertical-align: middle;}
|
|||
display:none;
|
||||
}
|
||||
|
||||
.scanbar {
|
||||
visibility: hidden;
|
||||
width: 300px;
|
||||
height: 50px;
|
||||
margin: 0 20px;
|
||||
}
|
||||
|
||||
.clerr {
|
||||
color:#b00000;
|
||||
font-weight:bold;
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 111839f329061fbcd4cf78a97c1e0b8d6ba94c05
|
||||
Subproject commit 82a2328571205dd3f11ab67560d0ca032b262bac
|
||||
Loading…
Reference in New Issue
Block a user