web interface wifi scan implemented
This commit is contained in:
parent
13c7f5d1db
commit
eabed85bf4
|
|
@ -20,7 +20,8 @@
|
|||
<div class="mlpc">
|
||||
<form name="eth" method="post">
|
||||
<div class="mlhdr">ETHERNET</div>
|
||||
<table class='cntr'><tr>
|
||||
<table class='cntr'>
|
||||
<tr>
|
||||
<script>PrintCheckBox('Включить ETHERNET','ethen','~ethen~','configIPBoxes()');
|
||||
PrintCheckBox('Включить DHCP','dhcp','~ecbdh~','configIPBoxes()');
|
||||
PrintIPInput('IP Станции:','ipa','~eip~');
|
||||
|
|
@ -30,7 +31,11 @@
|
|||
PrintIPInput('DNS2:','dns2','~bkedns~');
|
||||
PrintIPInput('DNS3:','dns3','~fledns~');
|
||||
PrintMACInput('MAC:','mac','~emacadr~');</script>
|
||||
<tr><td></td></tr></table><br/>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
<script>PrintSaveFail('~status_fail~');
|
||||
PrintSaveBtn('eth'); PrintApplyBtn('eth');</script>
|
||||
</form>
|
||||
|
|
@ -48,8 +53,15 @@
|
|||
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>
|
||||
<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>
|
||||
|
|
@ -62,9 +74,17 @@
|
|||
<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>
|
||||
<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~');
|
||||
|
|
@ -79,7 +99,11 @@
|
|||
PrintIPInput('DNS3:','dns3','~dns3~');
|
||||
PrintMACInput('MAC(CLN):','mac','~macadr~');
|
||||
PrintMACInput('MAC(AP):','mac2','~apmacadr~');</script>
|
||||
<tr><td></td></tr></table><br/>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
|
||||
<script>PrintSaveFail('~status_fail~');
|
||||
PrintSaveBtn('wifi'); PrintApplyBtn('wifi');</script>
|
||||
|
|
@ -118,20 +142,58 @@
|
|||
<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>
|
||||
|
|
|
|||
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